1138{
1140
1148
1158
1160
1162 {
1164 {
1166
1168 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1169
1173 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1174 }
1175 }
1176
1178 {
1180
1182 }
1183
1185 {
1186 super.EEDelete(parent);
1187
1189
1192 }
1193
1195 {
1196 super.EEItemLocationChanged(oldLoc, newLoc);
1197
1200 {
1201 switch (oldLoc.GetParent().GetType())
1202 {
1203 case "FryingPan":
1204 case "Pot":
1205 case "Cauldron":
1206 case "SharpWoodenStick":
1208 break;
1209 }
1210
1213 {
1215 }
1216 }
1217
1218 if (oldLoc.IsValid())
1220
1223 }
1224
1226 {
1229 }
1230
1232 {
1235
1236 return true;
1237 }
1238
1240 {
1242 {
1244 }
1245 }
1246
1249 {
1250 int foodStageType;
1251
1253 if (foodStage)
1254 foodStageType = foodStage.GetFoodStageType();
1255
1260
1261 return agentsIn;
1262 }
1263
1264
1266 {
1267 return false;
1268 }
1269
1271 {
1272 return false;
1273 }
1274
1276 {
1278 {
1280 {
1283
1286
1287 default:
1288 return super.GetTemperatureFreezeTime();
1289 }
1290 }
1291
1292 return super.GetTemperatureFreezeTime();
1293 }
1294
1296 {
1298 {
1300 {
1303
1306
1307 default:
1308 return super.GetTemperatureThawTime();
1309 }
1310 }
1311
1312 return super.GetTemperatureThawTime();
1313 }
1314
1316 {
1318 }
1319
1320
1321
1322
1324 {
1325 SetSynchDirty();
1326 }
1327
1329 {
1330 super.OnVariablesSynchronized();
1331
1332
1333
1334
1336 {
1338 }
1339 else
1340 {
1342 }
1343
1346 }
1347
1348
1349
1350
1352 {
1355
1357 }
1358
1360 {
1361 string soundName = "";
1362
1365
1367 {
1369 }
1370 else
1371 {
1373 {
1375 {
1380 else
1381 soundName = "";
1382 break;
1383 }
1384
1386 {
1391 else
1392 soundName = "";
1393 break;
1394 }
1395
1397 {
1402 else
1403 soundName = "";
1404 break;
1405 }
1406
1407 default:
1408 soundName = "";
1409 break;
1410 }
1411
1413 {
1414 if (soundName == "")
1415 {
1417 }
1418 else
1419 {
1421 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1422 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1424 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1425 {
1427 }
1428 }
1429 }
1430 }
1431
1433 }
1434
1436 {
1439 }
1440
1441
1442
1443
1445 {
1446 super.OnStoreSave(ctx);
1447
1449 {
1451 }
1452
1453
1456 }
1457
1459 {
1460 if (!super.OnStoreLoad(ctx, version))
1461 return false;
1462
1464 {
1466 return false;
1467 }
1468
1469 if (version >= 115)
1470 {
1472 {
1474 return false;
1475 }
1477 {
1479 return false;
1480 }
1481 }
1482
1485
1486 return true;
1487 }
1488
1490 {
1491 super.AfterStoreLoad();
1492
1494 }
1495
1496
1498 {
1500 }
1501
1502
1504 {
1505 return false;
1506 }
1507
1509 {
1510 return false;
1511 }
1512
1514 {
1515 return false;
1516 }
1517
1519 {
1520 return false;
1521 }
1522
1523
1524
1525
1526
1528 {
1531 {
1532 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1533 }
1534 else if (classname != "" && food_stage)
1535 {
1536 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1537 }
1538 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1539 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1540
1541 }
1542
1544 {
1547 {
1549 }
1550 else if (classname != "" && food_stage)
1551 {
1552 return FoodStage.GetEnergy(null, food_stage, classname);
1553 }
1554 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1555 return g_Game.ConfigGetFloat( class_path +
" energy" );
1556 }
1557
1559 {
1562 {
1564 }
1565 else if (classname != "" && food_stage)
1566 {
1567 return FoodStage.GetWater(null, food_stage, classname);
1568 }
1569 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1570 return g_Game.ConfigGetFloat( class_path +
" water" );
1571 }
1572
1574 {
1577 {
1578 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1579 }
1580 else if (classname != "" && food_stage)
1581 {
1582 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1583 }
1584 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1585 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1586
1587 }
1588
1590 {
1593 {
1594 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1595 }
1596 else if (classname != "" && food_stage)
1597 {
1598 return FoodStage.GetToxicity(null, food_stage, classname);
1599 }
1600 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1601 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1602 }
1603
1605 {
1608 {
1610 }
1611 else if (classname != "" && food_stage)
1612 {
1613 return FoodStage.GetAgents(null, food_stage, classname);
1614 }
1615 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1616 return g_Game.ConfigGetInt( class_path +
" agents" );
1617 }
1618
1620 {
1623 {
1624 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1625 }
1626 else if (classname != "" && food_stage)
1627 {
1628 return FoodStage.GetDigestibility(null, food_stage, classname);
1629 }
1630 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1631 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1632 }
1633
1635 {
1638 {
1639 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1640 }
1641 else if (className != "" && foodStage)
1642 {
1643 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1644 }
1645 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1646 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1647 }
1648
1650 {
1660
1661 return profile;
1662 }
1663
1664
1665
1666
1668 {
1670 }
1671
1672
1674 {
1676 {
1678 }
1679
1680 return false;
1681 }
1682
1684 {
1686 {
1688 }
1689
1690 return false;
1691 }
1692
1694 {
1696 {
1698 }
1699
1700 return false;
1701 }
1702
1704 {
1706 {
1708 }
1709
1710 return false;
1711 }
1712
1714 {
1716 {
1718 }
1719
1720 return false;
1721 }
1722
1724 {
1726 {
1728 }
1729
1730 return false;
1731 }
1732
1733
1735 {
1737 }
1738
1740 {
1741 return GetFoodStage().GetNextFoodStageType( cooking_method );
1742 }
1743
1745 {
1746 return GetFoodStage().GetFoodStageName( food_stage_type );
1747 }
1748
1750 {
1751 return GetFoodStage().CanChangeToNewStage( cooking_method );
1752 }
1753
1754
1756 {
1757 if ( !source.GetFoodStage())
1758 return;
1763 }
1764
1767 {
1770 }
1771
1774 {
1775 switch (stageNew)
1776 {
1781 break;
1782
1785 break;
1786 }
1787 }
1788
1789
1790
1791
1792
1794 {
1796 }
1797
1799 {
1801
1802
1804 }
1805
1807 {
1809 {
1812 }
1813 }
1814
1815
1817 {
1819 if (player)
1820 {
1822 player.ServerReplaceItemInHandsWithNew(lambda);
1823 }
1824 else
1825 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1826 }
1827
1829 {
1831 }
1832
1834 {
1835 super.SetActions();
1836
1839 }
1840
1842 {
1843 #ifndef SERVER
1844 #ifndef NO_GUI
1846 {
1848
1851 }
1852 #endif
1853 #endif
1854 }
1855
1857 {
1858 #ifndef SERVER
1859 #ifndef NO_GUI
1861 {
1865 }
1866 #endif
1867 #endif
1868 }
1869
1871 {
1872 return false;
1873 }
1874
1876 {
1878 }
1879
1880 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1881 {
1883
1884 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
1886 if ( hasRootAsPlayer )
1888
1889
1890
1891
1892
1893
1894
1896 {
1897
1899 {
1901 {
1905 break;
1906
1910 break;
1911
1915 break;
1916
1920 default:
1923 return;
1924 }
1925
1926
1927 }
1928
1930
1932 {
1934 {
1935
1937 {
1939 }
1941 {
1944 {
1946 }
1947 else
1948 {
1950 {
1952 }
1953 else
1954 {
1956 }
1957 }
1958 }
1959 }
1960 }
1961
1962 }
1964 {
1965
1967 {
1969 {
1973 break;
1974
1978 break;
1979
1983 break;
1984
1988 break;
1989
1992 default:
1995 return;
1996 }
1997 }
1998
2000
2002 {
2004 {
2005
2007 {
2009 }
2010 }
2011 }
2012 }
2014 {
2015
2017 {
2019 {
2023 break;
2024
2027 default:
2030 return;
2031 }
2032 }
2033
2035
2037 {
2039 {
2040
2042 {
2044 }
2045 }
2046 }
2047 }
2048 else
2049 {
2050
2052
2054 {
2057
2058 }
2059 else
2060 {
2062 {
2065 }
2066 }
2067 }
2068 }
2069
2071 {
2072 if (
g_Game.IsHeadlessOrDedicatedServer())
2073 return;
2074
2076 {
2078 GetInventory().GetCurrentInventoryLocation(invLoc);
2080 {
2082 if (ptcMgr)
2083 {
2088 }
2089 }
2090 }
2092 {
2094 {
2097 return;
2098 }
2099
2101 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2103 {
2106 }
2107 }
2108 }
2109
2110 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2111 {
2113 {
2118 }
2119
2120 super.GetDebugActions(outputList);
2121 }
2122
2124 {
2125 super.OnAction(action_id, player, ctx);
2126
2128 {
2129 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2130 {
2132 if (food_stage_prev <= 0)
2133 {
2135 }
2137 return true;
2138 }
2139 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2140 {
2143 {
2145 }
2147 return true;
2148 }
2149
2150 }
2151
2152 #ifdef DIAG_DEVELOPER
2153 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2154 {
2155 PrintNutritionsData();
2156 return true;
2157 }
2158 #endif
2159
2160 return false;
2161 }
2162
2164 {
2165 string debug_output;
2166
2167 debug_output = super.GetDebugText();
2168
2171
2172 return debug_output;
2173 }
2174
2175
2176
2177
2178
2180 {
2181 float ret = super.GetBaitEffectivity();
2182
2184 {
2185 ret *= 0.5;
2186 }
2187
2188 return ret;
2189 }
2190
2192 {
2194 }
2195
2197 {
2199 }
2200
2202 {
2204 }
2205
2206 #ifdef DIAG_DEVELOPER
2207 private void PrintNutritionsData()
2208 {
2209 string nutritionsData = "";
2210
2213
2215 if (profile)
2216 {
2217 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2219 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2223 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2225
2228
2229 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2231 }
2232
2233 nutritionsData += "-----\n";
2234
2236 }
2237 #endif
2238
2240
2243 {
2245 }
2246}
2247
2249{
2251};
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.