1154{
1156
1164
1174
1176
1178 {
1180 {
1182
1184 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1185
1189 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1190 }
1191 }
1192
1194 {
1196
1198 }
1199
1201 {
1202 super.EEDelete(parent);
1203
1205
1208 }
1209
1211 {
1212 super.EEItemLocationChanged(oldLoc, newLoc);
1213
1216 {
1217 switch (oldLoc.GetParent().GetType())
1218 {
1219 case "FryingPan":
1220 case "Pot":
1221 case "Cauldron":
1222 case "SharpWoodenStick":
1224 break;
1225 }
1226
1229 {
1231 }
1232 }
1233
1234 if (oldLoc.IsValid())
1236
1239 }
1240
1242 {
1245 }
1246
1248 {
1251
1252 return true;
1253 }
1254
1256 {
1258 {
1260 }
1261 }
1262
1265 {
1266 int foodStageType;
1267
1269 if (foodStage)
1270 foodStageType = foodStage.GetFoodStageType();
1271
1276
1277 return agentsIn;
1278 }
1279
1280
1282 {
1283 return false;
1284 }
1285
1287 {
1288 return false;
1289 }
1290
1292 {
1294 {
1296 {
1299
1302
1303 default:
1304 return super.GetTemperatureFreezeTime();
1305 }
1306 }
1307
1308 return super.GetTemperatureFreezeTime();
1309 }
1310
1312 {
1314 {
1316 {
1319
1322
1323 default:
1324 return super.GetTemperatureThawTime();
1325 }
1326 }
1327
1328 return super.GetTemperatureThawTime();
1329 }
1330
1332 {
1334 }
1335
1336
1337
1338
1340 {
1341 SetSynchDirty();
1342 }
1343
1345 {
1346 super.OnVariablesSynchronized();
1347
1348
1349
1350
1352 {
1354 }
1355 else
1356 {
1358 }
1359
1362 }
1363
1364
1365
1366
1368 {
1371
1373 }
1374
1376 {
1377 string soundName = "";
1378
1381
1383 {
1385 }
1386 else
1387 {
1389 {
1391 {
1396 else
1397 soundName = "";
1398 break;
1399 }
1400
1402 {
1407 else
1408 soundName = "";
1409 break;
1410 }
1411
1413 {
1418 else
1419 soundName = "";
1420 break;
1421 }
1422
1423 default:
1424 soundName = "";
1425 break;
1426 }
1427
1429 {
1430 if (soundName == "")
1431 {
1433 }
1434 else
1435 {
1437 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1438 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1440 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1441 {
1443 }
1444 }
1445 }
1446 }
1447
1449 }
1450
1452 {
1455 }
1456
1457
1458
1459
1461 {
1462 super.OnStoreSave(ctx);
1463
1465 {
1467 }
1468
1469
1472 }
1473
1475 {
1476 if (!super.OnStoreLoad(ctx, version))
1477 return false;
1478
1480 {
1482 return false;
1483 }
1484
1485 if (version >= 115)
1486 {
1488 {
1490 return false;
1491 }
1493 {
1495 return false;
1496 }
1497 }
1498
1501
1502 return true;
1503 }
1504
1506 {
1507 super.AfterStoreLoad();
1508
1510 }
1511
1512
1514 {
1516 }
1517
1518
1520 {
1521 return false;
1522 }
1523
1525 {
1526 return false;
1527 }
1528
1530 {
1531 return false;
1532 }
1533
1535 {
1536 return false;
1537 }
1538
1539
1540
1541
1542
1544 {
1547 {
1548 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1549 }
1550 else if (classname != "" && food_stage)
1551 {
1552 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1553 }
1554 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1555 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1556
1557 }
1558
1560 {
1563 {
1565 }
1566 else if (classname != "" && food_stage)
1567 {
1568 return FoodStage.GetEnergy(null, food_stage, classname);
1569 }
1570 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1571 return g_Game.ConfigGetFloat( class_path +
" energy" );
1572 }
1573
1575 {
1578 {
1580 }
1581 else if (classname != "" && food_stage)
1582 {
1583 return FoodStage.GetWater(null, food_stage, classname);
1584 }
1585 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1586 return g_Game.ConfigGetFloat( class_path +
" water" );
1587 }
1588
1590 {
1593 {
1594 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1595 }
1596 else if (classname != "" && food_stage)
1597 {
1598 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1599 }
1600 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1601 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1602
1603 }
1604
1606 {
1609 {
1610 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1611 }
1612 else if (classname != "" && food_stage)
1613 {
1614 return FoodStage.GetToxicity(null, food_stage, classname);
1615 }
1616 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1617 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1618 }
1619
1621 {
1624 {
1626 }
1627 else if (classname != "" && food_stage)
1628 {
1629 return FoodStage.GetAgents(null, food_stage, classname);
1630 }
1631 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1632 return g_Game.ConfigGetInt( class_path +
" agents" );
1633 }
1634
1636 {
1639 {
1640 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1641 }
1642 else if (classname != "" && food_stage)
1643 {
1644 return FoodStage.GetDigestibility(null, food_stage, classname);
1645 }
1646 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1647 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1648 }
1649
1651 {
1654 {
1655 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1656 }
1657 else if (className != "" && foodStage)
1658 {
1659 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1660 }
1661 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1662 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1663 }
1664
1666 {
1676
1677 return profile;
1678 }
1679
1680
1681
1682
1684 {
1686 }
1687
1688
1690 {
1692 {
1694 }
1695
1696 return false;
1697 }
1698
1700 {
1702 {
1704 }
1705
1706 return false;
1707 }
1708
1710 {
1712 {
1714 }
1715
1716 return false;
1717 }
1718
1720 {
1722 {
1724 }
1725
1726 return false;
1727 }
1728
1730 {
1732 {
1734 }
1735
1736 return false;
1737 }
1738
1740 {
1742 {
1744 }
1745
1746 return false;
1747 }
1748
1749
1751 {
1753 }
1754
1756 {
1757 return GetFoodStage().GetNextFoodStageType( cooking_method );
1758 }
1759
1761 {
1762 return GetFoodStage().GetFoodStageName( food_stage_type );
1763 }
1764
1766 {
1767 return GetFoodStage().CanChangeToNewStage( cooking_method );
1768 }
1769
1770
1772 {
1773 if ( !source.GetFoodStage())
1774 return;
1779 }
1780
1783 {
1786 }
1787
1790 {
1791 switch (stageNew)
1792 {
1797 break;
1798
1801 break;
1802 }
1803 }
1804
1805
1806
1807
1808
1810 {
1812 }
1813
1815 {
1817
1818
1820 }
1821
1823 {
1825 {
1828 }
1829 }
1830
1831
1833 {
1835 if (player)
1836 {
1838 player.ServerReplaceItemInHandsWithNew(lambda);
1839 }
1840 else
1841 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1842 }
1843
1845 {
1847 }
1848
1850 {
1851 super.SetActions();
1852
1855 }
1856
1858 {
1859 #ifndef SERVER
1860 #ifndef NO_GUI
1862 {
1864
1867 }
1868 #endif
1869 #endif
1870 }
1871
1873 {
1874 #ifndef SERVER
1875 #ifndef NO_GUI
1877 {
1881 }
1882 #endif
1883 #endif
1884 }
1885
1887 {
1888 return false;
1889 }
1890
1892 {
1894 }
1895
1896 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1897 {
1899
1900 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
1902 if ( hasRootAsPlayer )
1904
1905
1906
1907
1908
1909
1910
1912 {
1913
1915 {
1917 {
1921 break;
1922
1926 break;
1927
1931 break;
1932
1936 default:
1939 return;
1940 }
1941
1942
1943 }
1944
1946
1948 {
1950 {
1951
1953 {
1955 }
1957 {
1960 {
1962 }
1963 else
1964 {
1966 {
1968 }
1969 else
1970 {
1972 }
1973 }
1974 }
1975 }
1976 }
1977
1978 }
1980 {
1981
1983 {
1985 {
1989 break;
1990
1994 break;
1995
1999 break;
2000
2004 break;
2005
2008 default:
2011 return;
2012 }
2013 }
2014
2016
2018 {
2020 {
2021
2023 {
2025 }
2026 }
2027 }
2028 }
2030 {
2031
2033 {
2035 {
2039 break;
2040
2043 default:
2046 return;
2047 }
2048 }
2049
2051
2053 {
2055 {
2056
2058 {
2060 }
2061 }
2062 }
2063 }
2064 else
2065 {
2066
2068
2070 {
2073
2074 }
2075 else
2076 {
2078 {
2081 }
2082 }
2083 }
2084 }
2085
2087 {
2088 if (
g_Game.IsHeadlessOrDedicatedServer())
2089 return;
2090
2092 {
2094 GetInventory().GetCurrentInventoryLocation(invLoc);
2096 {
2098 if (ptcMgr)
2099 {
2104 }
2105 }
2106 }
2108 {
2110 {
2113 return;
2114 }
2115
2117 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2119 {
2122 }
2123 }
2124 }
2125
2126 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2127 {
2129 {
2134 }
2135
2136 super.GetDebugActions(outputList);
2137 }
2138
2140 {
2141 super.OnAction(action_id, player, ctx);
2142
2144 {
2145 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2146 {
2148 if (food_stage_prev <= 0)
2149 {
2151 }
2153 return true;
2154 }
2155 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2156 {
2159 {
2161 }
2163 return true;
2164 }
2165
2166 }
2167
2168 #ifdef DIAG_DEVELOPER
2169 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2170 {
2171 PrintNutritionsData();
2172 return true;
2173 }
2174 #endif
2175
2176 return false;
2177 }
2178
2180 {
2181 string debug_output;
2182
2183 debug_output = super.GetDebugText();
2184
2187
2188 return debug_output;
2189 }
2190
2191
2192
2193
2194
2196 {
2197 float ret = super.GetBaitEffectivity();
2198
2200 {
2201 ret *= 0.5;
2202 }
2203
2204 return ret;
2205 }
2206
2208 {
2210 }
2211
2213 {
2215 }
2216
2218 {
2220 }
2221
2222 #ifdef DIAG_DEVELOPER
2223 private void PrintNutritionsData()
2224 {
2225 string nutritionsData = "";
2226
2229
2231 if (profile)
2232 {
2233 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2235 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2239 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2241
2244
2245 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2247 }
2248
2249 nutritionsData += "-----\n";
2250
2252 }
2253 #endif
2254
2256
2259 {
2261 }
2262}
2263
2265{
2267};
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 RemoveAllAgentsExcept(int agent_to_keep)
override void InsertAgent(int agent, float count=1)
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.
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
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
vector GetPosition()
Get the world position of the Effect.
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.