1161{
1163
1171
1181
1183
1185 {
1187 {
1189
1191 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1192
1196 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1197 }
1198 }
1199
1201 {
1203
1205 }
1206
1208 {
1209 super.EEDelete(parent);
1210
1212
1215 }
1216
1218 {
1219 super.EEItemLocationChanged(oldLoc, newLoc);
1220
1223 {
1224 switch (oldLoc.GetParent().GetType())
1225 {
1226 case "FryingPan":
1227 case "Pot":
1228 case "Cauldron":
1229 case "SharpWoodenStick":
1231 break;
1232 }
1233
1236 {
1238 }
1239 }
1240
1241 if (oldLoc.IsValid())
1243
1246 }
1247
1249 {
1252 }
1253
1255 {
1258
1259 return true;
1260 }
1261
1263 {
1265 {
1267 }
1268 }
1269
1272 {
1273 int foodStageType;
1274
1276 if (foodStage)
1277 foodStageType = foodStage.GetFoodStageType();
1278
1283
1284 return agentsIn;
1285 }
1286
1287
1289 {
1290 return false;
1291 }
1292
1294 {
1295 return false;
1296 }
1297
1299 {
1301 {
1303 {
1306
1309
1310 default:
1311 return super.GetTemperatureFreezeTime();
1312 }
1313 }
1314
1315 return super.GetTemperatureFreezeTime();
1316 }
1317
1319 {
1321 {
1323 {
1326
1329
1330 default:
1331 return super.GetTemperatureThawTime();
1332 }
1333 }
1334
1335 return super.GetTemperatureThawTime();
1336 }
1337
1339 {
1341 }
1342
1343
1344
1345
1347 {
1348 SetSynchDirty();
1349 }
1350
1352 {
1353 super.OnVariablesSynchronized();
1354
1355
1356
1357
1359 {
1361 }
1362 else
1363 {
1365 }
1366
1369 }
1370
1371
1372
1373
1375 {
1378
1380 }
1381
1383 {
1384 string soundName = "";
1385
1388
1390 {
1392 }
1393 else
1394 {
1396 {
1398 {
1403 else
1404 soundName = "";
1405 break;
1406 }
1407
1409 {
1414 else
1415 soundName = "";
1416 break;
1417 }
1418
1420 {
1425 else
1426 soundName = "";
1427 break;
1428 }
1429
1430 default:
1431 soundName = "";
1432 break;
1433 }
1434
1436 {
1437 if (soundName == "")
1438 {
1440 }
1441 else
1442 {
1444 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1445 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1447 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1448 {
1450 }
1451 }
1452 }
1453 }
1454
1456 }
1457
1459 {
1462 }
1463
1464
1465
1466
1468 {
1469 super.OnStoreSave(ctx);
1470
1472 {
1474 }
1475
1476
1479 }
1480
1482 {
1483 if (!super.OnStoreLoad(ctx, version))
1484 return false;
1485
1487 {
1489 return false;
1490 }
1491
1492 if (version >= 115)
1493 {
1495 {
1497 return false;
1498 }
1500 {
1502 return false;
1503 }
1504 }
1505
1508
1509 return true;
1510 }
1511
1513 {
1514 super.AfterStoreLoad();
1515
1517 }
1518
1519
1521 {
1523 }
1524
1525
1527 {
1528 return false;
1529 }
1530
1532 {
1533 return false;
1534 }
1535
1537 {
1538 return false;
1539 }
1540
1542 {
1543 return false;
1544 }
1545
1546
1547
1548
1549
1551 {
1554 {
1555 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1556 }
1557 else if (classname != "" && food_stage)
1558 {
1559 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1560 }
1561 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1562 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1563
1564 }
1565
1567 {
1570 {
1572 }
1573 else if (classname != "" && food_stage)
1574 {
1575 return FoodStage.GetEnergy(null, food_stage, classname);
1576 }
1577 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1578 return g_Game.ConfigGetFloat( class_path +
" energy" );
1579 }
1580
1582 {
1585 {
1587 }
1588 else if (classname != "" && food_stage)
1589 {
1590 return FoodStage.GetWater(null, food_stage, classname);
1591 }
1592 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1593 return g_Game.ConfigGetFloat( class_path +
" water" );
1594 }
1595
1597 {
1600 {
1601 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1602 }
1603 else if (classname != "" && food_stage)
1604 {
1605 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1606 }
1607 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1608 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1609
1610 }
1611
1613 {
1616 {
1617 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1618 }
1619 else if (classname != "" && food_stage)
1620 {
1621 return FoodStage.GetToxicity(null, food_stage, classname);
1622 }
1623 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1624 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1625 }
1626
1628 {
1631 {
1633 }
1634 else if (classname != "" && food_stage)
1635 {
1636 return FoodStage.GetAgents(null, food_stage, classname);
1637 }
1638 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1639 return g_Game.ConfigGetInt( class_path +
" agents" );
1640 }
1641
1643 {
1646 {
1647 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1648 }
1649 else if (classname != "" && food_stage)
1650 {
1651 return FoodStage.GetDigestibility(null, food_stage, classname);
1652 }
1653 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1654 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1655 }
1656
1658 {
1661 {
1662 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1663 }
1664 else if (className != "" && foodStage)
1665 {
1666 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1667 }
1668 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1669 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1670 }
1671
1673 {
1683
1684 return profile;
1685 }
1686
1687
1688
1689
1691 {
1693 }
1694
1695
1697 {
1699 {
1701 }
1702
1703 return false;
1704 }
1705
1707 {
1709 {
1711 }
1712
1713 return false;
1714 }
1715
1717 {
1719 {
1721 }
1722
1723 return false;
1724 }
1725
1727 {
1729 {
1731 }
1732
1733 return false;
1734 }
1735
1737 {
1739 {
1741 }
1742
1743 return false;
1744 }
1745
1747 {
1749 {
1751 }
1752
1753 return false;
1754 }
1755
1756
1758 {
1760 }
1761
1763 {
1764 return GetFoodStage().GetNextFoodStageType( cooking_method );
1765 }
1766
1768 {
1769 return GetFoodStage().GetFoodStageName( food_stage_type );
1770 }
1771
1773 {
1774 return GetFoodStage().CanChangeToNewStage( cooking_method );
1775 }
1776
1777
1779 {
1780 if ( !source.GetFoodStage())
1781 return;
1786 }
1787
1790 {
1793 }
1794
1797 {
1798 switch (stageNew)
1799 {
1804 break;
1805
1808 break;
1809 }
1810 }
1811
1812
1813
1814
1815
1817 {
1819 }
1820
1822 {
1824
1825
1827 }
1828
1830 {
1832 {
1835 }
1836 }
1837
1838
1840 {
1842 if (player)
1843 {
1845 player.ServerReplaceItemInHandsWithNew(lambda);
1846 }
1847 else
1848 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1849 }
1850
1852 {
1854 }
1855
1857 {
1858 super.SetActions();
1859
1862 }
1863
1865 {
1866 #ifndef SERVER
1867 #ifndef NO_GUI
1869 {
1871
1874 }
1875 #endif
1876 #endif
1877 }
1878
1880 {
1881 #ifndef SERVER
1882 #ifndef NO_GUI
1884 {
1888 }
1889 #endif
1890 #endif
1891 }
1892
1894 {
1895 return false;
1896 }
1897
1899 {
1901 }
1902
1903 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1904 {
1906
1907 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
1909 if ( hasRootAsPlayer )
1911
1912
1913
1914
1915
1916
1917
1919 {
1920
1922 {
1924 {
1928 break;
1929
1933 break;
1934
1938 break;
1939
1943 default:
1946 return;
1947 }
1948
1949
1950 }
1951
1953
1955 {
1957 {
1958
1960 {
1962 }
1964 {
1967 {
1969 }
1970 else
1971 {
1973 {
1975 }
1976 else
1977 {
1979 }
1980 }
1981 }
1982 }
1983 }
1984
1985 }
1987 {
1988
1990 {
1992 {
1996 break;
1997
2001 break;
2002
2006 break;
2007
2011 break;
2012
2015 default:
2018 return;
2019 }
2020 }
2021
2023
2025 {
2027 {
2028
2030 {
2032 }
2033 }
2034 }
2035 }
2037 {
2038
2040 {
2042 {
2046 break;
2047
2050 default:
2053 return;
2054 }
2055 }
2056
2058
2060 {
2062 {
2063
2065 {
2067 }
2068 }
2069 }
2070 }
2071 else
2072 {
2073
2075
2077 {
2080
2081 }
2082 else
2083 {
2085 {
2088 }
2089 }
2090 }
2091 }
2092
2094 {
2095 if (
g_Game.IsHeadlessOrDedicatedServer())
2096 return;
2097
2099 {
2101 GetInventory().GetCurrentInventoryLocation(invLoc);
2103 {
2105 if (ptcMgr)
2106 {
2111 }
2112 }
2113 }
2115 {
2117 {
2120 return;
2121 }
2122
2124 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2126 {
2129 }
2130 }
2131 }
2132
2133 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2134 {
2136 {
2141 }
2142
2143 super.GetDebugActions(outputList);
2144 }
2145
2147 {
2148 super.OnAction(action_id, player, ctx);
2149
2151 {
2152 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2153 {
2155 if (food_stage_prev <= 0)
2156 {
2158 }
2160 return true;
2161 }
2162 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2163 {
2166 {
2168 }
2170 return true;
2171 }
2172
2173 }
2174
2175 #ifdef DIAG_DEVELOPER
2176 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2177 {
2178 PrintNutritionsData();
2179 return true;
2180 }
2181 #endif
2182
2183 return false;
2184 }
2185
2187 {
2188 string debug_output;
2189
2190 debug_output = super.GetDebugText();
2191
2194
2195 return debug_output;
2196 }
2197
2198
2199
2200
2201
2203 {
2204 float ret = super.GetBaitEffectivity();
2205
2207 {
2208 ret *= 0.5;
2209 }
2210
2211 return ret;
2212 }
2213
2215 {
2217 }
2218
2220 {
2222 }
2223
2225 {
2227 }
2228
2229 #ifdef DIAG_DEVELOPER
2230 private void PrintNutritionsData()
2231 {
2232 string nutritionsData = "";
2233
2236
2238 if (profile)
2239 {
2240 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2242 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2246 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2248
2251
2252 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2254 }
2255
2256 nutritionsData += "-----\n";
2257
2259 }
2260 #endif
2261
2263
2266 {
2268 }
2269}
2270
2272{
2274};
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.