if no per FoodStage/Nutrition override is set, remove possible Food Poisoning to prevent double punishment from Bloody Hands
1225{
1227
1235
1245
1247
1249 {
1251 {
1253
1255 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1256
1260 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1261 }
1262 }
1263
1265 {
1267
1269 }
1270
1272 {
1273 super.EEDelete(parent);
1274
1276
1279 }
1280
1282 {
1283 super.EEItemLocationChanged(oldLoc, newLoc);
1284
1287 {
1288 switch (oldLoc.GetParent().GetType())
1289 {
1290 case "FryingPan":
1291 case "Pot":
1292 case "Cauldron":
1293 case "SharpWoodenStick":
1295 break;
1296 }
1297
1300 {
1302 }
1303 }
1304
1305 if (oldLoc.IsValid())
1307
1310 }
1311
1313 {
1316 }
1317
1319 {
1322
1323 return true;
1324 }
1325
1327 {
1329 {
1331 }
1332 }
1333
1336 {
1337 int foodStageType;
1338
1340 if (foodStage)
1341 foodStageType = foodStage.GetFoodStageType();
1342
1347
1348 return agentsIn;
1349 }
1350
1351
1353 {
1354 return false;
1355 }
1356
1358 {
1359 return false;
1360 }
1361
1363 {
1365 {
1367 {
1370
1373
1374 default:
1375 return super.GetTemperatureFreezeTime();
1376 }
1377 }
1378
1379 return super.GetTemperatureFreezeTime();
1380 }
1381
1383 {
1385 {
1387 {
1390
1393
1394 default:
1395 return super.GetTemperatureThawTime();
1396 }
1397 }
1398
1399 return super.GetTemperatureThawTime();
1400 }
1401
1403 {
1405 }
1406
1407
1408
1409
1411 {
1412 SetSynchDirty();
1413 }
1414
1416 {
1417 super.OnVariablesSynchronized();
1418
1419
1420
1421
1423 {
1425 }
1426 else
1427 {
1429 }
1430
1433 }
1434
1435
1436
1437
1439 {
1442
1444 }
1445
1447 {
1448 string soundName = "";
1449
1452
1454 {
1456 }
1457 else
1458 {
1460 {
1462 {
1467 else
1468 soundName = "";
1469 break;
1470 }
1471
1473 {
1478 else
1479 soundName = "";
1480 break;
1481 }
1482
1484 {
1489 else
1490 soundName = "";
1491 break;
1492 }
1493
1494 default:
1495 soundName = "";
1496 break;
1497 }
1498
1500 {
1501 if (soundName == "")
1502 {
1504 }
1505 else
1506 {
1508 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1509 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1511 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1512 {
1514 }
1515 }
1516 }
1517 }
1518
1520 }
1521
1523 {
1526 }
1527
1528
1529
1530
1532 {
1533 super.OnStoreSave(ctx);
1534
1536 {
1538 }
1539
1540
1543 }
1544
1546 {
1547 if (!super.OnStoreLoad(ctx, version))
1548 return false;
1549
1551 {
1553 return false;
1554 }
1555
1556 if (version >= 115)
1557 {
1559 {
1561 return false;
1562 }
1564 {
1566 return false;
1567 }
1568 }
1569
1572
1573 return true;
1574 }
1575
1577 {
1578 super.AfterStoreLoad();
1579
1581 }
1582
1583
1585 {
1587 }
1588
1589
1591 {
1592 return false;
1593 }
1594
1596 {
1597 return false;
1598 }
1599
1601 {
1602 return false;
1603 }
1604
1606 {
1607 return false;
1608 }
1609
1610
1611
1612
1613
1615 {
1618 {
1619 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1620 }
1621 else if (classname != "" && food_stage)
1622 {
1623 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1624 }
1625 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1626 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1627
1628 }
1629
1631 {
1634 {
1636 }
1637 else if (classname != "" && food_stage)
1638 {
1639 return FoodStage.GetEnergy(null, food_stage, classname);
1640 }
1641 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1642 return g_Game.ConfigGetFloat( class_path +
" energy" );
1643 }
1644
1646 {
1649 {
1651 }
1652 else if (classname != "" && food_stage)
1653 {
1654 return FoodStage.GetWater(null, food_stage, classname);
1655 }
1656 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1657 return g_Game.ConfigGetFloat( class_path +
" water" );
1658 }
1659
1661 {
1664 {
1665 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1666 }
1667 else if (classname != "" && food_stage)
1668 {
1669 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1670 }
1671 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1672 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1673
1674 }
1675
1677 {
1680 {
1681 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1682 }
1683 else if (classname != "" && food_stage)
1684 {
1685 return FoodStage.GetToxicity(null, food_stage, classname);
1686 }
1687 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1688 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1689 }
1690
1692 {
1695 {
1697 }
1698 else if (classname != "" && food_stage)
1699 {
1700 return FoodStage.GetAgents(null, food_stage, classname);
1701 }
1702 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1703 return g_Game.ConfigGetInt( class_path +
" agents" );
1704 }
1705
1707 {
1710 {
1711 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1712 }
1713 else if (classname != "" && food_stage)
1714 {
1715 return FoodStage.GetDigestibility(null, food_stage, classname);
1716 }
1717 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1718 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1719 }
1720
1722 {
1725 {
1726 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1727 }
1728 else if (className != "" && foodStage)
1729 {
1730 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1731 }
1732 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1733 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1734 }
1735
1737 {
1747
1748 return profile;
1749 }
1750
1751
1752
1753
1755 {
1757 }
1758
1759
1761 {
1763 {
1765 }
1766
1767 return false;
1768 }
1769
1771 {
1773 {
1775 }
1776
1777 return false;
1778 }
1779
1781 {
1783 {
1785 }
1786
1787 return false;
1788 }
1789
1791 {
1793 {
1795 }
1796
1797 return false;
1798 }
1799
1801 {
1803 {
1805 }
1806
1807 return false;
1808 }
1809
1811 {
1813 {
1815 }
1816
1817 return false;
1818 }
1819
1820
1822 {
1824 }
1825
1827 {
1828 return GetFoodStage().GetNextFoodStageType( cooking_method );
1829 }
1830
1832 {
1833 return GetFoodStage().GetFoodStageName( food_stage_type );
1834 }
1835
1837 {
1838 return GetFoodStage().CanChangeToNewStage( cooking_method );
1839 }
1840
1841
1843 {
1844 if ( !source.GetFoodStage())
1845 return;
1850 }
1851
1854 {
1857 }
1858
1861 {
1862 switch (stageNew)
1863 {
1868 break;
1869
1872 break;
1873 }
1874 }
1875
1876
1877
1878
1879
1881 {
1883 }
1884
1886 {
1888
1889
1891 }
1892
1894 {
1896 {
1899 }
1900 }
1901
1902
1904 {
1906 if (player)
1907 {
1909 player.ServerReplaceItemInHandsWithNew(lambda);
1910 }
1911 else
1912 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1913 }
1914
1916 {
1918 }
1919
1921 {
1922 super.SetActions();
1923
1926 }
1927
1929 {
1930 #ifndef SERVER
1931 #ifndef NO_GUI
1933 {
1935
1938 }
1939 #endif
1940 #endif
1941 }
1942
1944 {
1945 #ifndef SERVER
1946 #ifndef NO_GUI
1948 {
1952 }
1953 #endif
1954 #endif
1955 }
1956
1958 {
1959 return false;
1960 }
1961
1963 {
1965 }
1966
1967 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1968 {
1970
1971 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
1973 if ( hasRootAsPlayer )
1975
1976
1977
1978
1979
1980
1981
1983 {
1984
1986 {
1988 {
1992 break;
1993
1997 break;
1998
2002 break;
2003
2007 default:
2010 return;
2011 }
2012
2013
2014 }
2015
2017
2019 {
2021 {
2022
2024 {
2026 }
2028 {
2031 {
2033 }
2034 else
2035 {
2037 {
2039 }
2040 else
2041 {
2043 }
2044 }
2045 }
2046 }
2047 }
2048
2049 }
2051 {
2052
2054 {
2056 {
2060 break;
2061
2065 break;
2066
2070 break;
2071
2075 break;
2076
2079 default:
2082 return;
2083 }
2084 }
2085
2087
2089 {
2091 {
2092
2094 {
2096 }
2097 }
2098 }
2099 }
2101 {
2102
2104 {
2106 {
2110 break;
2111
2114 default:
2117 return;
2118 }
2119 }
2120
2122
2124 {
2126 {
2127
2129 {
2131 }
2132 }
2133 }
2134 }
2135 else
2136 {
2137
2139
2141 {
2144
2145 }
2146 else
2147 {
2149 {
2152 }
2153 }
2154 }
2155 }
2156
2158 {
2159 if (
g_Game.IsHeadlessOrDedicatedServer())
2160 return;
2161
2163 {
2165 GetInventory().GetCurrentInventoryLocation(invLoc);
2167 {
2169 if (ptcMgr)
2170 {
2175 }
2176 }
2177 }
2179 {
2181 {
2184 return;
2185 }
2186
2188 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2190 {
2193 }
2194 }
2195 }
2196
2197 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2198 {
2200 {
2205 }
2206
2207 super.GetDebugActions(outputList);
2208 }
2209
2211 {
2212 super.OnAction(action_id, player, ctx);
2213
2215 {
2216 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2217 {
2219 if (food_stage_prev <= 0)
2220 {
2222 }
2224 return true;
2225 }
2226 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2227 {
2230 {
2232 }
2234 return true;
2235 }
2236
2237 }
2238
2239 #ifdef DIAG_DEVELOPER
2240 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2241 {
2242 PrintNutritionsData();
2243 return true;
2244 }
2245 #endif
2246
2247 return false;
2248 }
2249
2251 {
2252 string debug_output;
2253
2254 debug_output = super.GetDebugText();
2255
2258
2259 return debug_output;
2260 }
2261
2262
2263
2264
2265
2267 {
2268 float ret = super.GetBaitEffectivity();
2269
2271 {
2272 ret *= 0.5;
2273 }
2274
2275 return ret;
2276 }
2277
2279 {
2281 }
2282
2284 {
2286 }
2287
2289 {
2291 }
2292
2293 #ifdef DIAG_DEVELOPER
2294 private void PrintNutritionsData()
2295 {
2296 string nutritionsData = "";
2297
2300
2302 if (profile)
2303 {
2304 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2306 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2310 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2312
2315
2316 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2318 }
2319
2320 nutritionsData += "-----\n";
2321
2323 }
2324 #endif
2325
2327
2330 {
2332 }
2333}
2334
2336{
2338};
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.