1149{
1151
1159
1169
1171
1173 {
1175 {
1177
1179 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1180
1184 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1185 }
1186 }
1187
1189 {
1191
1193 }
1194
1196 {
1197 super.EEDelete(parent);
1198
1200
1203 }
1204
1206 {
1207 super.EEItemLocationChanged(oldLoc, newLoc);
1208
1211 {
1212 switch (oldLoc.GetParent().GetType())
1213 {
1214 case "FryingPan":
1215 case "Pot":
1216 case "Cauldron":
1217 case "SharpWoodenStick":
1219 break;
1220 }
1221
1224 {
1226 }
1227 }
1228
1229 if (oldLoc.IsValid())
1231
1234 }
1235
1237 {
1240 }
1241
1243 {
1246
1247 return true;
1248 }
1249
1251 {
1253 {
1255 }
1256 }
1257
1260 {
1261 int foodStageType;
1262
1264 if (foodStage)
1265 foodStageType = foodStage.GetFoodStageType();
1266
1271
1272 return agentsIn;
1273 }
1274
1275
1277 {
1278 return false;
1279 }
1280
1282 {
1283 return false;
1284 }
1285
1287 {
1289 {
1291 {
1294
1297
1298 default:
1299 return super.GetTemperatureFreezeTime();
1300 }
1301 }
1302
1303 return super.GetTemperatureFreezeTime();
1304 }
1305
1307 {
1309 {
1311 {
1314
1317
1318 default:
1319 return super.GetTemperatureThawTime();
1320 }
1321 }
1322
1323 return super.GetTemperatureThawTime();
1324 }
1325
1327 {
1329 }
1330
1331
1332
1333
1335 {
1336 SetSynchDirty();
1337 }
1338
1340 {
1341 super.OnVariablesSynchronized();
1342
1343
1344
1345
1347 {
1349 }
1350 else
1351 {
1353 }
1354
1357 }
1358
1359
1360
1361
1363 {
1366
1368 }
1369
1371 {
1372 string soundName = "";
1373
1376
1378 {
1380 }
1381 else
1382 {
1384 {
1386 {
1391 else
1392 soundName = "";
1393 break;
1394 }
1395
1397 {
1402 else
1403 soundName = "";
1404 break;
1405 }
1406
1408 {
1413 else
1414 soundName = "";
1415 break;
1416 }
1417
1418 default:
1419 soundName = "";
1420 break;
1421 }
1422
1424 {
1425 if (soundName == "")
1426 {
1428 }
1429 else
1430 {
1432 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1433 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1435 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1436 {
1438 }
1439 }
1440 }
1441 }
1442
1444 }
1445
1447 {
1450 }
1451
1452
1453
1454
1456 {
1457 super.OnStoreSave(ctx);
1458
1460 {
1462 }
1463
1464
1467 }
1468
1470 {
1471 if (!super.OnStoreLoad(ctx, version))
1472 return false;
1473
1475 {
1477 return false;
1478 }
1479
1480 if (version >= 115)
1481 {
1483 {
1485 return false;
1486 }
1488 {
1490 return false;
1491 }
1492 }
1493
1496
1497 return true;
1498 }
1499
1501 {
1502 super.AfterStoreLoad();
1503
1505 }
1506
1507
1509 {
1511 }
1512
1513
1515 {
1516 return false;
1517 }
1518
1520 {
1521 return false;
1522 }
1523
1525 {
1526 return false;
1527 }
1528
1530 {
1531 return false;
1532 }
1533
1534
1535
1536
1537
1539 {
1542 {
1543 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1544 }
1545 else if (classname != "" && food_stage)
1546 {
1547 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1548 }
1549 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1551
1552 }
1553
1555 {
1558 {
1560 }
1561 else if (classname != "" && food_stage)
1562 {
1563 return FoodStage.GetEnergy(null, food_stage, classname);
1564 }
1565 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1567 }
1568
1570 {
1573 {
1575 }
1576 else if (classname != "" && food_stage)
1577 {
1578 return FoodStage.GetWater(null, food_stage, classname);
1579 }
1580 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1582 }
1583
1585 {
1588 {
1589 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1590 }
1591 else if (classname != "" && food_stage)
1592 {
1593 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1594 }
1595 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1597
1598 }
1599
1601 {
1604 {
1605 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1606 }
1607 else if (classname != "" && food_stage)
1608 {
1609 return FoodStage.GetToxicity(null, food_stage, classname);
1610 }
1611 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1613 }
1614
1616 {
1619 {
1621 }
1622 else if (classname != "" && food_stage)
1623 {
1624 return FoodStage.GetAgents(null, food_stage, classname);
1625 }
1626 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1628 }
1629
1631 {
1634 {
1635 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1636 }
1637 else if (classname != "" && food_stage)
1638 {
1639 return FoodStage.GetDigestibility(null, food_stage, classname);
1640 }
1641 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1643 }
1644
1646 {
1649 {
1650 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1651 }
1652 else if (className != "" && foodStage)
1653 {
1654 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1655 }
1656 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1658 }
1659
1661 {
1671
1672 return profile;
1673 }
1674
1675
1676
1677
1679 {
1681 }
1682
1683
1685 {
1687 {
1689 }
1690
1691 return false;
1692 }
1693
1695 {
1697 {
1699 }
1700
1701 return false;
1702 }
1703
1705 {
1707 {
1709 }
1710
1711 return false;
1712 }
1713
1715 {
1717 {
1719 }
1720
1721 return false;
1722 }
1723
1725 {
1727 {
1729 }
1730
1731 return false;
1732 }
1733
1735 {
1737 {
1739 }
1740
1741 return false;
1742 }
1743
1744
1746 {
1748 }
1749
1751 {
1752 return GetFoodStage().GetNextFoodStageType( cooking_method );
1753 }
1754
1756 {
1757 return GetFoodStage().GetFoodStageName( food_stage_type );
1758 }
1759
1761 {
1762 return GetFoodStage().CanChangeToNewStage( cooking_method );
1763 }
1764
1765
1767 {
1768 if ( !source.GetFoodStage())
1769 return;
1774 }
1775
1778 {
1781 }
1782
1785 {
1786 switch (stageNew)
1787 {
1792 break;
1793
1796 break;
1797 }
1798 }
1799
1800
1801
1802
1803
1805 {
1807 }
1808
1810 {
1812
1813
1815 }
1816
1818 {
1820 {
1823 }
1824 }
1825
1826
1828 {
1830 if (player)
1831 {
1833 player.ServerReplaceItemInHandsWithNew(lambda);
1834 }
1835 else
1836 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1837 }
1838
1840 {
1842 }
1843
1845 {
1846 super.SetActions();
1847
1850 }
1851
1853 {
1854 #ifndef SERVER
1856 {
1858
1861 }
1862 #endif
1863 }
1864
1866 {
1867 #ifndef SERVER
1869 {
1873 }
1874 #endif
1875 }
1876
1878 {
1879 return false;
1880 }
1881
1883 {
1885 }
1886
1887 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1888 {
1890
1891 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
1893 if ( hasRootAsPlayer )
1895
1896
1897
1898
1899
1900
1901
1903 {
1904
1906 {
1908 {
1912 break;
1913
1917 break;
1918
1922 break;
1923
1927 default:
1930 return;
1931 }
1932
1933
1934 }
1935
1937
1939 {
1941 {
1942
1944 {
1946 }
1948 {
1951 {
1953 }
1954 else
1955 {
1957 {
1959 }
1960 else
1961 {
1963 }
1964 }
1965 }
1966 }
1967 }
1968
1969 }
1971 {
1972
1974 {
1976 {
1980 break;
1981
1985 break;
1986
1990 break;
1991
1995 break;
1996
1999 default:
2002 return;
2003 }
2004 }
2005
2007
2009 {
2011 {
2012
2014 {
2016 }
2017 }
2018 }
2019 }
2021 {
2022
2024 {
2026 {
2030 break;
2031
2034 default:
2037 return;
2038 }
2039 }
2040
2042
2044 {
2046 {
2047
2049 {
2051 }
2052 }
2053 }
2054 }
2055 else
2056 {
2057
2059
2061 {
2064
2065 }
2066 else
2067 {
2069 {
2072 }
2073 }
2074 }
2075 }
2076
2078 {
2079 if (
GetGame().IsDedicatedServer())
2080 return;
2081
2083 {
2085 GetInventory().GetCurrentInventoryLocation(invLoc);
2087 {
2089 if (ptcMgr)
2090 {
2095 }
2096 }
2097 }
2099 {
2101 {
2104 return;
2105 }
2106
2108 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2110 {
2113 }
2114 }
2115 }
2116
2117 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2118 {
2119 super.GetDebugActions(outputList);
2120
2122 {
2126 }
2127 }
2128
2130 {
2131 super.OnAction(action_id, player, ctx);
2132
2134 {
2135 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2136 {
2138 if (food_stage_prev <= 0)
2139 {
2141 }
2143 return true;
2144 }
2145 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2146 {
2149 {
2151 }
2153 return true;
2154 }
2155
2156 }
2157
2158 #ifdef DIAG_DEVELOPER
2159 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2160 {
2161 PrintNutritionsData();
2162 return true;
2163 }
2164 #endif
2165
2166 return false;
2167 }
2168
2170 {
2171 string debug_output;
2172
2173 debug_output = super.GetDebugText();
2174
2177
2178 return debug_output;
2179 }
2180
2181
2182
2183
2184
2186 {
2187 float ret = super.GetBaitEffectivity();
2188
2190 {
2191 ret *= 0.5;
2192 }
2193
2194 return ret;
2195 }
2196
2198 {
2200 }
2201
2203 {
2205 }
2206
2208 {
2210 }
2211
2212 #ifdef DIAG_DEVELOPER
2213 private void PrintNutritionsData()
2214 {
2215 string nutritionsData = "";
2216
2219
2221 if (profile)
2222 {
2223 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2225 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2229 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2231
2234
2235 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2237 }
2238
2239 nutritionsData += "-----\n";
2240
2242 }
2243 #endif
2244
2246
2249 {
2251 }
2252}
2253
2255{
2257};
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.