1295{
1297
1305
1315
1317
1319 {
1321 {
1323
1325 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1326
1330 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1331 }
1332 }
1333
1335 {
1337
1339 }
1340
1342 {
1343 super.EEDelete(parent);
1344
1346
1349 }
1350
1352 {
1353 super.EEItemLocationChanged(oldLoc, newLoc);
1354
1357 {
1358 switch (oldLoc.GetParent().GetType())
1359 {
1360 case "FryingPan":
1361 case "Pot":
1362 case "Cauldron":
1363 case "SharpWoodenStick":
1365 break;
1366 }
1367
1370 {
1372 }
1373 }
1374
1375 if (oldLoc.IsValid())
1377
1380 }
1381
1383 {
1386 }
1387
1389 {
1392
1393 return true;
1394 }
1395
1397 {
1399 {
1401 }
1402 }
1403
1406 {
1407 int foodStageType;
1408
1410 if (foodStage)
1411 foodStageType = foodStage.GetFoodStageType();
1412
1417
1418 return agentsIn;
1419 }
1420
1421
1423 {
1424 return false;
1425 }
1426
1428 {
1429 return false;
1430 }
1431
1433 {
1435 {
1437 {
1440
1443
1444 default:
1445 return super.GetTemperatureFreezeTime();
1446 }
1447 }
1448
1449 return super.GetTemperatureFreezeTime();
1450 }
1451
1453 {
1455 {
1457 {
1460
1463
1464 default:
1465 return super.GetTemperatureThawTime();
1466 }
1467 }
1468
1469 return super.GetTemperatureThawTime();
1470 }
1471
1473 {
1475 }
1476
1477
1478
1479
1481 {
1482 SetSynchDirty();
1483 }
1484
1486 {
1487 super.OnVariablesSynchronized();
1488
1489
1490
1491
1493 {
1495 }
1496 else
1497 {
1499 }
1500
1503 }
1504
1505
1506
1507
1509 {
1512
1514 }
1515
1517 {
1518 string soundName = "";
1519
1522
1524 {
1526 }
1527 else
1528 {
1530 {
1532 {
1537 else
1538 soundName = "";
1539 break;
1540 }
1541
1543 {
1548 else
1549 soundName = "";
1550 break;
1551 }
1552
1554 {
1559 else
1560 soundName = "";
1561 break;
1562 }
1563
1564 default:
1565 soundName = "";
1566 break;
1567 }
1568
1570 {
1571 if (soundName == "")
1572 {
1574 }
1575 else
1576 {
1578 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1579 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1581 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1582 {
1584 }
1585 }
1586 }
1587 }
1588
1590 }
1591
1593 {
1596 }
1597
1598
1599
1600
1602 {
1603 super.OnStoreSave(ctx);
1604
1606 {
1608 }
1609
1610
1613 }
1614
1616 {
1617 if (!super.OnStoreLoad(ctx, version))
1618 return false;
1619
1621 {
1623 return false;
1624 }
1625
1626 if (version >= 115)
1627 {
1629 {
1631 return false;
1632 }
1634 {
1636 return false;
1637 }
1638 }
1639
1642
1643 return true;
1644 }
1645
1647 {
1648 super.AfterStoreLoad();
1649
1651 }
1652
1653
1655 {
1657 }
1658
1659
1661 {
1662 return false;
1663 }
1664
1666 {
1667 return false;
1668 }
1669
1671 {
1672 return false;
1673 }
1674
1676 {
1677 return false;
1678 }
1679
1680
1681
1682
1683
1685 {
1688 {
1689 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1690 }
1691 else if (classname != "" && food_stage)
1692 {
1693 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1694 }
1695 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1697
1698 }
1699
1701 {
1704 {
1706 }
1707 else if (classname != "" && food_stage)
1708 {
1709 return FoodStage.GetEnergy(null, food_stage, classname);
1710 }
1711 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1713 }
1714
1716 {
1719 {
1721 }
1722 else if (classname != "" && food_stage)
1723 {
1724 return FoodStage.GetWater(null, food_stage, classname);
1725 }
1726 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1728 }
1729
1731 {
1734 {
1735 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1736 }
1737 else if (classname != "" && food_stage)
1738 {
1739 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1740 }
1741 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1743
1744 }
1745
1747 {
1750 {
1751 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1752 }
1753 else if (classname != "" && food_stage)
1754 {
1755 return FoodStage.GetToxicity(null, food_stage, classname);
1756 }
1757 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1759 }
1760
1762 {
1765 {
1767 }
1768 else if (classname != "" && food_stage)
1769 {
1770 return FoodStage.GetAgents(null, food_stage, classname);
1771 }
1772 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1774 }
1775
1777 {
1780 {
1781 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1782 }
1783 else if (classname != "" && food_stage)
1784 {
1785 return FoodStage.GetDigestibility(null, food_stage, classname);
1786 }
1787 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1789 }
1790
1792 {
1795 {
1796 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1797 }
1798 else if (className != "" && foodStage)
1799 {
1800 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1801 }
1802 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1804 }
1805
1807 {
1817
1818 return profile;
1819 }
1820
1821
1822
1823
1825 {
1827 }
1828
1829
1831 {
1833 {
1835 }
1836
1837 return false;
1838 }
1839
1841 {
1843 {
1845 }
1846
1847 return false;
1848 }
1849
1851 {
1853 {
1855 }
1856
1857 return false;
1858 }
1859
1861 {
1863 {
1865 }
1866
1867 return false;
1868 }
1869
1871 {
1873 {
1875 }
1876
1877 return false;
1878 }
1879
1881 {
1883 {
1885 }
1886
1887 return false;
1888 }
1889
1890
1892 {
1894 }
1895
1897 {
1898 return GetFoodStage().GetNextFoodStageType( cooking_method );
1899 }
1900
1902 {
1903 return GetFoodStage().GetFoodStageName( food_stage_type );
1904 }
1905
1907 {
1908 return GetFoodStage().CanChangeToNewStage( cooking_method );
1909 }
1910
1911
1913 {
1914 if ( !source.GetFoodStage())
1915 return;
1920 }
1921
1924 {
1927 }
1928
1931 {
1932 switch (stageNew)
1933 {
1938 break;
1939
1942 break;
1943 }
1944 }
1945
1946
1947
1948
1949
1951 {
1953 }
1954
1956 {
1958
1959
1961 }
1962
1964 {
1966 {
1969 }
1970 }
1971
1972
1974 {
1976 if (player)
1977 {
1979 player.ServerReplaceItemInHandsWithNew(lambda);
1980 }
1981 else
1982 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1983 }
1984
1986 {
1988 }
1989
1991 {
1992 super.SetActions();
1993
1996 }
1997
1999 {
2000 #ifndef SERVER
2002 {
2004
2007 }
2008 #endif
2009 }
2010
2012 {
2013 #ifndef SERVER
2015 {
2019 }
2020 #endif
2021 }
2022
2024 {
2025 return false;
2026 }
2027
2029 {
2031 }
2032
2033 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2034 {
2036
2037 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2039 if ( hasRootAsPlayer )
2041
2042
2043
2044
2045
2046
2047
2049 {
2050
2052 {
2054 {
2058 break;
2059
2063 break;
2064
2068 break;
2069
2073 default:
2076 return;
2077 }
2078
2079
2080 }
2081
2083
2085 {
2087 {
2088
2090 {
2092 }
2094 {
2097 {
2099 }
2100 else
2101 {
2103 {
2105 }
2106 else
2107 {
2109 }
2110 }
2111 }
2112 }
2113 }
2114
2115 }
2117 {
2118
2120 {
2122 {
2126 break;
2127
2131 break;
2132
2136 break;
2137
2141 break;
2142
2145 default:
2148 return;
2149 }
2150 }
2151
2153
2155 {
2157 {
2158
2160 {
2162 }
2163 }
2164 }
2165 }
2167 {
2168
2170 {
2172 {
2176 break;
2177
2180 default:
2183 return;
2184 }
2185 }
2186
2188
2190 {
2192 {
2193
2195 {
2197 }
2198 }
2199 }
2200 }
2201 else
2202 {
2203
2205
2207 {
2210
2211 }
2212 else
2213 {
2215 {
2218 }
2219 }
2220 }
2221 }
2222
2224 {
2225 if (
GetGame().IsDedicatedServer())
2226 return;
2227
2229 {
2231 GetInventory().GetCurrentInventoryLocation(invLoc);
2233 {
2235 if (ptcMgr)
2236 {
2241 }
2242 }
2243 }
2245 {
2247 {
2250 return;
2251 }
2252
2254 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2256 {
2259 }
2260 }
2261 }
2262
2263 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2264 {
2265 super.GetDebugActions(outputList);
2266
2268 {
2272 }
2273 }
2274
2276 {
2277 super.OnAction(action_id, player, ctx);
2278
2280 {
2281 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2282 {
2284 if (food_stage_prev <= 0)
2285 {
2287 }
2289 return true;
2290 }
2291 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2292 {
2295 {
2297 }
2299 return true;
2300 }
2301
2302 }
2303
2304 #ifdef DIAG_DEVELOPER
2305 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2306 {
2307 PrintNutritionsData();
2308 return true;
2309 }
2310 #endif
2311
2312 return false;
2313 }
2314
2316 {
2317 string debug_output;
2318
2319 debug_output = super.GetDebugText();
2320
2323
2324 return debug_output;
2325 }
2326
2327
2328
2329
2330
2332 {
2333 float ret = super.GetBaitEffectivity();
2334
2336 {
2337 ret *= 0.5;
2338 }
2339
2340 return ret;
2341 }
2342
2344 {
2346 }
2347
2349 {
2351 }
2352
2354 {
2356 }
2357
2358 #ifdef DIAG_DEVELOPER
2359 private void PrintNutritionsData()
2360 {
2361 string nutritionsData = "";
2362
2365
2367 if (profile)
2368 {
2369 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2371 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2375 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2377
2380
2381 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2383 }
2384
2385 nutritionsData += "-----\n";
2386
2388 }
2389 #endif
2390
2392
2395 {
2397 }
2398}
2399
2401{
2403};
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
AttachActionData ActionData ActionAttach()
void AddAction(typename actionName)
DamageType
exposed from C++ (do not change)
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.