1211{
1213
1221
1231
1233
1235 {
1237 {
1239
1241 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1242
1246 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1247 }
1248 }
1249
1251 {
1253
1255 }
1256
1258 {
1259 super.EEDelete(parent);
1260
1262
1265 }
1266
1268 {
1269 super.EEItemLocationChanged(oldLoc, newLoc);
1270
1273 {
1274 switch (oldLoc.GetParent().GetType())
1275 {
1276 case "FryingPan":
1277 case "Pot":
1278 case "Cauldron":
1279 case "SharpWoodenStick":
1281 break;
1282 }
1283
1286 {
1288 }
1289 }
1290
1291 if (oldLoc.IsValid())
1293
1296 }
1297
1299 {
1302 }
1303
1305 {
1308
1309 return true;
1310 }
1311
1313 {
1315 {
1317 }
1318 }
1319
1322 {
1323 int foodStageType;
1324
1326 if (foodStage)
1327 foodStageType = foodStage.GetFoodStageType();
1328
1333
1334 return agentsIn;
1335 }
1336
1337
1339 {
1340 return false;
1341 }
1342
1344 {
1345 return false;
1346 }
1347
1349 {
1351 {
1353 {
1356
1359
1360 default:
1361 return super.GetTemperatureFreezeTime();
1362 }
1363 }
1364
1365 return super.GetTemperatureFreezeTime();
1366 }
1367
1369 {
1371 {
1373 {
1376
1379
1380 default:
1381 return super.GetTemperatureThawTime();
1382 }
1383 }
1384
1385 return super.GetTemperatureThawTime();
1386 }
1387
1389 {
1391 }
1392
1393
1394
1395
1397 {
1398 SetSynchDirty();
1399 }
1400
1402 {
1403 super.OnVariablesSynchronized();
1404
1405
1406
1407
1409 {
1411 }
1412 else
1413 {
1415 }
1416
1419 }
1420
1421
1422
1423
1425 {
1428
1430 }
1431
1433 {
1434 string soundName = "";
1435
1438
1440 {
1442 }
1443 else
1444 {
1446 {
1448 {
1453 else
1454 soundName = "";
1455 break;
1456 }
1457
1459 {
1464 else
1465 soundName = "";
1466 break;
1467 }
1468
1470 {
1475 else
1476 soundName = "";
1477 break;
1478 }
1479
1480 default:
1481 soundName = "";
1482 break;
1483 }
1484
1486 {
1487 if (soundName == "")
1488 {
1490 }
1491 else
1492 {
1494 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1495 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1497 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1498 {
1500 }
1501 }
1502 }
1503 }
1504
1506 }
1507
1509 {
1512 }
1513
1514
1515
1516
1518 {
1519 super.OnStoreSave(ctx);
1520
1522 {
1524 }
1525
1526
1529 }
1530
1532 {
1533 if (!super.OnStoreLoad(ctx, version))
1534 return false;
1535
1537 {
1539 return false;
1540 }
1541
1542 if (version >= 115)
1543 {
1545 {
1547 return false;
1548 }
1550 {
1552 return false;
1553 }
1554 }
1555
1558
1559 return true;
1560 }
1561
1563 {
1564 super.AfterStoreLoad();
1565
1567 }
1568
1569
1571 {
1573 }
1574
1575
1577 {
1578 return false;
1579 }
1580
1582 {
1583 return false;
1584 }
1585
1587 {
1588 return false;
1589 }
1590
1592 {
1593 return false;
1594 }
1595
1596
1597
1598
1599
1601 {
1604 {
1605 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1606 }
1607 else if (classname != "" && food_stage)
1608 {
1609 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1610 }
1611 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1613
1614 }
1615
1617 {
1620 {
1622 }
1623 else if (classname != "" && food_stage)
1624 {
1625 return FoodStage.GetEnergy(null, food_stage, classname);
1626 }
1627 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1629 }
1630
1632 {
1635 {
1637 }
1638 else if (classname != "" && food_stage)
1639 {
1640 return FoodStage.GetWater(null, food_stage, classname);
1641 }
1642 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1644 }
1645
1647 {
1650 {
1651 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1652 }
1653 else if (classname != "" && food_stage)
1654 {
1655 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1656 }
1657 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1659
1660 }
1661
1663 {
1666 {
1667 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1668 }
1669 else if (classname != "" && food_stage)
1670 {
1671 return FoodStage.GetToxicity(null, food_stage, classname);
1672 }
1673 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1675 }
1676
1678 {
1681 {
1683 }
1684 else if (classname != "" && food_stage)
1685 {
1686 return FoodStage.GetAgents(null, food_stage, classname);
1687 }
1688 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1690 }
1691
1693 {
1696 {
1697 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1698 }
1699 else if (classname != "" && food_stage)
1700 {
1701 return FoodStage.GetDigestibility(null, food_stage, classname);
1702 }
1703 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1705 }
1706
1708 {
1711 {
1712 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1713 }
1714 else if (className != "" && foodStage)
1715 {
1716 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1717 }
1718 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1720 }
1721
1723 {
1733
1734 return profile;
1735 }
1736
1737
1738
1739
1741 {
1743 }
1744
1745
1747 {
1749 {
1751 }
1752
1753 return false;
1754 }
1755
1757 {
1759 {
1761 }
1762
1763 return false;
1764 }
1765
1767 {
1769 {
1771 }
1772
1773 return false;
1774 }
1775
1777 {
1779 {
1781 }
1782
1783 return false;
1784 }
1785
1787 {
1789 {
1791 }
1792
1793 return false;
1794 }
1795
1797 {
1799 {
1801 }
1802
1803 return false;
1804 }
1805
1806
1808 {
1810 }
1811
1813 {
1814 return GetFoodStage().GetNextFoodStageType( cooking_method );
1815 }
1816
1818 {
1819 return GetFoodStage().GetFoodStageName( food_stage_type );
1820 }
1821
1823 {
1824 return GetFoodStage().CanChangeToNewStage( cooking_method );
1825 }
1826
1827
1829 {
1830 if ( !source.GetFoodStage())
1831 return;
1836 }
1837
1840 {
1843 }
1844
1847 {
1848 switch (stageNew)
1849 {
1854 break;
1855
1858 break;
1859 }
1860 }
1861
1862
1863
1864
1865
1867 {
1869 }
1870
1872 {
1874
1875
1877 }
1878
1880 {
1882 {
1885 }
1886 }
1887
1888
1890 {
1892 if (player)
1893 {
1895 player.ServerReplaceItemInHandsWithNew(lambda);
1896 }
1897 else
1898 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1899 }
1900
1902 {
1904 }
1905
1907 {
1908 super.SetActions();
1909
1912 }
1913
1915 {
1916 #ifndef SERVER
1918 {
1920
1923 }
1924 #endif
1925 }
1926
1928 {
1929 #ifndef SERVER
1931 {
1935 }
1936 #endif
1937 }
1938
1940 {
1941 return false;
1942 }
1943
1945 {
1947 }
1948
1949 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1950 {
1952
1953 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
1955 if ( hasRootAsPlayer )
1957
1958
1959
1960
1961
1962
1963
1965 {
1966
1968 {
1970 {
1974 break;
1975
1979 break;
1980
1984 break;
1985
1989 default:
1992 return;
1993 }
1994
1995
1996 }
1997
1999
2001 {
2003 {
2004
2006 {
2008 }
2010 {
2013 {
2015 }
2016 else
2017 {
2019 {
2021 }
2022 else
2023 {
2025 }
2026 }
2027 }
2028 }
2029 }
2030
2031 }
2033 {
2034
2036 {
2038 {
2042 break;
2043
2047 break;
2048
2052 break;
2053
2057 break;
2058
2061 default:
2064 return;
2065 }
2066 }
2067
2069
2071 {
2073 {
2074
2076 {
2078 }
2079 }
2080 }
2081 }
2083 {
2084
2086 {
2088 {
2092 break;
2093
2096 default:
2099 return;
2100 }
2101 }
2102
2104
2106 {
2108 {
2109
2111 {
2113 }
2114 }
2115 }
2116 }
2117 else
2118 {
2119
2121
2123 {
2126
2127 }
2128 else
2129 {
2131 {
2134 }
2135 }
2136 }
2137 }
2138
2140 {
2141 if (
GetGame().IsDedicatedServer())
2142 return;
2143
2145 {
2147 GetInventory().GetCurrentInventoryLocation(invLoc);
2149 {
2151 if (ptcMgr)
2152 {
2157 }
2158 }
2159 }
2161 {
2163 {
2166 return;
2167 }
2168
2170 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2172 {
2175 }
2176 }
2177 }
2178
2179 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2180 {
2181 super.GetDebugActions(outputList);
2182
2184 {
2188 }
2189 }
2190
2192 {
2193 super.OnAction(action_id, player, ctx);
2194
2196 {
2197 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2198 {
2200 if (food_stage_prev <= 0)
2201 {
2203 }
2205 return true;
2206 }
2207 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2208 {
2211 {
2213 }
2215 return true;
2216 }
2217
2218 }
2219
2220 #ifdef DIAG_DEVELOPER
2221 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2222 {
2223 PrintNutritionsData();
2224 return true;
2225 }
2226 #endif
2227
2228 return false;
2229 }
2230
2232 {
2233 string debug_output;
2234
2235 debug_output = super.GetDebugText();
2236
2239
2240 return debug_output;
2241 }
2242
2243
2244
2245
2246
2248 {
2249 float ret = super.GetBaitEffectivity();
2250
2252 {
2253 ret *= 0.5;
2254 }
2255
2256 return ret;
2257 }
2258
2260 {
2262 }
2263
2265 {
2267 }
2268
2270 {
2272 }
2273
2274 #ifdef DIAG_DEVELOPER
2275 private void PrintNutritionsData()
2276 {
2277 string nutritionsData = "";
2278
2281
2283 if (profile)
2284 {
2285 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2287 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2291 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2293
2296
2297 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2299 }
2300
2301 nutritionsData += "-----\n";
2302
2304 }
2305 #endif
2306
2308
2311 {
2313 }
2314}
2315
2317{
2319};
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.