1287{
1289
1297
1307
1309
1311 {
1313 {
1315
1317 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1318
1322 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1323 }
1324 }
1325
1327 {
1329
1331 }
1332
1334 {
1335 super.EEDelete(parent);
1336
1338
1341 }
1342
1344 {
1345 super.EEItemLocationChanged(oldLoc, newLoc);
1346
1349 {
1350 switch (oldLoc.GetParent().GetType())
1351 {
1352 case "FryingPan":
1353 case "Pot":
1354 case "Cauldron":
1355 case "SharpWoodenStick":
1357 break;
1358 }
1359
1362 {
1364 }
1365 }
1366
1367 if (oldLoc.IsValid())
1369
1372 }
1373
1375 {
1378 }
1379
1381 {
1384
1385 return true;
1386 }
1387
1389 {
1391 {
1393 }
1394 }
1395
1398 {
1399 int foodStageType;
1400
1402 if (foodStage)
1403 foodStageType = foodStage.GetFoodStageType();
1404
1409
1410 return agentsIn;
1411 }
1412
1413
1415 {
1416 return false;
1417 }
1418
1420 {
1421 return false;
1422 }
1423
1425 {
1427 {
1429 {
1432
1435
1436 default:
1437 return super.GetTemperatureFreezeTime();
1438 }
1439 }
1440
1441 return super.GetTemperatureFreezeTime();
1442 }
1443
1445 {
1447 {
1449 {
1452
1455
1456 default:
1457 return super.GetTemperatureThawTime();
1458 }
1459 }
1460
1461 return super.GetTemperatureThawTime();
1462 }
1463
1465 {
1467 }
1468
1469
1470
1471
1473 {
1474 SetSynchDirty();
1475 }
1476
1478 {
1479 super.OnVariablesSynchronized();
1480
1481
1482
1483
1485 {
1487 }
1488 else
1489 {
1491 }
1492
1495 }
1496
1497
1498
1499
1501 {
1504
1506 }
1507
1509 {
1510 string soundName = "";
1511
1514
1516 {
1518 }
1519 else
1520 {
1522 {
1524 {
1529 else
1530 soundName = "";
1531 break;
1532 }
1533
1535 {
1540 else
1541 soundName = "";
1542 break;
1543 }
1544
1546 {
1551 else
1552 soundName = "";
1553 break;
1554 }
1555
1556 default:
1557 soundName = "";
1558 break;
1559 }
1560
1562 {
1563 if (soundName == "")
1564 {
1566 }
1567 else
1568 {
1570 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1571 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1573 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1574 {
1576 }
1577 }
1578 }
1579 }
1580
1582 }
1583
1585 {
1588 }
1589
1590
1591
1592
1594 {
1595 super.OnStoreSave(ctx);
1596
1598 {
1600 }
1601
1602
1605 }
1606
1608 {
1609 if (!super.OnStoreLoad(ctx, version))
1610 return false;
1611
1613 {
1615 return false;
1616 }
1617
1618 if (version >= 115)
1619 {
1621 {
1623 return false;
1624 }
1626 {
1628 return false;
1629 }
1630 }
1631
1634
1635 return true;
1636 }
1637
1639 {
1640 super.AfterStoreLoad();
1641
1643 }
1644
1645
1647 {
1649 }
1650
1651
1653 {
1654 return false;
1655 }
1656
1658 {
1659 return false;
1660 }
1661
1663 {
1664 return false;
1665 }
1666
1668 {
1669 return false;
1670 }
1671
1672
1673
1674
1675
1677 {
1680 {
1681 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1682 }
1683 else if (classname != "" && food_stage)
1684 {
1685 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1686 }
1687 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1689
1690 }
1691
1693 {
1696 {
1698 }
1699 else if (classname != "" && food_stage)
1700 {
1701 return FoodStage.GetEnergy(null, food_stage, classname);
1702 }
1703 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1705 }
1706
1708 {
1711 {
1713 }
1714 else if (classname != "" && food_stage)
1715 {
1716 return FoodStage.GetWater(null, food_stage, classname);
1717 }
1718 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1720 }
1721
1723 {
1726 {
1727 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1728 }
1729 else if (classname != "" && food_stage)
1730 {
1731 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1732 }
1733 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1735
1736 }
1737
1739 {
1742 {
1743 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1744 }
1745 else if (classname != "" && food_stage)
1746 {
1747 return FoodStage.GetToxicity(null, food_stage, classname);
1748 }
1749 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1751 }
1752
1754 {
1757 {
1759 }
1760 else if (classname != "" && food_stage)
1761 {
1762 return FoodStage.GetAgents(null, food_stage, classname);
1763 }
1764 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1766 }
1767
1769 {
1772 {
1773 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1774 }
1775 else if (classname != "" && food_stage)
1776 {
1777 return FoodStage.GetDigestibility(null, food_stage, classname);
1778 }
1779 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1781 }
1782
1784 {
1787 {
1788 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1789 }
1790 else if (className != "" && foodStage)
1791 {
1792 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1793 }
1794 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1796 }
1797
1799 {
1809
1810 return profile;
1811 }
1812
1813
1814
1815
1817 {
1819 }
1820
1821
1823 {
1825 {
1827 }
1828
1829 return false;
1830 }
1831
1833 {
1835 {
1837 }
1838
1839 return false;
1840 }
1841
1843 {
1845 {
1847 }
1848
1849 return false;
1850 }
1851
1853 {
1855 {
1857 }
1858
1859 return false;
1860 }
1861
1863 {
1865 {
1867 }
1868
1869 return false;
1870 }
1871
1873 {
1875 {
1877 }
1878
1879 return false;
1880 }
1881
1882
1884 {
1886 }
1887
1889 {
1890 return GetFoodStage().GetNextFoodStageType( cooking_method );
1891 }
1892
1894 {
1895 return GetFoodStage().GetFoodStageName( food_stage_type );
1896 }
1897
1899 {
1900 return GetFoodStage().CanChangeToNewStage( cooking_method );
1901 }
1902
1903
1905 {
1906 if ( !source.GetFoodStage())
1907 return;
1912 }
1913
1916 {
1919 }
1920
1923 {
1924 switch (stageNew)
1925 {
1930 break;
1931
1934 break;
1935 }
1936 }
1937
1938
1939
1940
1941
1943 {
1945 }
1946
1948 {
1950
1951
1953 }
1954
1956 {
1958 {
1961 }
1962 }
1963
1964
1966 {
1968 if (player)
1969 {
1971 player.ServerReplaceItemInHandsWithNew(lambda);
1972 }
1973 else
1974 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1975 }
1976
1978 {
1980 }
1981
1983 {
1984 super.SetActions();
1985
1988 }
1989
1991 {
1992 #ifndef SERVER
1994 {
1996
1999 }
2000 #endif
2001 }
2002
2004 {
2005 #ifndef SERVER
2007 {
2011 }
2012 #endif
2013 }
2014
2016 {
2017 return false;
2018 }
2019
2021 {
2023 }
2024
2025 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2026 {
2028
2029 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2031 if ( hasRootAsPlayer )
2033
2034
2035
2036
2037
2038
2039
2041 {
2042
2044 {
2046 {
2050 break;
2051
2055 break;
2056
2060 break;
2061
2065 default:
2068 return;
2069 }
2070
2071
2072 }
2073
2075
2077 {
2079 {
2080
2082 {
2084 }
2086 {
2089 {
2091 }
2092 else
2093 {
2095 {
2097 }
2098 else
2099 {
2101 }
2102 }
2103 }
2104 }
2105 }
2106
2107 }
2109 {
2110
2112 {
2114 {
2118 break;
2119
2123 break;
2124
2128 break;
2129
2133 break;
2134
2137 default:
2140 return;
2141 }
2142 }
2143
2145
2147 {
2149 {
2150
2152 {
2154 }
2155 }
2156 }
2157 }
2159 {
2160
2162 {
2164 {
2168 break;
2169
2172 default:
2175 return;
2176 }
2177 }
2178
2180
2182 {
2184 {
2185
2187 {
2189 }
2190 }
2191 }
2192 }
2193 else
2194 {
2195
2197
2199 {
2202
2203 }
2204 else
2205 {
2207 {
2210 }
2211 }
2212 }
2213 }
2214
2216 {
2217 if (
GetGame().IsDedicatedServer())
2218 return;
2219
2221 {
2223 GetInventory().GetCurrentInventoryLocation(invLoc);
2225 {
2227 if (ptcMgr)
2228 {
2233 }
2234 }
2235 }
2237 {
2239 {
2242 return;
2243 }
2244
2246 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2248 {
2251 }
2252 }
2253 }
2254
2255 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2256 {
2257 super.GetDebugActions(outputList);
2258
2260 {
2264 }
2265 }
2266
2268 {
2269 super.OnAction(action_id, player, ctx);
2270
2272 {
2273 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2274 {
2276 if (food_stage_prev <= 0)
2277 {
2279 }
2281 return true;
2282 }
2283 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2284 {
2287 {
2289 }
2291 return true;
2292 }
2293
2294 }
2295
2296 #ifdef DIAG_DEVELOPER
2297 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2298 {
2299 PrintNutritionsData();
2300 return true;
2301 }
2302 #endif
2303
2304 return false;
2305 }
2306
2308 {
2309 string debug_output;
2310
2311 debug_output = super.GetDebugText();
2312
2315
2316 return debug_output;
2317 }
2318
2319
2320
2321
2322
2324 {
2325 float ret = super.GetBaitEffectivity();
2326
2328 {
2329 ret *= 0.5;
2330 }
2331
2332 return ret;
2333 }
2334
2336 {
2338 }
2339
2341 {
2343 }
2344
2346 {
2348 }
2349
2350 #ifdef DIAG_DEVELOPER
2351 private void PrintNutritionsData()
2352 {
2353 string nutritionsData = "";
2354
2357
2359 if (profile)
2360 {
2361 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2363 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2367 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2369
2372
2373 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2375 }
2376
2377 nutritionsData += "-----\n";
2378
2380 }
2381 #endif
2382
2384
2387 {
2389 }
2390}
2391
2393{
2395};
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.