1272{
1274
1282
1292
1294
1296 {
1298 {
1300
1302 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1303
1307 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1308 }
1309 }
1310
1312 {
1314
1316 }
1317
1319 {
1320 super.EEDelete(parent);
1321
1323
1326 }
1327
1329 {
1330 super.EEItemLocationChanged(oldLoc, newLoc);
1331
1334 {
1335 switch (oldLoc.GetParent().GetType())
1336 {
1337 case "FryingPan":
1338 case "Pot":
1339 case "Cauldron":
1340 case "SharpWoodenStick":
1342 break;
1343 }
1344
1347 {
1349 }
1350 }
1351
1352 if (oldLoc.IsValid())
1354
1357 }
1358
1360 {
1363 }
1364
1366 {
1369
1370 return true;
1371 }
1372
1374 {
1376 {
1378 }
1379 }
1380
1383 {
1384 int foodStageType;
1385
1387 if (foodStage)
1388 foodStageType = foodStage.GetFoodStageType();
1389
1394
1395 return agentsIn;
1396 }
1397
1398
1400 {
1401 return false;
1402 }
1403
1405 {
1406 return false;
1407 }
1408
1410 {
1412 {
1414 {
1417
1420
1421 default:
1422 return super.GetTemperatureFreezeTime();
1423 }
1424 }
1425
1426 return super.GetTemperatureFreezeTime();
1427 }
1428
1430 {
1432 {
1434 {
1437
1440
1441 default:
1442 return super.GetTemperatureThawTime();
1443 }
1444 }
1445
1446 return super.GetTemperatureThawTime();
1447 }
1448
1450 {
1452 }
1453
1454
1455
1456
1458 {
1459 SetSynchDirty();
1460 }
1461
1463 {
1464 super.OnVariablesSynchronized();
1465
1466
1467
1468
1470 {
1472 }
1473 else
1474 {
1476 }
1477
1480 }
1481
1482
1483
1484
1486 {
1489
1491 }
1492
1494 {
1495 string soundName = "";
1496
1499
1501 {
1503 }
1504 else
1505 {
1507 {
1509 {
1514 else
1515 soundName = "";
1516 break;
1517 }
1518
1520 {
1525 else
1526 soundName = "";
1527 break;
1528 }
1529
1531 {
1536 else
1537 soundName = "";
1538 break;
1539 }
1540
1541 default:
1542 soundName = "";
1543 break;
1544 }
1545
1547 {
1548 if (soundName == "")
1549 {
1551 }
1552 else
1553 {
1555 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1556 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1558 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1559 {
1561 }
1562 }
1563 }
1564 }
1565
1567 }
1568
1570 {
1573 }
1574
1575
1576
1577
1579 {
1580 super.OnStoreSave(ctx);
1581
1583 {
1585 }
1586
1587
1590 }
1591
1593 {
1594 if (!super.OnStoreLoad(ctx, version))
1595 return false;
1596
1598 {
1600 return false;
1601 }
1602
1603 if (version >= 115)
1604 {
1606 {
1608 return false;
1609 }
1611 {
1613 return false;
1614 }
1615 }
1616
1619
1620 return true;
1621 }
1622
1624 {
1625 super.AfterStoreLoad();
1626
1628 }
1629
1630
1632 {
1634 }
1635
1636
1638 {
1639 return false;
1640 }
1641
1643 {
1644 return false;
1645 }
1646
1648 {
1649 return false;
1650 }
1651
1653 {
1654 return false;
1655 }
1656
1657
1658
1659
1660
1662 {
1665 {
1666 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1667 }
1668 else if (classname != "" && food_stage)
1669 {
1670 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1671 }
1672 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1673 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1674
1675 }
1676
1678 {
1681 {
1683 }
1684 else if (classname != "" && food_stage)
1685 {
1686 return FoodStage.GetEnergy(null, food_stage, classname);
1687 }
1688 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1689 return g_Game.ConfigGetFloat( class_path +
" energy" );
1690 }
1691
1693 {
1696 {
1698 }
1699 else if (classname != "" && food_stage)
1700 {
1701 return FoodStage.GetWater(null, food_stage, classname);
1702 }
1703 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1704 return g_Game.ConfigGetFloat( class_path +
" water" );
1705 }
1706
1708 {
1711 {
1712 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1713 }
1714 else if (classname != "" && food_stage)
1715 {
1716 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1717 }
1718 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1719 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1720
1721 }
1722
1724 {
1727 {
1728 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1729 }
1730 else if (classname != "" && food_stage)
1731 {
1732 return FoodStage.GetToxicity(null, food_stage, classname);
1733 }
1734 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1735 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1736 }
1737
1739 {
1742 {
1744 }
1745 else if (classname != "" && food_stage)
1746 {
1747 return FoodStage.GetAgents(null, food_stage, classname);
1748 }
1749 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1750 return g_Game.ConfigGetInt( class_path +
" agents" );
1751 }
1752
1754 {
1757 {
1758 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1759 }
1760 else if (classname != "" && food_stage)
1761 {
1762 return FoodStage.GetDigestibility(null, food_stage, classname);
1763 }
1764 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1765 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1766 }
1767
1769 {
1772 {
1773 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1774 }
1775 else if (className != "" && foodStage)
1776 {
1777 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1778 }
1779 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1780 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1781 }
1782
1784 {
1794
1795 return profile;
1796 }
1797
1798
1799
1800
1802 {
1804 }
1805
1806
1808 {
1810 {
1812 }
1813
1814 return false;
1815 }
1816
1818 {
1820 {
1822 }
1823
1824 return false;
1825 }
1826
1828 {
1830 {
1832 }
1833
1834 return false;
1835 }
1836
1838 {
1840 {
1842 }
1843
1844 return false;
1845 }
1846
1848 {
1850 {
1852 }
1853
1854 return false;
1855 }
1856
1858 {
1860 {
1862 }
1863
1864 return false;
1865 }
1866
1867
1869 {
1871 }
1872
1874 {
1875 return GetFoodStage().GetNextFoodStageType( cooking_method );
1876 }
1877
1879 {
1880 return GetFoodStage().GetFoodStageName( food_stage_type );
1881 }
1882
1884 {
1885 return GetFoodStage().CanChangeToNewStage( cooking_method );
1886 }
1887
1888
1890 {
1891 if ( !source.GetFoodStage())
1892 return;
1897 }
1898
1901 {
1904 }
1905
1908 {
1909 switch (stageNew)
1910 {
1915 break;
1916
1919 break;
1920 }
1921 }
1922
1923
1924
1925
1926
1928 {
1930 }
1931
1933 {
1935
1936
1938 }
1939
1941 {
1943 {
1946 }
1947 }
1948
1949
1951 {
1953 if (player)
1954 {
1956 player.ServerReplaceItemInHandsWithNew(lambda);
1957 }
1958 else
1959 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1960 }
1961
1963 {
1965 }
1966
1968 {
1969 super.SetActions();
1970
1973 }
1974
1976 {
1977 #ifndef SERVER
1978 #ifndef NO_GUI
1980 {
1982
1985 }
1986 #endif
1987 #endif
1988 }
1989
1991 {
1992 #ifndef SERVER
1993 #ifndef NO_GUI
1995 {
1999 }
2000 #endif
2001 #endif
2002 }
2003
2005 {
2006 return false;
2007 }
2008
2010 {
2012 }
2013
2014 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2015 {
2017
2018 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2020 if ( hasRootAsPlayer )
2022
2023
2024
2025
2026
2027
2028
2030 {
2031
2033 {
2035 {
2039 break;
2040
2044 break;
2045
2049 break;
2050
2054 default:
2057 return;
2058 }
2059
2060
2061 }
2062
2064
2066 {
2068 {
2069
2071 {
2073 }
2075 {
2078 {
2080 }
2081 else
2082 {
2084 {
2086 }
2087 else
2088 {
2090 }
2091 }
2092 }
2093 }
2094 }
2095
2096 }
2098 {
2099
2101 {
2103 {
2107 break;
2108
2112 break;
2113
2117 break;
2118
2122 break;
2123
2126 default:
2129 return;
2130 }
2131 }
2132
2134
2136 {
2138 {
2139
2141 {
2143 }
2144 }
2145 }
2146 }
2148 {
2149
2151 {
2153 {
2157 break;
2158
2161 default:
2164 return;
2165 }
2166 }
2167
2169
2171 {
2173 {
2174
2176 {
2178 }
2179 }
2180 }
2181 }
2182 else
2183 {
2184
2186
2188 {
2191
2192 }
2193 else
2194 {
2196 {
2199 }
2200 }
2201 }
2202 }
2203
2205 {
2206 if (
g_Game.IsHeadlessOrDedicatedServer())
2207 return;
2208
2210 {
2212 GetInventory().GetCurrentInventoryLocation(invLoc);
2214 {
2216 if (ptcMgr)
2217 {
2222 }
2223 }
2224 }
2226 {
2228 {
2231 return;
2232 }
2233
2235 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2237 {
2240 }
2241 }
2242 }
2243
2244 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2245 {
2247 {
2252 }
2253
2254 super.GetDebugActions(outputList);
2255 }
2256
2258 {
2259 super.OnAction(action_id, player, ctx);
2260
2262 {
2263 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2264 {
2266 if (food_stage_prev <= 0)
2267 {
2269 }
2271 return true;
2272 }
2273 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2274 {
2277 {
2279 }
2281 return true;
2282 }
2283
2284 }
2285
2286 #ifdef DIAG_DEVELOPER
2287 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2288 {
2289 PrintNutritionsData();
2290 return true;
2291 }
2292 #endif
2293
2294 return false;
2295 }
2296
2298 {
2299 string debug_output;
2300
2301 debug_output = super.GetDebugText();
2302
2305
2306 return debug_output;
2307 }
2308
2309
2310
2311
2312
2314 {
2315 float ret = super.GetBaitEffectivity();
2316
2318 {
2319 ret *= 0.5;
2320 }
2321
2322 return ret;
2323 }
2324
2326 {
2328 }
2329
2331 {
2333 }
2334
2336 {
2338 }
2339
2340 #ifdef DIAG_DEVELOPER
2341 private void PrintNutritionsData()
2342 {
2343 string nutritionsData = "";
2344
2347
2349 if (profile)
2350 {
2351 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2353 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2357 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2359
2362
2363 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2365 }
2366
2367 nutritionsData += "-----\n";
2368
2370 }
2371 #endif
2372
2374
2377 {
2379 }
2380}
2381
2383{
2385};
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.