1216{
1218
1226
1236
1238
1240 {
1242 {
1244
1246 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1247
1251 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1252 }
1253 }
1254
1256 {
1258
1260 }
1261
1263 {
1264 super.EEDelete(parent);
1265
1267
1270 }
1271
1273 {
1274 super.EEItemLocationChanged(oldLoc, newLoc);
1275
1278 {
1279 switch (oldLoc.GetParent().GetType())
1280 {
1281 case "FryingPan":
1282 case "Pot":
1283 case "Cauldron":
1284 case "SharpWoodenStick":
1286 break;
1287 }
1288
1291 {
1293 }
1294 }
1295
1296 if (oldLoc.IsValid())
1298
1301 }
1302
1304 {
1307 }
1308
1310 {
1313
1314 return true;
1315 }
1316
1318 {
1320 {
1322 }
1323 }
1324
1327 {
1328 int foodStageType;
1329
1331 if (foodStage)
1332 foodStageType = foodStage.GetFoodStageType();
1333
1338
1339 return agentsIn;
1340 }
1341
1342
1344 {
1345 return false;
1346 }
1347
1349 {
1350 return false;
1351 }
1352
1354 {
1356 {
1358 {
1361
1364
1365 default:
1366 return super.GetTemperatureFreezeTime();
1367 }
1368 }
1369
1370 return super.GetTemperatureFreezeTime();
1371 }
1372
1374 {
1376 {
1378 {
1381
1384
1385 default:
1386 return super.GetTemperatureThawTime();
1387 }
1388 }
1389
1390 return super.GetTemperatureThawTime();
1391 }
1392
1394 {
1396 }
1397
1398
1399
1400
1402 {
1403 SetSynchDirty();
1404 }
1405
1407 {
1408 super.OnVariablesSynchronized();
1409
1410
1411
1412
1414 {
1416 }
1417 else
1418 {
1420 }
1421
1424 }
1425
1426
1427
1428
1430 {
1433
1435 }
1436
1438 {
1439 string soundName = "";
1440
1443
1445 {
1447 }
1448 else
1449 {
1451 {
1453 {
1458 else
1459 soundName = "";
1460 break;
1461 }
1462
1464 {
1469 else
1470 soundName = "";
1471 break;
1472 }
1473
1475 {
1480 else
1481 soundName = "";
1482 break;
1483 }
1484
1485 default:
1486 soundName = "";
1487 break;
1488 }
1489
1491 {
1492 if (soundName == "")
1493 {
1495 }
1496 else
1497 {
1499 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1500 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1502 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1503 {
1505 }
1506 }
1507 }
1508 }
1509
1511 }
1512
1514 {
1517 }
1518
1519
1520
1521
1523 {
1524 super.OnStoreSave(ctx);
1525
1527 {
1529 }
1530
1531
1534 }
1535
1537 {
1538 if (!super.OnStoreLoad(ctx, version))
1539 return false;
1540
1542 {
1544 return false;
1545 }
1546
1547 if (version >= 115)
1548 {
1550 {
1552 return false;
1553 }
1555 {
1557 return false;
1558 }
1559 }
1560
1563
1564 return true;
1565 }
1566
1568 {
1569 super.AfterStoreLoad();
1570
1572 }
1573
1574
1576 {
1578 }
1579
1580
1582 {
1583 return false;
1584 }
1585
1587 {
1588 return false;
1589 }
1590
1592 {
1593 return false;
1594 }
1595
1597 {
1598 return false;
1599 }
1600
1601
1602
1603
1604
1606 {
1609 {
1610 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1611 }
1612 else if (classname != "" && food_stage)
1613 {
1614 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1615 }
1616 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1617 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1618
1619 }
1620
1622 {
1625 {
1627 }
1628 else if (classname != "" && food_stage)
1629 {
1630 return FoodStage.GetEnergy(null, food_stage, classname);
1631 }
1632 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1633 return g_Game.ConfigGetFloat( class_path +
" energy" );
1634 }
1635
1637 {
1640 {
1642 }
1643 else if (classname != "" && food_stage)
1644 {
1645 return FoodStage.GetWater(null, food_stage, classname);
1646 }
1647 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1648 return g_Game.ConfigGetFloat( class_path +
" water" );
1649 }
1650
1652 {
1655 {
1656 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1657 }
1658 else if (classname != "" && food_stage)
1659 {
1660 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1661 }
1662 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1663 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1664
1665 }
1666
1668 {
1671 {
1672 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1673 }
1674 else if (classname != "" && food_stage)
1675 {
1676 return FoodStage.GetToxicity(null, food_stage, classname);
1677 }
1678 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1679 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1680 }
1681
1683 {
1686 {
1688 }
1689 else if (classname != "" && food_stage)
1690 {
1691 return FoodStage.GetAgents(null, food_stage, classname);
1692 }
1693 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1694 return g_Game.ConfigGetInt( class_path +
" agents" );
1695 }
1696
1698 {
1701 {
1702 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1703 }
1704 else if (classname != "" && food_stage)
1705 {
1706 return FoodStage.GetDigestibility(null, food_stage, classname);
1707 }
1708 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1709 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1710 }
1711
1713 {
1716 {
1717 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1718 }
1719 else if (className != "" && foodStage)
1720 {
1721 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1722 }
1723 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1724 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1725 }
1726
1728 {
1738
1739 return profile;
1740 }
1741
1742
1743
1744
1746 {
1748 }
1749
1750
1752 {
1754 {
1756 }
1757
1758 return false;
1759 }
1760
1762 {
1764 {
1766 }
1767
1768 return false;
1769 }
1770
1772 {
1774 {
1776 }
1777
1778 return false;
1779 }
1780
1782 {
1784 {
1786 }
1787
1788 return false;
1789 }
1790
1792 {
1794 {
1796 }
1797
1798 return false;
1799 }
1800
1802 {
1804 {
1806 }
1807
1808 return false;
1809 }
1810
1811
1813 {
1815 }
1816
1818 {
1819 return GetFoodStage().GetNextFoodStageType( cooking_method );
1820 }
1821
1823 {
1824 return GetFoodStage().GetFoodStageName( food_stage_type );
1825 }
1826
1828 {
1829 return GetFoodStage().CanChangeToNewStage( cooking_method );
1830 }
1831
1832
1834 {
1835 if ( !source.GetFoodStage())
1836 return;
1841 }
1842
1845 {
1848 }
1849
1852 {
1853 switch (stageNew)
1854 {
1859 break;
1860
1863 break;
1864 }
1865 }
1866
1867
1868
1869
1870
1872 {
1874 }
1875
1877 {
1879
1880
1882 }
1883
1885 {
1887 {
1890 }
1891 }
1892
1893
1895 {
1897 if (player)
1898 {
1900 player.ServerReplaceItemInHandsWithNew(lambda);
1901 }
1902 else
1903 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1904 }
1905
1907 {
1909 }
1910
1912 {
1913 super.SetActions();
1914
1917 }
1918
1920 {
1921 #ifndef SERVER
1922 #ifndef NO_GUI
1924 {
1926
1929 }
1930 #endif
1931 #endif
1932 }
1933
1935 {
1936 #ifndef SERVER
1937 #ifndef NO_GUI
1939 {
1943 }
1944 #endif
1945 #endif
1946 }
1947
1949 {
1950 return false;
1951 }
1952
1954 {
1956 }
1957
1958 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1959 {
1961
1962 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
1964 if ( hasRootAsPlayer )
1966
1967
1968
1969
1970
1971
1972
1974 {
1975
1977 {
1979 {
1983 break;
1984
1988 break;
1989
1993 break;
1994
1998 default:
2001 return;
2002 }
2003
2004
2005 }
2006
2008
2010 {
2012 {
2013
2015 {
2017 }
2019 {
2022 {
2024 }
2025 else
2026 {
2028 {
2030 }
2031 else
2032 {
2034 }
2035 }
2036 }
2037 }
2038 }
2039
2040 }
2042 {
2043
2045 {
2047 {
2051 break;
2052
2056 break;
2057
2061 break;
2062
2066 break;
2067
2070 default:
2073 return;
2074 }
2075 }
2076
2078
2080 {
2082 {
2083
2085 {
2087 }
2088 }
2089 }
2090 }
2092 {
2093
2095 {
2097 {
2101 break;
2102
2105 default:
2108 return;
2109 }
2110 }
2111
2113
2115 {
2117 {
2118
2120 {
2122 }
2123 }
2124 }
2125 }
2126 else
2127 {
2128
2130
2132 {
2135
2136 }
2137 else
2138 {
2140 {
2143 }
2144 }
2145 }
2146 }
2147
2149 {
2150 if (
g_Game.IsHeadlessOrDedicatedServer())
2151 return;
2152
2154 {
2156 GetInventory().GetCurrentInventoryLocation(invLoc);
2158 {
2160 if (ptcMgr)
2161 {
2166 }
2167 }
2168 }
2170 {
2172 {
2175 return;
2176 }
2177
2179 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2181 {
2184 }
2185 }
2186 }
2187
2188 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2189 {
2191 {
2196 }
2197
2198 super.GetDebugActions(outputList);
2199 }
2200
2202 {
2203 super.OnAction(action_id, player, ctx);
2204
2206 {
2207 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2208 {
2210 if (food_stage_prev <= 0)
2211 {
2213 }
2215 return true;
2216 }
2217 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2218 {
2221 {
2223 }
2225 return true;
2226 }
2227
2228 }
2229
2230 #ifdef DIAG_DEVELOPER
2231 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2232 {
2233 PrintNutritionsData();
2234 return true;
2235 }
2236 #endif
2237
2238 return false;
2239 }
2240
2242 {
2243 string debug_output;
2244
2245 debug_output = super.GetDebugText();
2246
2249
2250 return debug_output;
2251 }
2252
2253
2254
2255
2256
2258 {
2259 float ret = super.GetBaitEffectivity();
2260
2262 {
2263 ret *= 0.5;
2264 }
2265
2266 return ret;
2267 }
2268
2270 {
2272 }
2273
2275 {
2277 }
2278
2280 {
2282 }
2283
2284 #ifdef DIAG_DEVELOPER
2285 private void PrintNutritionsData()
2286 {
2287 string nutritionsData = "";
2288
2291
2293 if (profile)
2294 {
2295 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2297 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2301 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2303
2306
2307 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2309 }
2310
2311 nutritionsData += "-----\n";
2312
2314 }
2315 #endif
2316
2318
2321 {
2323 }
2324}
2325
2327{
2329};
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.