1212{
1214
1222
1232
1234
1236 {
1238 {
1240
1242 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1243
1247 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1248 }
1249 }
1250
1252 {
1254
1256 }
1257
1259 {
1260 super.EEDelete(parent);
1261
1263
1266 }
1267
1269 {
1270 super.EEItemLocationChanged(oldLoc, newLoc);
1271
1274 {
1275 switch (oldLoc.GetParent().GetType())
1276 {
1277 case "FryingPan":
1278 case "Pot":
1279 case "Cauldron":
1280 case "SharpWoodenStick":
1282 break;
1283 }
1284
1287 {
1289 }
1290 }
1291
1292 if (oldLoc.IsValid())
1294
1297 }
1298
1300 {
1303 }
1304
1306 {
1309
1310 return true;
1311 }
1312
1314 {
1316 {
1318 }
1319 }
1320
1323 {
1324 int foodStageType;
1325
1327 if (foodStage)
1328 foodStageType = foodStage.GetFoodStageType();
1329
1334
1335 return agentsIn;
1336 }
1337
1338
1340 {
1341 return false;
1342 }
1343
1345 {
1346 return false;
1347 }
1348
1350 {
1352 {
1354 {
1357
1360
1361 default:
1362 return super.GetTemperatureFreezeTime();
1363 }
1364 }
1365
1366 return super.GetTemperatureFreezeTime();
1367 }
1368
1370 {
1372 {
1374 {
1377
1380
1381 default:
1382 return super.GetTemperatureThawTime();
1383 }
1384 }
1385
1386 return super.GetTemperatureThawTime();
1387 }
1388
1390 {
1392 }
1393
1394
1395
1396
1398 {
1399 SetSynchDirty();
1400 }
1401
1403 {
1404 super.OnVariablesSynchronized();
1405
1406
1407
1408
1410 {
1412 }
1413 else
1414 {
1416 }
1417
1420 }
1421
1422
1423
1424
1426 {
1429
1431 }
1432
1434 {
1435 string soundName = "";
1436
1439
1441 {
1443 }
1444 else
1445 {
1447 {
1449 {
1454 else
1455 soundName = "";
1456 break;
1457 }
1458
1460 {
1465 else
1466 soundName = "";
1467 break;
1468 }
1469
1471 {
1476 else
1477 soundName = "";
1478 break;
1479 }
1480
1481 default:
1482 soundName = "";
1483 break;
1484 }
1485
1487 {
1488 if (soundName == "")
1489 {
1491 }
1492 else
1493 {
1495 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1496 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1498 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1499 {
1501 }
1502 }
1503 }
1504 }
1505
1507 }
1508
1510 {
1513 }
1514
1515
1516
1517
1519 {
1520 super.OnStoreSave(ctx);
1521
1523 {
1525 }
1526
1527
1530 }
1531
1533 {
1534 if (!super.OnStoreLoad(ctx, version))
1535 return false;
1536
1538 {
1540 return false;
1541 }
1542
1543 if (version >= 115)
1544 {
1546 {
1548 return false;
1549 }
1551 {
1553 return false;
1554 }
1555 }
1556
1559
1560 return true;
1561 }
1562
1564 {
1565 super.AfterStoreLoad();
1566
1568 }
1569
1570
1572 {
1574 }
1575
1576
1578 {
1579 return false;
1580 }
1581
1583 {
1584 return false;
1585 }
1586
1588 {
1589 return false;
1590 }
1591
1593 {
1594 return false;
1595 }
1596
1597
1598
1599
1600
1602 {
1605 {
1606 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1607 }
1608 else if (classname != "" && food_stage)
1609 {
1610 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1611 }
1612 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1614
1615 }
1616
1618 {
1621 {
1623 }
1624 else if (classname != "" && food_stage)
1625 {
1626 return FoodStage.GetEnergy(null, food_stage, classname);
1627 }
1628 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1630 }
1631
1633 {
1636 {
1638 }
1639 else if (classname != "" && food_stage)
1640 {
1641 return FoodStage.GetWater(null, food_stage, classname);
1642 }
1643 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1645 }
1646
1648 {
1651 {
1652 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1653 }
1654 else if (classname != "" && food_stage)
1655 {
1656 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1657 }
1658 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1660
1661 }
1662
1664 {
1667 {
1668 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1669 }
1670 else if (classname != "" && food_stage)
1671 {
1672 return FoodStage.GetToxicity(null, food_stage, classname);
1673 }
1674 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1676 }
1677
1679 {
1682 {
1684 }
1685 else if (classname != "" && food_stage)
1686 {
1687 return FoodStage.GetAgents(null, food_stage, classname);
1688 }
1689 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1691 }
1692
1694 {
1697 {
1698 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1699 }
1700 else if (classname != "" && food_stage)
1701 {
1702 return FoodStage.GetDigestibility(null, food_stage, classname);
1703 }
1704 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1706 }
1707
1709 {
1712 {
1713 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1714 }
1715 else if (className != "" && foodStage)
1716 {
1717 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1718 }
1719 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1721 }
1722
1724 {
1734
1735 return profile;
1736 }
1737
1738
1739
1740
1742 {
1744 }
1745
1746
1748 {
1750 {
1752 }
1753
1754 return false;
1755 }
1756
1758 {
1760 {
1762 }
1763
1764 return false;
1765 }
1766
1768 {
1770 {
1772 }
1773
1774 return false;
1775 }
1776
1778 {
1780 {
1782 }
1783
1784 return false;
1785 }
1786
1788 {
1790 {
1792 }
1793
1794 return false;
1795 }
1796
1798 {
1800 {
1802 }
1803
1804 return false;
1805 }
1806
1807
1809 {
1811 }
1812
1814 {
1815 return GetFoodStage().GetNextFoodStageType( cooking_method );
1816 }
1817
1819 {
1820 return GetFoodStage().GetFoodStageName( food_stage_type );
1821 }
1822
1824 {
1825 return GetFoodStage().CanChangeToNewStage( cooking_method );
1826 }
1827
1828
1830 {
1831 if ( !source.GetFoodStage())
1832 return;
1837 }
1838
1841 {
1844 }
1845
1848 {
1849 switch (stageNew)
1850 {
1855 break;
1856
1859 break;
1860 }
1861 }
1862
1863
1864
1865
1866
1868 {
1870 }
1871
1873 {
1875
1876
1878 }
1879
1881 {
1883 {
1886 }
1887 }
1888
1889
1891 {
1893 if (player)
1894 {
1896 player.ServerReplaceItemInHandsWithNew(lambda);
1897 }
1898 else
1899 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1900 }
1901
1903 {
1905 }
1906
1908 {
1909 super.SetActions();
1910
1913 }
1914
1916 {
1917 #ifndef SERVER
1919 {
1921
1924 }
1925 #endif
1926 }
1927
1929 {
1930 #ifndef SERVER
1932 {
1936 }
1937 #endif
1938 }
1939
1941 {
1942 return false;
1943 }
1944
1946 {
1948 }
1949
1950 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1951 {
1953
1954 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
1956 if ( hasRootAsPlayer )
1958
1959
1960
1961
1962
1963
1964
1966 {
1967
1969 {
1971 {
1975 break;
1976
1980 break;
1981
1985 break;
1986
1990 default:
1993 return;
1994 }
1995
1996
1997 }
1998
2000
2002 {
2004 {
2005
2007 {
2009 }
2011 {
2014 {
2016 }
2017 else
2018 {
2020 {
2022 }
2023 else
2024 {
2026 }
2027 }
2028 }
2029 }
2030 }
2031
2032 }
2034 {
2035
2037 {
2039 {
2043 break;
2044
2048 break;
2049
2053 break;
2054
2058 break;
2059
2062 default:
2065 return;
2066 }
2067 }
2068
2070
2072 {
2074 {
2075
2077 {
2079 }
2080 }
2081 }
2082 }
2084 {
2085
2087 {
2089 {
2093 break;
2094
2097 default:
2100 return;
2101 }
2102 }
2103
2105
2107 {
2109 {
2110
2112 {
2114 }
2115 }
2116 }
2117 }
2118 else
2119 {
2120
2122
2124 {
2127
2128 }
2129 else
2130 {
2132 {
2135 }
2136 }
2137 }
2138 }
2139
2141 {
2142 if (
GetGame().IsDedicatedServer())
2143 return;
2144
2146 {
2148 GetInventory().GetCurrentInventoryLocation(invLoc);
2150 {
2152 if (ptcMgr)
2153 {
2158 }
2159 }
2160 }
2162 {
2164 {
2167 return;
2168 }
2169
2171 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2173 {
2176 }
2177 }
2178 }
2179
2180 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2181 {
2183 {
2188 }
2189
2190 super.GetDebugActions(outputList);
2191 }
2192
2194 {
2195 super.OnAction(action_id, player, ctx);
2196
2198 {
2199 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2200 {
2202 if (food_stage_prev <= 0)
2203 {
2205 }
2207 return true;
2208 }
2209 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2210 {
2213 {
2215 }
2217 return true;
2218 }
2219
2220 }
2221
2222 #ifdef DIAG_DEVELOPER
2223 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2224 {
2225 PrintNutritionsData();
2226 return true;
2227 }
2228 #endif
2229
2230 return false;
2231 }
2232
2234 {
2235 string debug_output;
2236
2237 debug_output = super.GetDebugText();
2238
2241
2242 return debug_output;
2243 }
2244
2245
2246
2247
2248
2250 {
2251 float ret = super.GetBaitEffectivity();
2252
2254 {
2255 ret *= 0.5;
2256 }
2257
2258 return ret;
2259 }
2260
2262 {
2264 }
2265
2267 {
2269 }
2270
2272 {
2274 }
2275
2276 #ifdef DIAG_DEVELOPER
2277 private void PrintNutritionsData()
2278 {
2279 string nutritionsData = "";
2280
2283
2285 if (profile)
2286 {
2287 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2289 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2293 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2295
2298
2299 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2301 }
2302
2303 nutritionsData += "-----\n";
2304
2306 }
2307 #endif
2308
2310
2313 {
2315 }
2316}
2317
2319{
2321};
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 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.