1431{
1433
1441
1451
1453
1455 {
1457 {
1459
1461 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1462
1466 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1467 }
1468 }
1469
1471 {
1473
1475 }
1476
1478 {
1479 super.EEDelete(parent);
1480
1482
1485 }
1486
1488 {
1489 super.EEItemLocationChanged(oldLoc, newLoc);
1490
1493 {
1494 switch (oldLoc.GetParent().GetType())
1495 {
1496 case "FryingPan":
1497 case "Pot":
1498 case "Cauldron":
1499 case "SharpWoodenStick":
1501 break;
1502 }
1503
1506 {
1508 }
1509 }
1510
1511 if (oldLoc.IsValid())
1513
1516 }
1517
1519 {
1522 }
1523
1525 {
1528
1529 return true;
1530 }
1531
1533 {
1535 {
1537 }
1538 }
1539
1542 {
1543 int foodStageType;
1544
1546 if (foodStage)
1547 foodStageType = foodStage.GetFoodStageType();
1548
1553
1554 return agentsIn;
1555 }
1556
1557
1559 {
1560 return false;
1561 }
1562
1564 {
1565 return false;
1566 }
1567
1569 {
1571 {
1573 {
1576
1579
1580 default:
1581 return super.GetTemperatureFreezeTime();
1582 }
1583 }
1584
1585 return super.GetTemperatureFreezeTime();
1586 }
1587
1589 {
1591 {
1593 {
1596
1599
1600 default:
1601 return super.GetTemperatureThawTime();
1602 }
1603 }
1604
1605 return super.GetTemperatureThawTime();
1606 }
1607
1609 {
1611 }
1612
1613
1614
1615
1617 {
1618 SetSynchDirty();
1619 }
1620
1622 {
1623 super.OnVariablesSynchronized();
1624
1625
1626
1627
1629 {
1631 }
1632 else
1633 {
1635 }
1636
1639 }
1640
1641
1642
1643
1645 {
1648
1650 }
1651
1653 {
1654 string soundName = "";
1655
1658
1660 {
1662 }
1663 else
1664 {
1666 {
1668 {
1673 else
1674 soundName = "";
1675 break;
1676 }
1677
1679 {
1684 else
1685 soundName = "";
1686 break;
1687 }
1688
1690 {
1695 else
1696 soundName = "";
1697 break;
1698 }
1699
1700 default:
1701 soundName = "";
1702 break;
1703 }
1704
1706 {
1707 if (soundName == "")
1708 {
1710 }
1711 else
1712 {
1714 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1715 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1717 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1718 {
1720 }
1721 }
1722 }
1723 }
1724
1726 }
1727
1729 {
1732 }
1733
1734
1735
1736
1738 {
1739 super.OnStoreSave(ctx);
1740
1742 {
1744 }
1745
1746
1749 }
1750
1752 {
1753 if (!super.OnStoreLoad(ctx, version))
1754 return false;
1755
1757 {
1759 return false;
1760 }
1761
1762 if (version >= 115)
1763 {
1765 {
1767 return false;
1768 }
1770 {
1772 return false;
1773 }
1774 }
1775
1778
1779 return true;
1780 }
1781
1783 {
1784 super.AfterStoreLoad();
1785
1787 }
1788
1789
1791 {
1793 }
1794
1795
1797 {
1798 return false;
1799 }
1800
1802 {
1803 return false;
1804 }
1805
1807 {
1808 return false;
1809 }
1810
1812 {
1813 return false;
1814 }
1815
1816
1817
1818
1819
1821 {
1824 {
1825 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1826 }
1827 else if (classname != "" && food_stage)
1828 {
1829 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1830 }
1831 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1833
1834 }
1835
1837 {
1840 {
1842 }
1843 else if (classname != "" && food_stage)
1844 {
1845 return FoodStage.GetEnergy(null, food_stage, classname);
1846 }
1847 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1849 }
1850
1852 {
1855 {
1857 }
1858 else if (classname != "" && food_stage)
1859 {
1860 return FoodStage.GetWater(null, food_stage, classname);
1861 }
1862 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1864 }
1865
1867 {
1870 {
1871 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1872 }
1873 else if (classname != "" && food_stage)
1874 {
1875 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1876 }
1877 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1879
1880 }
1881
1883 {
1886 {
1887 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1888 }
1889 else if (classname != "" && food_stage)
1890 {
1891 return FoodStage.GetToxicity(null, food_stage, classname);
1892 }
1893 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1895 }
1896
1898 {
1901 {
1903 }
1904 else if (classname != "" && food_stage)
1905 {
1906 return FoodStage.GetAgents(null, food_stage, classname);
1907 }
1908 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1910 }
1911
1913 {
1916 {
1917 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1918 }
1919 else if (classname != "" && food_stage)
1920 {
1921 return FoodStage.GetDigestibility(null, food_stage, classname);
1922 }
1923 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1925 }
1926
1928 {
1931 {
1932 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1933 }
1934 else if (className != "" && foodStage)
1935 {
1936 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1937 }
1938 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1940 }
1941
1943 {
1953
1954 return profile;
1955 }
1956
1957
1958
1959
1961 {
1963 }
1964
1965
1967 {
1969 {
1971 }
1972
1973 return false;
1974 }
1975
1977 {
1979 {
1981 }
1982
1983 return false;
1984 }
1985
1987 {
1989 {
1991 }
1992
1993 return false;
1994 }
1995
1997 {
1999 {
2001 }
2002
2003 return false;
2004 }
2005
2007 {
2009 {
2011 }
2012
2013 return false;
2014 }
2015
2017 {
2019 {
2021 }
2022
2023 return false;
2024 }
2025
2026
2028 {
2030 }
2031
2033 {
2034 return GetFoodStage().GetNextFoodStageType( cooking_method );
2035 }
2036
2038 {
2039 return GetFoodStage().GetFoodStageName( food_stage_type );
2040 }
2041
2043 {
2044 return GetFoodStage().CanChangeToNewStage( cooking_method );
2045 }
2046
2047
2049 {
2050 if ( !source.GetFoodStage())
2051 return;
2056 }
2057
2060 {
2063 }
2064
2067 {
2068 switch (stageNew)
2069 {
2074 break;
2075
2078 break;
2079 }
2080 }
2081
2082
2083
2084
2085
2087 {
2089 }
2090
2092 {
2094
2095
2097 }
2098
2100 {
2102 {
2105 }
2106 }
2107
2108
2110 {
2112 if (player)
2113 {
2115 player.ServerReplaceItemInHandsWithNew(lambda);
2116 }
2117 else
2118 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2119 }
2120
2122 {
2124 }
2125
2127 {
2128 super.SetActions();
2129
2132 }
2133
2135 {
2136 #ifndef SERVER
2138 {
2140
2143 }
2144 #endif
2145 }
2146
2148 {
2149 #ifndef SERVER
2151 {
2155 }
2156 #endif
2157 }
2158
2160 {
2161 return false;
2162 }
2163
2165 {
2167 }
2168
2169 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2170 {
2172
2173 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2175 if ( hasRootAsPlayer )
2177
2178
2179
2180
2181
2182
2183
2185 {
2186
2188 {
2190 {
2194 break;
2195
2199 break;
2200
2204 break;
2205
2209 default:
2212 return;
2213 }
2214
2215
2216 }
2217
2219
2221 {
2223 {
2224
2226 {
2228 }
2230 {
2233 {
2235 }
2236 else
2237 {
2239 {
2241 }
2242 else
2243 {
2245 }
2246 }
2247 }
2248 }
2249 }
2250
2251 }
2253 {
2254
2256 {
2258 {
2262 break;
2263
2267 break;
2268
2272 break;
2273
2277 break;
2278
2281 default:
2284 return;
2285 }
2286 }
2287
2289
2291 {
2293 {
2294
2296 {
2298 }
2299 }
2300 }
2301 }
2303 {
2304
2306 {
2308 {
2312 break;
2313
2316 default:
2319 return;
2320 }
2321 }
2322
2324
2326 {
2328 {
2329
2331 {
2333 }
2334 }
2335 }
2336 }
2337 else
2338 {
2339
2341
2343 {
2346
2347 }
2348 else
2349 {
2351 {
2354 }
2355 }
2356 }
2357 }
2358
2360 {
2361 if (
GetGame().IsDedicatedServer())
2362 return;
2363
2365 {
2367 GetInventory().GetCurrentInventoryLocation(invLoc);
2369 {
2371 if (ptcMgr)
2372 {
2377 }
2378 }
2379 }
2381 {
2383 {
2386 return;
2387 }
2388
2390 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2392 {
2395 }
2396 }
2397 }
2398
2399 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2400 {
2402 {
2407 }
2408
2409 super.GetDebugActions(outputList);
2410 }
2411
2413 {
2414 super.OnAction(action_id, player, ctx);
2415
2417 {
2418 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2419 {
2421 if (food_stage_prev <= 0)
2422 {
2424 }
2426 return true;
2427 }
2428 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2429 {
2432 {
2434 }
2436 return true;
2437 }
2438
2439 }
2440
2441 #ifdef DIAG_DEVELOPER
2442 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2443 {
2444 PrintNutritionsData();
2445 return true;
2446 }
2447 #endif
2448
2449 return false;
2450 }
2451
2453 {
2454 string debug_output;
2455
2456 debug_output = super.GetDebugText();
2457
2460
2461 return debug_output;
2462 }
2463
2464
2465
2466
2467
2469 {
2470 float ret = super.GetBaitEffectivity();
2471
2473 {
2474 ret *= 0.5;
2475 }
2476
2477 return ret;
2478 }
2479
2481 {
2483 }
2484
2486 {
2488 }
2489
2491 {
2493 }
2494
2495 #ifdef DIAG_DEVELOPER
2496 private void PrintNutritionsData()
2497 {
2498 string nutritionsData = "";
2499
2502
2504 if (profile)
2505 {
2506 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2508 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2512 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2514
2517
2518 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2520 }
2521
2522 nutritionsData += "-----\n";
2523
2525 }
2526 #endif
2527
2529
2532 {
2534 }
2535}
2536
2538{
2540};
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
AttachActionData ActionData ActionAttach()
void AddAction(typename actionName)
DamageType
exposed from C++ (do not change)
AbstractWave m_SoundPlaying
EConsumptionPenaltyContext
void ReplaceEdibleWithNew(string typeName)
ref FoodStage m_FoodStage
static float GetFoodWater(ItemBase item, string classname="", int food_stage=0)
override bool CanBeCooked()
override string GetDebugText()
override void AfterStoreLoad()
void OnFoodStageChange(FoodStageType stageOld, FoodStageType stageNew)
called on server
override void OnVariablesSynchronized()
const string SOUND_BURNING_DONE
bool CanChangeToNewStage(CookingMethodType cooking_method)
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override bool CanItemOverheat()
override float GetBaitEffectivity()
override FoodStage GetFoodStage()
override void SetActions()
override float GetTemperatureFreezeTime()
const string DIRECT_COOKING_SLOT_NAME
FoodStageType GetNextFoodStageType(CookingMethodType cooking_method)
void ChangeFoodStage(FoodStageType new_food_stage_type)
void OnConsume(float amount, PlayerBase consumer)
static float GetFoodNutritionalIndex(ItemBase item, string classname="", int food_stage=0)
SoundOnVehicle m_SoundCooking
static float GetFoodToxicity(ItemBase item, string classname="", int food_stage=0)
void UpdateVisualsEx(bool forced=false)
const string SOUND_BAKING_DONE
static NutritionalProfile GetNutritionalProfile(ItemBase item, string classname="", int food_stage=0)
int FilterAgents(int agentsIn)
Filter agents from the item (override on higher implementations)
override void EEDelete(EntityAI parent)
FoodStageType m_LastDecayStage
override bool CanBeCookedOnStick()
FoodStageType GetLastDecayStage()
string GetFoodStageName(FoodStageType food_stage_type)
override float GetTemperatureThawTime()
void UpdateVaporParticle()
static float GetFoodDigestibility(ItemBase item, string classname="", int food_stage=0)
void TransferFoodStage(notnull Edible_Base source)
override void ProcessDecay(float delta, bool hasRootAsPlayer)
const string SOUND_DRYING_START
void SetCookingTime(float time)
void SoundCookingStart(string sound_name)
const string SOUND_BAKING_START
static float GetFoodTotalVolume(ItemBase item, string classname="", int food_stage=0)
const string SOUND_DRYING_DONE
void HandleFoodStageChangeAgents(FoodStageType stageOld, FoodStageType stageNew)
removes select agents on foodstage transitions
Edible_Base ItemBase ReplaceEdibleWithNewLambda(EntityAI old_item, string new_item_type, PlayerBase player)
bool Consume(float amount, PlayerBase consumer)
EffectSound m_SoundEffectCooking
DEPRECATED.
override bool OnStoreLoad(ParamsReadContext ctx, int version)
FoodStageType GetFoodStageType()
override bool CanProcessDecay()
ParticleSource m_HotVaporParticle
void MakeSoundsOnClient(bool soundstate, CookingMethodType cookingMethod=CookingMethodType.NONE)
static int GetFoodAgents(ItemBase item, string classname="", int food_stage=0)
override bool IsMushroom()
static float GetFoodEnergy(ItemBase item, string classname="", int food_stage=0)
static float GetAgentsPerDigest(ItemBase item, string className="", int foodStage=0)
const string SOUND_BOILING_DONE
int GetConsumptionPenaltyContext()
const string SOUND_BOILING_START
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
CookingMethodType m_CookedByMethod
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void OnStoreSave(ParamsWriteContext ctx)
override bool CanHaveTemperature()
InventoryLocationType
types of Inventory Location
override void InsertAgent(int agent, float count=1)
override void RemoveAllAgentsExcept(int agent_to_keep)
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
ParticleAutoDestroyFlags
Flags to pass to ParticleSource.SetParticleAutoDestroyFlags.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native int ConfigGetInt(string path)
Get int value from config on path.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
override FoodStage GetFoodStage()
Wrapper class for managing sound through SEffectManager.
proto native int GetType()
returns type of InventoryLocation
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
static const int ITEM_HOT_VAPOR
Entity which has the particle instance as an ObjectComponent.
static const float CONSUMPTION_DAMAGE_PER_BITE
static const float CONSUMPTION_DAMAGE_TEMP_THRESHOLD
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Manager class for managing Effect (EffectParticle, EffectSound)
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
proto native CGame GetGame()
Serializer ParamsWriteContext
void Error(string err)
Messagebox with error message.
const float DECAY_FOOD_BAKED_FRVG
const float DECAY_FOOD_CAN_OPEN
const float DECAY_FOOD_RAW_FRVG
const int DECAY_TIMER_RANDOM_PERCENTAGE
const int DECAY_FOOD_FRVG_DRIED_CHANCE
const float DECAY_FOOD_RAW_MEAT
const float DECAY_FOOD_BAKED_MEAT
const float DECAY_FOOD_BOILED_MEAT
const float DECAY_FOOD_BOILED_FRVG
const float DECAY_FOOD_DRIED_MEAT
const float DECAY_FOOD_RAW_CORPSE
const float DECAY_RATE_ON_PLAYER
static const float TEMPERATURE_THAW_TIME_COEF_BURNED
static const float TEMPERATURE_FREEZE_TIME_COEF_BURNED
static const float TEMPERATURE_THAW_TIME_COEF_DRIED
static const float TEMPERATURE_FREEZE_TIME_COEF_DRIED
const int STATE_HOT_LVL_TWO
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
bool Contains(string sample)
Returns true if sample is substring of string.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.