1292{
1294
1302
1312
1314
1316 {
1318 {
1320
1322 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1323
1327 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1328 }
1329 }
1330
1332 {
1334
1336 }
1337
1339 {
1340 super.EEDelete(parent);
1341
1343
1346 }
1347
1349 {
1350 super.EEItemLocationChanged(oldLoc, newLoc);
1351
1354 {
1355 switch (oldLoc.GetParent().GetType())
1356 {
1357 case "FryingPan":
1358 case "Pot":
1359 case "Cauldron":
1360 case "SharpWoodenStick":
1362 break;
1363 }
1364
1367 {
1369 }
1370 }
1371
1372 if (oldLoc.IsValid())
1374
1377 }
1378
1380 {
1383 }
1384
1386 {
1389
1390 return true;
1391 }
1392
1394 {
1396 {
1398 }
1399 }
1400
1403 {
1404 int foodStageType;
1405
1407 if (foodStage)
1408 foodStageType = foodStage.GetFoodStageType();
1409
1414
1415 return agentsIn;
1416 }
1417
1418
1420 {
1421 return false;
1422 }
1423
1425 {
1426 return false;
1427 }
1428
1430 {
1432 {
1434 {
1437
1440
1441 default:
1442 return super.GetTemperatureFreezeTime();
1443 }
1444 }
1445
1446 return super.GetTemperatureFreezeTime();
1447 }
1448
1450 {
1452 {
1454 {
1457
1460
1461 default:
1462 return super.GetTemperatureThawTime();
1463 }
1464 }
1465
1466 return super.GetTemperatureThawTime();
1467 }
1468
1470 {
1472 }
1473
1474
1475
1476
1478 {
1479 SetSynchDirty();
1480 }
1481
1483 {
1484 super.OnVariablesSynchronized();
1485
1486
1487
1488
1490 {
1492 }
1493 else
1494 {
1496 }
1497
1500 }
1501
1502
1503
1504
1506 {
1509
1511 }
1512
1514 {
1515 string soundName = "";
1516
1519
1521 {
1523 }
1524 else
1525 {
1527 {
1529 {
1534 else
1535 soundName = "";
1536 break;
1537 }
1538
1540 {
1545 else
1546 soundName = "";
1547 break;
1548 }
1549
1551 {
1556 else
1557 soundName = "";
1558 break;
1559 }
1560
1561 default:
1562 soundName = "";
1563 break;
1564 }
1565
1567 {
1568 if (soundName == "")
1569 {
1571 }
1572 else
1573 {
1575 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1576 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1578 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1579 {
1581 }
1582 }
1583 }
1584 }
1585
1587 }
1588
1590 {
1593 }
1594
1595
1596
1597
1599 {
1600 super.OnStoreSave(ctx);
1601
1603 {
1605 }
1606
1607
1610 }
1611
1613 {
1614 if (!super.OnStoreLoad(ctx, version))
1615 return false;
1616
1618 {
1620 return false;
1621 }
1622
1623 if (version >= 115)
1624 {
1626 {
1628 return false;
1629 }
1631 {
1633 return false;
1634 }
1635 }
1636
1639
1640 return true;
1641 }
1642
1644 {
1645 super.AfterStoreLoad();
1646
1648 }
1649
1650
1652 {
1654 }
1655
1656
1658 {
1659 return false;
1660 }
1661
1663 {
1664 return false;
1665 }
1666
1668 {
1669 return false;
1670 }
1671
1673 {
1674 return false;
1675 }
1676
1677
1678
1679
1680
1682 {
1685 {
1686 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1687 }
1688 else if (classname != "" && food_stage)
1689 {
1690 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1691 }
1692 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1693 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1694
1695 }
1696
1698 {
1701 {
1703 }
1704 else if (classname != "" && food_stage)
1705 {
1706 return FoodStage.GetEnergy(null, food_stage, classname);
1707 }
1708 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1709 return g_Game.ConfigGetFloat( class_path +
" energy" );
1710 }
1711
1713 {
1716 {
1718 }
1719 else if (classname != "" && food_stage)
1720 {
1721 return FoodStage.GetWater(null, food_stage, classname);
1722 }
1723 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1724 return g_Game.ConfigGetFloat( class_path +
" water" );
1725 }
1726
1728 {
1731 {
1732 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1733 }
1734 else if (classname != "" && food_stage)
1735 {
1736 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1737 }
1738 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1739 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1740
1741 }
1742
1744 {
1747 {
1748 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1749 }
1750 else if (classname != "" && food_stage)
1751 {
1752 return FoodStage.GetToxicity(null, food_stage, classname);
1753 }
1754 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1755 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1756 }
1757
1759 {
1762 {
1764 }
1765 else if (classname != "" && food_stage)
1766 {
1767 return FoodStage.GetAgents(null, food_stage, classname);
1768 }
1769 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1770 return g_Game.ConfigGetInt( class_path +
" agents" );
1771 }
1772
1774 {
1777 {
1778 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1779 }
1780 else if (classname != "" && food_stage)
1781 {
1782 return FoodStage.GetDigestibility(null, food_stage, classname);
1783 }
1784 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1785 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1786 }
1787
1789 {
1792 {
1793 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1794 }
1795 else if (className != "" && foodStage)
1796 {
1797 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1798 }
1799 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1800 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1801 }
1802
1804 {
1814
1815 return profile;
1816 }
1817
1818
1819
1820
1822 {
1824 }
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
1868 {
1870 {
1872 }
1873
1874 return false;
1875 }
1876
1878 {
1880 {
1882 }
1883
1884 return false;
1885 }
1886
1887
1889 {
1891 }
1892
1894 {
1895 return GetFoodStage().GetNextFoodStageType( cooking_method );
1896 }
1897
1899 {
1900 return GetFoodStage().GetFoodStageName( food_stage_type );
1901 }
1902
1904 {
1905 return GetFoodStage().CanChangeToNewStage( cooking_method );
1906 }
1907
1908
1910 {
1911 if ( !source.GetFoodStage())
1912 return;
1917 }
1918
1921 {
1924 }
1925
1928 {
1929 switch (stageNew)
1930 {
1935 break;
1936
1939 break;
1940 }
1941 }
1942
1943
1944
1945
1946
1948 {
1950 }
1951
1953 {
1955
1956
1958 }
1959
1961 {
1963 {
1966 }
1967 }
1968
1969
1971 {
1973 if (player)
1974 {
1976 player.ServerReplaceItemInHandsWithNew(lambda);
1977 }
1978 else
1979 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1980 }
1981
1983 {
1985 }
1986
1988 {
1989 super.SetActions();
1990
1993 }
1994
1996 {
1997 #ifndef SERVER
1998 #ifndef NO_GUI
2000 {
2002
2005 }
2006 #endif
2007 #endif
2008 }
2009
2011 {
2012 #ifndef SERVER
2013 #ifndef NO_GUI
2015 {
2019 }
2020 #endif
2021 #endif
2022 }
2023
2025 {
2026 return false;
2027 }
2028
2030 {
2032 }
2033
2034 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2035 {
2037
2038 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2040 if ( hasRootAsPlayer )
2042
2043
2044
2045
2046
2047
2048
2050 {
2051
2053 {
2055 {
2059 break;
2060
2064 break;
2065
2069 break;
2070
2074 default:
2077 return;
2078 }
2079
2080
2081 }
2082
2084
2086 {
2088 {
2089
2091 {
2093 }
2095 {
2098 {
2100 }
2101 else
2102 {
2104 {
2106 }
2107 else
2108 {
2110 }
2111 }
2112 }
2113 }
2114 }
2115
2116 }
2118 {
2119
2121 {
2123 {
2127 break;
2128
2132 break;
2133
2137 break;
2138
2142 break;
2143
2146 default:
2149 return;
2150 }
2151 }
2152
2154
2156 {
2158 {
2159
2161 {
2163 }
2164 }
2165 }
2166 }
2168 {
2169
2171 {
2173 {
2177 break;
2178
2181 default:
2184 return;
2185 }
2186 }
2187
2189
2191 {
2193 {
2194
2196 {
2198 }
2199 }
2200 }
2201 }
2202 else
2203 {
2204
2206
2208 {
2211
2212 }
2213 else
2214 {
2216 {
2219 }
2220 }
2221 }
2222 }
2223
2225 {
2226 if (
g_Game.IsHeadlessOrDedicatedServer())
2227 return;
2228
2230 {
2232 GetInventory().GetCurrentInventoryLocation(invLoc);
2234 {
2236 if (ptcMgr)
2237 {
2242 }
2243 }
2244 }
2246 {
2248 {
2251 return;
2252 }
2253
2255 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2257 {
2260 }
2261 }
2262 }
2263
2264 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2265 {
2267 {
2272 }
2273
2274 super.GetDebugActions(outputList);
2275 }
2276
2278 {
2279 super.OnAction(action_id, player, ctx);
2280
2282 {
2283 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2284 {
2286 if (food_stage_prev <= 0)
2287 {
2289 }
2291 return true;
2292 }
2293 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2294 {
2297 {
2299 }
2301 return true;
2302 }
2303
2304 }
2305
2306 #ifdef DIAG_DEVELOPER
2307 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2308 {
2309 PrintNutritionsData();
2310 return true;
2311 }
2312 #endif
2313
2314 return false;
2315 }
2316
2318 {
2319 string debug_output;
2320
2321 debug_output = super.GetDebugText();
2322
2325
2326 return debug_output;
2327 }
2328
2329
2330
2331
2332
2334 {
2335 float ret = super.GetBaitEffectivity();
2336
2338 {
2339 ret *= 0.5;
2340 }
2341
2342 return ret;
2343 }
2344
2346 {
2348 }
2349
2351 {
2353 }
2354
2356 {
2358 }
2359
2360 #ifdef DIAG_DEVELOPER
2361 private void PrintNutritionsData()
2362 {
2363 string nutritionsData = "";
2364
2367
2369 if (profile)
2370 {
2371 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2373 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2377 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2379
2382
2383 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2385 }
2386
2387 nutritionsData += "-----\n";
2388
2390 }
2391 #endif
2392
2394
2397 {
2399 }
2400}
2401
2403{
2405};
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.