1336{
1338
1346
1356
1358
1360 {
1362 {
1364
1366 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1367
1371 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1372 }
1373 }
1374
1376 {
1378
1380 }
1381
1383 {
1384 super.EEDelete(parent);
1385
1387
1390 }
1391
1393 {
1394 super.EEItemLocationChanged(oldLoc, newLoc);
1395
1398 {
1399 switch (oldLoc.GetParent().GetType())
1400 {
1401 case "FryingPan":
1402 case "Pot":
1403 case "Cauldron":
1404 case "SharpWoodenStick":
1406 break;
1407 }
1408
1411 {
1413 }
1414 }
1415
1416 if (oldLoc.IsValid())
1418
1421 }
1422
1424 {
1427 }
1428
1430 {
1433
1434 return true;
1435 }
1436
1438 {
1440 {
1442 }
1443 }
1444
1447 {
1448 int foodStageType;
1449
1451 if (foodStage)
1452 foodStageType = foodStage.GetFoodStageType();
1453
1458
1459 return agentsIn;
1460 }
1461
1462
1464 {
1465 return false;
1466 }
1467
1469 {
1470 return false;
1471 }
1472
1474 {
1476 {
1478 {
1481
1484
1485 default:
1486 return super.GetTemperatureFreezeTime();
1487 }
1488 }
1489
1490 return super.GetTemperatureFreezeTime();
1491 }
1492
1494 {
1496 {
1498 {
1501
1504
1505 default:
1506 return super.GetTemperatureThawTime();
1507 }
1508 }
1509
1510 return super.GetTemperatureThawTime();
1511 }
1512
1514 {
1516 }
1517
1518
1519
1520
1522 {
1523 SetSynchDirty();
1524 }
1525
1527 {
1528 super.OnVariablesSynchronized();
1529
1530
1531
1532
1534 {
1536 }
1537 else
1538 {
1540 }
1541
1544 }
1545
1546
1547
1548
1550 {
1553
1555 }
1556
1558 {
1559 string soundName = "";
1560
1563
1565 {
1567 }
1568 else
1569 {
1571 {
1573 {
1578 else
1579 soundName = "";
1580 break;
1581 }
1582
1584 {
1589 else
1590 soundName = "";
1591 break;
1592 }
1593
1595 {
1600 else
1601 soundName = "";
1602 break;
1603 }
1604
1605 default:
1606 soundName = "";
1607 break;
1608 }
1609
1611 {
1612 if (soundName == "")
1613 {
1615 }
1616 else
1617 {
1619 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1620 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1622 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1623 {
1625 }
1626 }
1627 }
1628 }
1629
1631 }
1632
1634 {
1637 }
1638
1639
1640
1641
1643 {
1644 super.OnStoreSave(ctx);
1645
1647 {
1649 }
1650
1651
1654 }
1655
1657 {
1658 if (!super.OnStoreLoad(ctx, version))
1659 return false;
1660
1662 {
1664 return false;
1665 }
1666
1667 if (version >= 115)
1668 {
1670 {
1672 return false;
1673 }
1675 {
1677 return false;
1678 }
1679 }
1680
1683
1684 return true;
1685 }
1686
1688 {
1689 super.AfterStoreLoad();
1690
1692 }
1693
1694
1696 {
1698 }
1699
1700
1702 {
1703 return false;
1704 }
1705
1707 {
1708 return false;
1709 }
1710
1712 {
1713 return false;
1714 }
1715
1717 {
1718 return false;
1719 }
1720
1721
1722
1723
1724
1726 {
1729 {
1730 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1731 }
1732 else if (classname != "" && food_stage)
1733 {
1734 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1735 }
1736 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1737 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1738
1739 }
1740
1742 {
1745 {
1747 }
1748 else if (classname != "" && food_stage)
1749 {
1750 return FoodStage.GetEnergy(null, food_stage, classname);
1751 }
1752 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1753 return g_Game.ConfigGetFloat( class_path +
" energy" );
1754 }
1755
1757 {
1760 {
1762 }
1763 else if (classname != "" && food_stage)
1764 {
1765 return FoodStage.GetWater(null, food_stage, classname);
1766 }
1767 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1768 return g_Game.ConfigGetFloat( class_path +
" water" );
1769 }
1770
1772 {
1775 {
1776 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1777 }
1778 else if (classname != "" && food_stage)
1779 {
1780 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1781 }
1782 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1783 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1784
1785 }
1786
1788 {
1791 {
1792 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1793 }
1794 else if (classname != "" && food_stage)
1795 {
1796 return FoodStage.GetToxicity(null, food_stage, classname);
1797 }
1798 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1799 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1800 }
1801
1803 {
1806 {
1808 }
1809 else if (classname != "" && food_stage)
1810 {
1811 return FoodStage.GetAgents(null, food_stage, classname);
1812 }
1813 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1814 return g_Game.ConfigGetInt( class_path +
" agents" );
1815 }
1816
1818 {
1821 {
1822 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1823 }
1824 else if (classname != "" && food_stage)
1825 {
1826 return FoodStage.GetDigestibility(null, food_stage, classname);
1827 }
1828 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1829 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1830 }
1831
1833 {
1836 {
1837 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1838 }
1839 else if (className != "" && foodStage)
1840 {
1841 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1842 }
1843 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1844 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1845 }
1846
1848 {
1858
1859 return profile;
1860 }
1861
1862
1863
1864
1866 {
1868 }
1869
1870
1872 {
1874 {
1876 }
1877
1878 return false;
1879 }
1880
1882 {
1884 {
1886 }
1887
1888 return false;
1889 }
1890
1892 {
1894 {
1896 }
1897
1898 return false;
1899 }
1900
1902 {
1904 {
1906 }
1907
1908 return false;
1909 }
1910
1912 {
1914 {
1916 }
1917
1918 return false;
1919 }
1920
1922 {
1924 {
1926 }
1927
1928 return false;
1929 }
1930
1931
1933 {
1935 }
1936
1938 {
1939 return GetFoodStage().GetNextFoodStageType( cooking_method );
1940 }
1941
1943 {
1944 return GetFoodStage().GetFoodStageName( food_stage_type );
1945 }
1946
1948 {
1949 return GetFoodStage().CanChangeToNewStage( cooking_method );
1950 }
1951
1952
1954 {
1955 if ( !source.GetFoodStage())
1956 return;
1961 }
1962
1965 {
1968 }
1969
1972 {
1973 switch (stageNew)
1974 {
1979 break;
1980
1983 break;
1984 }
1985 }
1986
1987
1988
1989
1990
1992 {
1994 }
1995
1997 {
1999
2000
2002 }
2003
2005 {
2007 {
2010 }
2011 }
2012
2013
2015 {
2017 if (player)
2018 {
2020 player.ServerReplaceItemInHandsWithNew(lambda);
2021 }
2022 else
2023 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2024 }
2025
2027 {
2029 }
2030
2032 {
2033 super.SetActions();
2034
2037 }
2038
2040 {
2041 #ifndef SERVER
2042 #ifndef NO_GUI
2044 {
2046
2049 }
2050 #endif
2051 #endif
2052 }
2053
2055 {
2056 #ifndef SERVER
2057 #ifndef NO_GUI
2059 {
2063 }
2064 #endif
2065 #endif
2066 }
2067
2069 {
2070 return false;
2071 }
2072
2074 {
2076 }
2077
2078 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2079 {
2081
2082 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2084 if ( hasRootAsPlayer )
2086
2087
2088
2089
2090
2091
2092
2094 {
2095
2097 {
2099 {
2103 break;
2104
2108 break;
2109
2113 break;
2114
2118 default:
2121 return;
2122 }
2123
2124
2125 }
2126
2128
2130 {
2132 {
2133
2135 {
2137 }
2139 {
2142 {
2144 }
2145 else
2146 {
2148 {
2150 }
2151 else
2152 {
2154 }
2155 }
2156 }
2157 }
2158 }
2159
2160 }
2162 {
2163
2165 {
2167 {
2171 break;
2172
2176 break;
2177
2181 break;
2182
2186 break;
2187
2190 default:
2193 return;
2194 }
2195 }
2196
2198
2200 {
2202 {
2203
2205 {
2207 }
2208 }
2209 }
2210 }
2212 {
2213
2215 {
2217 {
2221 break;
2222
2225 default:
2228 return;
2229 }
2230 }
2231
2233
2235 {
2237 {
2238
2240 {
2242 }
2243 }
2244 }
2245 }
2246 else
2247 {
2248
2250
2252 {
2255
2256 }
2257 else
2258 {
2260 {
2263 }
2264 }
2265 }
2266 }
2267
2269 {
2270 if (
g_Game.IsHeadlessOrDedicatedServer())
2271 return;
2272
2274 {
2276 GetInventory().GetCurrentInventoryLocation(invLoc);
2278 {
2280 if (ptcMgr)
2281 {
2286 }
2287 }
2288 }
2290 {
2292 {
2295 return;
2296 }
2297
2299 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2301 {
2304 }
2305 }
2306 }
2307
2308 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2309 {
2311 {
2316 }
2317
2318 super.GetDebugActions(outputList);
2319 }
2320
2322 {
2323 super.OnAction(action_id, player, ctx);
2324
2326 {
2327 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2328 {
2330 if (food_stage_prev <= 0)
2331 {
2333 }
2335 return true;
2336 }
2337 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2338 {
2341 {
2343 }
2345 return true;
2346 }
2347
2348 }
2349
2350 #ifdef DIAG_DEVELOPER
2351 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2352 {
2353 PrintNutritionsData();
2354 return true;
2355 }
2356 #endif
2357
2358 return false;
2359 }
2360
2362 {
2363 string debug_output;
2364
2365 debug_output = super.GetDebugText();
2366
2369
2370 return debug_output;
2371 }
2372
2373
2374
2375
2376
2378 {
2379 float ret = super.GetBaitEffectivity();
2380
2382 {
2383 ret *= 0.5;
2384 }
2385
2386 return ret;
2387 }
2388
2390 {
2392 }
2393
2395 {
2397 }
2398
2400 {
2402 }
2403
2404 #ifdef DIAG_DEVELOPER
2405 private void PrintNutritionsData()
2406 {
2407 string nutritionsData = "";
2408
2411
2413 if (profile)
2414 {
2415 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2417 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2421 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2423
2426
2427 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2429 }
2430
2431 nutritionsData += "-----\n";
2432
2434 }
2435 #endif
2436
2438
2441 {
2443 }
2444}
2445
2447{
2449};
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.