1237{
1239
1247
1257
1259
1261 {
1263 {
1265
1267 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1268
1272 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1273 }
1274 }
1275
1277 {
1279
1281 }
1282
1284 {
1285 super.EEDelete(parent);
1286
1288
1291 }
1292
1294 {
1295 super.EEItemLocationChanged(oldLoc, newLoc);
1296
1299 {
1300 switch (oldLoc.GetParent().GetType())
1301 {
1302 case "FryingPan":
1303 case "Pot":
1304 case "Cauldron":
1305 case "SharpWoodenStick":
1307 break;
1308 }
1309
1312 {
1314 }
1315 }
1316
1317 if (oldLoc.IsValid())
1319
1322 }
1323
1325 {
1328 }
1329
1331 {
1334
1335 return true;
1336 }
1337
1339 {
1341 {
1343 }
1344 }
1345
1348 {
1349 int foodStageType;
1350
1352 if (foodStage)
1353 foodStageType = foodStage.GetFoodStageType();
1354
1359
1360 return agentsIn;
1361 }
1362
1363
1365 {
1366 return false;
1367 }
1368
1370 {
1371 return false;
1372 }
1373
1375 {
1377 {
1379 {
1382
1385
1386 default:
1387 return super.GetTemperatureFreezeTime();
1388 }
1389 }
1390
1391 return super.GetTemperatureFreezeTime();
1392 }
1393
1395 {
1397 {
1399 {
1402
1405
1406 default:
1407 return super.GetTemperatureThawTime();
1408 }
1409 }
1410
1411 return super.GetTemperatureThawTime();
1412 }
1413
1415 {
1417 }
1418
1419
1420
1421
1423 {
1424 SetSynchDirty();
1425 }
1426
1428 {
1429 super.OnVariablesSynchronized();
1430
1431
1432
1433
1435 {
1437 }
1438 else
1439 {
1441 }
1442
1445 }
1446
1447
1448
1449
1451 {
1454
1456 }
1457
1459 {
1460 string soundName = "";
1461
1464
1466 {
1468 }
1469 else
1470 {
1472 {
1474 {
1479 else
1480 soundName = "";
1481 break;
1482 }
1483
1485 {
1490 else
1491 soundName = "";
1492 break;
1493 }
1494
1496 {
1501 else
1502 soundName = "";
1503 break;
1504 }
1505
1506 default:
1507 soundName = "";
1508 break;
1509 }
1510
1512 {
1513 if (soundName == "")
1514 {
1516 }
1517 else
1518 {
1520 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1521 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1523 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1524 {
1526 }
1527 }
1528 }
1529 }
1530
1532 }
1533
1535 {
1538 }
1539
1540
1541
1542
1544 {
1545 super.OnStoreSave(ctx);
1546
1548 {
1550 }
1551
1552
1555 }
1556
1558 {
1559 if (!super.OnStoreLoad(ctx, version))
1560 return false;
1561
1563 {
1565 return false;
1566 }
1567
1568 if (version >= 115)
1569 {
1571 {
1573 return false;
1574 }
1576 {
1578 return false;
1579 }
1580 }
1581
1584
1585 return true;
1586 }
1587
1589 {
1590 super.AfterStoreLoad();
1591
1593 }
1594
1595
1597 {
1599 }
1600
1601
1603 {
1604 return false;
1605 }
1606
1608 {
1609 return false;
1610 }
1611
1613 {
1614 return false;
1615 }
1616
1618 {
1619 return false;
1620 }
1621
1622
1623
1624
1625
1627 {
1630 {
1631 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1632 }
1633 else if (classname != "" && food_stage)
1634 {
1635 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1636 }
1637 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1639
1640 }
1641
1643 {
1646 {
1648 }
1649 else if (classname != "" && food_stage)
1650 {
1651 return FoodStage.GetEnergy(null, food_stage, classname);
1652 }
1653 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1655 }
1656
1658 {
1661 {
1663 }
1664 else if (classname != "" && food_stage)
1665 {
1666 return FoodStage.GetWater(null, food_stage, classname);
1667 }
1668 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1670 }
1671
1673 {
1676 {
1677 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1678 }
1679 else if (classname != "" && food_stage)
1680 {
1681 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1682 }
1683 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1685
1686 }
1687
1689 {
1692 {
1693 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1694 }
1695 else if (classname != "" && food_stage)
1696 {
1697 return FoodStage.GetToxicity(null, food_stage, classname);
1698 }
1699 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1701 }
1702
1704 {
1707 {
1709 }
1710 else if (classname != "" && food_stage)
1711 {
1712 return FoodStage.GetAgents(null, food_stage, classname);
1713 }
1714 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1716 }
1717
1719 {
1722 {
1723 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1724 }
1725 else if (classname != "" && food_stage)
1726 {
1727 return FoodStage.GetDigestibility(null, food_stage, classname);
1728 }
1729 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1731 }
1732
1734 {
1737 {
1738 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1739 }
1740 else if (className != "" && foodStage)
1741 {
1742 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1743 }
1744 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1746 }
1747
1749 {
1759
1760 return profile;
1761 }
1762
1763
1764
1765
1767 {
1769 }
1770
1771
1773 {
1775 {
1777 }
1778
1779 return false;
1780 }
1781
1783 {
1785 {
1787 }
1788
1789 return false;
1790 }
1791
1793 {
1795 {
1797 }
1798
1799 return false;
1800 }
1801
1803 {
1805 {
1807 }
1808
1809 return false;
1810 }
1811
1813 {
1815 {
1817 }
1818
1819 return false;
1820 }
1821
1823 {
1825 {
1827 }
1828
1829 return false;
1830 }
1831
1832
1834 {
1836 }
1837
1839 {
1840 return GetFoodStage().GetNextFoodStageType( cooking_method );
1841 }
1842
1844 {
1845 return GetFoodStage().GetFoodStageName( food_stage_type );
1846 }
1847
1849 {
1850 return GetFoodStage().CanChangeToNewStage( cooking_method );
1851 }
1852
1853
1855 {
1856 if ( !source.GetFoodStage())
1857 return;
1862 }
1863
1866 {
1869 }
1870
1873 {
1874 switch (stageNew)
1875 {
1880 break;
1881
1884 break;
1885 }
1886 }
1887
1888
1889
1890
1891
1893 {
1895 }
1896
1898 {
1900
1901
1903 }
1904
1906 {
1908 {
1911 }
1912 }
1913
1914
1916 {
1918 if (player)
1919 {
1921 player.ServerReplaceItemInHandsWithNew(lambda);
1922 }
1923 else
1924 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1925 }
1926
1928 {
1930 }
1931
1933 {
1934 super.SetActions();
1935
1938 }
1939
1941 {
1942 #ifndef SERVER
1944 {
1946
1949 }
1950 #endif
1951 }
1952
1954 {
1955 #ifndef SERVER
1957 {
1961 }
1962 #endif
1963 }
1964
1966 {
1967 return false;
1968 }
1969
1971 {
1973 }
1974
1975 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1976 {
1978
1979 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
1981 if ( hasRootAsPlayer )
1983
1984
1985
1986
1987
1988
1989
1991 {
1992
1994 {
1996 {
2000 break;
2001
2005 break;
2006
2010 break;
2011
2015 default:
2018 return;
2019 }
2020
2021
2022 }
2023
2025
2027 {
2029 {
2030
2032 {
2034 }
2036 {
2039 {
2041 }
2042 else
2043 {
2045 {
2047 }
2048 else
2049 {
2051 }
2052 }
2053 }
2054 }
2055 }
2056
2057 }
2059 {
2060
2062 {
2064 {
2068 break;
2069
2073 break;
2074
2078 break;
2079
2083 break;
2084
2087 default:
2090 return;
2091 }
2092 }
2093
2095
2097 {
2099 {
2100
2102 {
2104 }
2105 }
2106 }
2107 }
2109 {
2110
2112 {
2114 {
2118 break;
2119
2122 default:
2125 return;
2126 }
2127 }
2128
2130
2132 {
2134 {
2135
2137 {
2139 }
2140 }
2141 }
2142 }
2143 else
2144 {
2145
2147
2149 {
2152
2153 }
2154 else
2155 {
2157 {
2160 }
2161 }
2162 }
2163 }
2164
2166 {
2167 if (
GetGame().IsDedicatedServer())
2168 return;
2169
2171 {
2173 GetInventory().GetCurrentInventoryLocation(invLoc);
2175 {
2177 if (ptcMgr)
2178 {
2183 }
2184 }
2185 }
2187 {
2189 {
2192 return;
2193 }
2194
2196 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2198 {
2201 }
2202 }
2203 }
2204
2205 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2206 {
2207 super.GetDebugActions(outputList);
2208
2210 {
2214 }
2215 }
2216
2218 {
2219 super.OnAction(action_id, player, ctx);
2220
2222 {
2223 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2224 {
2226 if (food_stage_prev <= 0)
2227 {
2229 }
2231 return true;
2232 }
2233 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2234 {
2237 {
2239 }
2241 return true;
2242 }
2243
2244 }
2245
2246 #ifdef DIAG_DEVELOPER
2247 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2248 {
2249 PrintNutritionsData();
2250 return true;
2251 }
2252 #endif
2253
2254 return false;
2255 }
2256
2258 {
2259 string debug_output;
2260
2261 debug_output = super.GetDebugText();
2262
2265
2266 return debug_output;
2267 }
2268
2269
2270
2271
2272
2274 {
2275 float ret = super.GetBaitEffectivity();
2276
2278 {
2279 ret *= 0.5;
2280 }
2281
2282 return ret;
2283 }
2284
2286 {
2288 }
2289
2291 {
2293 }
2294
2296 {
2298 }
2299
2300 #ifdef DIAG_DEVELOPER
2301 private void PrintNutritionsData()
2302 {
2303 string nutritionsData = "";
2304
2307
2309 if (profile)
2310 {
2311 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2313 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2317 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2319
2322
2323 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2325 }
2326
2327 nutritionsData += "-----\n";
2328
2330 }
2331 #endif
2332
2334
2337 {
2339 }
2340}
2341
2343{
2345};
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.