1171{
1173
1181
1191
1193
1195 {
1197 {
1199
1201 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1202
1206 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1207 }
1208 }
1209
1211 {
1213
1215 }
1216
1218 {
1219 super.EEDelete(parent);
1220
1222
1225 }
1226
1228 {
1229 super.EEItemLocationChanged(oldLoc, newLoc);
1230
1233 {
1234 switch (oldLoc.GetParent().GetType())
1235 {
1236 case "FryingPan":
1237 case "Pot":
1238 case "Cauldron":
1239 case "SharpWoodenStick":
1241 break;
1242 }
1243
1246 {
1248 }
1249 }
1250
1251 if (oldLoc.IsValid())
1253
1256 }
1257
1259 {
1262 }
1263
1265 {
1268
1269 return true;
1270 }
1271
1273 {
1275 {
1277 }
1278 }
1279
1282 {
1283 int foodStageType;
1284
1286 if (foodStage)
1287 foodStageType = foodStage.GetFoodStageType();
1288
1293
1294 return agentsIn;
1295 }
1296
1297
1299 {
1300 return false;
1301 }
1302
1304 {
1305 return false;
1306 }
1307
1309 {
1311 {
1313 {
1316
1319
1320 default:
1321 return super.GetTemperatureFreezeTime();
1322 }
1323 }
1324
1325 return super.GetTemperatureFreezeTime();
1326 }
1327
1329 {
1331 {
1333 {
1336
1339
1340 default:
1341 return super.GetTemperatureThawTime();
1342 }
1343 }
1344
1345 return super.GetTemperatureThawTime();
1346 }
1347
1349 {
1351 }
1352
1353
1354
1355
1357 {
1358 SetSynchDirty();
1359 }
1360
1362 {
1363 super.OnVariablesSynchronized();
1364
1365
1366
1367
1369 {
1371 }
1372 else
1373 {
1375 }
1376
1379 }
1380
1381
1382
1383
1385 {
1388
1390 }
1391
1393 {
1394 string soundName = "";
1395
1398
1400 {
1402 }
1403 else
1404 {
1406 {
1408 {
1413 else
1414 soundName = "";
1415 break;
1416 }
1417
1419 {
1424 else
1425 soundName = "";
1426 break;
1427 }
1428
1430 {
1435 else
1436 soundName = "";
1437 break;
1438 }
1439
1440 default:
1441 soundName = "";
1442 break;
1443 }
1444
1446 {
1447 if (soundName == "")
1448 {
1450 }
1451 else
1452 {
1454 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1455 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1457 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1458 {
1460 }
1461 }
1462 }
1463 }
1464
1466 }
1467
1469 {
1472 }
1473
1474
1475
1476
1478 {
1479 super.OnStoreSave(ctx);
1480
1482 {
1484 }
1485
1486
1489 }
1490
1492 {
1493 if (!super.OnStoreLoad(ctx, version))
1494 return false;
1495
1497 {
1499 return false;
1500 }
1501
1502 if (version >= 115)
1503 {
1505 {
1507 return false;
1508 }
1510 {
1512 return false;
1513 }
1514 }
1515
1518
1519 return true;
1520 }
1521
1523 {
1524 super.AfterStoreLoad();
1525
1527 }
1528
1529
1531 {
1533 }
1534
1535
1537 {
1538 return false;
1539 }
1540
1542 {
1543 return false;
1544 }
1545
1547 {
1548 return false;
1549 }
1550
1552 {
1553 return false;
1554 }
1555
1556
1557
1558
1559
1561 {
1564 {
1565 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1566 }
1567 else if (classname != "" && food_stage)
1568 {
1569 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1570 }
1571 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1572 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1573
1574 }
1575
1577 {
1580 {
1582 }
1583 else if (classname != "" && food_stage)
1584 {
1585 return FoodStage.GetEnergy(null, food_stage, classname);
1586 }
1587 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1588 return g_Game.ConfigGetFloat( class_path +
" energy" );
1589 }
1590
1592 {
1595 {
1597 }
1598 else if (classname != "" && food_stage)
1599 {
1600 return FoodStage.GetWater(null, food_stage, classname);
1601 }
1602 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1603 return g_Game.ConfigGetFloat( class_path +
" water" );
1604 }
1605
1607 {
1610 {
1611 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1612 }
1613 else if (classname != "" && food_stage)
1614 {
1615 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1616 }
1617 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1618 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1619
1620 }
1621
1623 {
1626 {
1627 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1628 }
1629 else if (classname != "" && food_stage)
1630 {
1631 return FoodStage.GetToxicity(null, food_stage, classname);
1632 }
1633 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1634 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1635 }
1636
1638 {
1641 {
1643 }
1644 else if (classname != "" && food_stage)
1645 {
1646 return FoodStage.GetAgents(null, food_stage, classname);
1647 }
1648 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1649 return g_Game.ConfigGetInt( class_path +
" agents" );
1650 }
1651
1653 {
1656 {
1657 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1658 }
1659 else if (classname != "" && food_stage)
1660 {
1661 return FoodStage.GetDigestibility(null, food_stage, classname);
1662 }
1663 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1664 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1665 }
1666
1668 {
1671 {
1672 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1673 }
1674 else if (className != "" && foodStage)
1675 {
1676 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1677 }
1678 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1679 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1680 }
1681
1683 {
1693
1694 return profile;
1695 }
1696
1697
1698
1699
1701 {
1703 }
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
1757 {
1759 {
1761 }
1762
1763 return false;
1764 }
1765
1766
1768 {
1770 }
1771
1773 {
1774 return GetFoodStage().GetNextFoodStageType( cooking_method );
1775 }
1776
1778 {
1779 return GetFoodStage().GetFoodStageName( food_stage_type );
1780 }
1781
1783 {
1784 return GetFoodStage().CanChangeToNewStage( cooking_method );
1785 }
1786
1787
1789 {
1790 if ( !source.GetFoodStage())
1791 return;
1796 }
1797
1800 {
1803 }
1804
1807 {
1808 switch (stageNew)
1809 {
1814 break;
1815
1818 break;
1819 }
1820 }
1821
1822
1823
1824
1825
1827 {
1829 }
1830
1832 {
1834
1835
1837 }
1838
1840 {
1842 {
1845 }
1846 }
1847
1848
1850 {
1852 if (player)
1853 {
1855 player.ServerReplaceItemInHandsWithNew(lambda);
1856 }
1857 else
1858 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1859 }
1860
1862 {
1864 }
1865
1867 {
1868 super.SetActions();
1869
1872 }
1873
1875 {
1876 #ifndef SERVER
1877 #ifndef NO_GUI
1879 {
1881
1884 }
1885 #endif
1886 #endif
1887 }
1888
1890 {
1891 #ifndef SERVER
1892 #ifndef NO_GUI
1894 {
1898 }
1899 #endif
1900 #endif
1901 }
1902
1904 {
1905 return false;
1906 }
1907
1909 {
1911 }
1912
1913 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1914 {
1916
1917 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
1919 if ( hasRootAsPlayer )
1921
1922
1923
1924
1925
1926
1927
1929 {
1930
1932 {
1934 {
1938 break;
1939
1943 break;
1944
1948 break;
1949
1953 default:
1956 return;
1957 }
1958
1959
1960 }
1961
1963
1965 {
1967 {
1968
1970 {
1972 }
1974 {
1977 {
1979 }
1980 else
1981 {
1983 {
1985 }
1986 else
1987 {
1989 }
1990 }
1991 }
1992 }
1993 }
1994
1995 }
1997 {
1998
2000 {
2002 {
2006 break;
2007
2011 break;
2012
2016 break;
2017
2021 break;
2022
2025 default:
2028 return;
2029 }
2030 }
2031
2033
2035 {
2037 {
2038
2040 {
2042 }
2043 }
2044 }
2045 }
2047 {
2048
2050 {
2052 {
2056 break;
2057
2060 default:
2063 return;
2064 }
2065 }
2066
2068
2070 {
2072 {
2073
2075 {
2077 }
2078 }
2079 }
2080 }
2081 else
2082 {
2083
2085
2087 {
2090
2091 }
2092 else
2093 {
2095 {
2098 }
2099 }
2100 }
2101 }
2102
2104 {
2105 if (
g_Game.IsHeadlessOrDedicatedServer())
2106 return;
2107
2109 {
2111 GetInventory().GetCurrentInventoryLocation(invLoc);
2113 {
2115 if (ptcMgr)
2116 {
2121 }
2122 }
2123 }
2125 {
2127 {
2130 return;
2131 }
2132
2134 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2136 {
2139 }
2140 }
2141 }
2142
2143 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2144 {
2146 {
2151 }
2152
2153 super.GetDebugActions(outputList);
2154 }
2155
2157 {
2158 super.OnAction(action_id, player, ctx);
2159
2161 {
2162 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2163 {
2165 if (food_stage_prev <= 0)
2166 {
2168 }
2170 return true;
2171 }
2172 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2173 {
2176 {
2178 }
2180 return true;
2181 }
2182
2183 }
2184
2185 #ifdef DIAG_DEVELOPER
2186 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2187 {
2188 PrintNutritionsData();
2189 return true;
2190 }
2191 #endif
2192
2193 return false;
2194 }
2195
2197 {
2198 string debug_output;
2199
2200 debug_output = super.GetDebugText();
2201
2204
2205 return debug_output;
2206 }
2207
2208
2209
2210
2211
2213 {
2214 float ret = super.GetBaitEffectivity();
2215
2217 {
2218 ret *= 0.5;
2219 }
2220
2221 return ret;
2222 }
2223
2225 {
2227 }
2228
2230 {
2232 }
2233
2235 {
2237 }
2238
2239 #ifdef DIAG_DEVELOPER
2240 private void PrintNutritionsData()
2241 {
2242 string nutritionsData = "";
2243
2246
2248 if (profile)
2249 {
2250 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2252 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2256 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2258
2261
2262 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2264 }
2265
2266 nutritionsData += "-----\n";
2267
2269 }
2270 #endif
2271
2273
2276 {
2278 }
2279}
2280
2282{
2284};
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.