1566{
1568
1576
1586
1588
1590 {
1592 {
1594
1596 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1597
1601 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1602 }
1603 }
1604
1606 {
1608
1610 }
1611
1613 {
1614 super.EEDelete(parent);
1615
1617
1620 }
1621
1623 {
1624 super.EEItemLocationChanged(oldLoc, newLoc);
1625
1628 {
1629 switch (oldLoc.GetParent().GetType())
1630 {
1631 case "FryingPan":
1632 case "Pot":
1633 case "Cauldron":
1634 case "SharpWoodenStick":
1636 break;
1637 }
1638
1641 {
1643 }
1644 }
1645
1646 if (oldLoc.IsValid())
1648
1651 }
1652
1654 {
1657 }
1658
1660 {
1663
1664 return true;
1665 }
1666
1668 {
1670 {
1672 }
1673 }
1674
1677 {
1678 int foodStageType;
1679
1681 if (foodStage)
1682 foodStageType = foodStage.GetFoodStageType();
1683
1688
1689 return agentsIn;
1690 }
1691
1692
1694 {
1695 return false;
1696 }
1697
1699 {
1700 return false;
1701 }
1702
1704 {
1706 {
1708 {
1711
1714
1715 default:
1716 return super.GetTemperatureFreezeTime();
1717 }
1718 }
1719
1720 return super.GetTemperatureFreezeTime();
1721 }
1722
1724 {
1726 {
1728 {
1731
1734
1735 default:
1736 return super.GetTemperatureThawTime();
1737 }
1738 }
1739
1740 return super.GetTemperatureThawTime();
1741 }
1742
1744 {
1746 }
1747
1748
1749
1750
1752 {
1753 SetSynchDirty();
1754 }
1755
1757 {
1758 super.OnVariablesSynchronized();
1759
1760
1761
1762
1764 {
1766 }
1767 else
1768 {
1770 }
1771
1774 }
1775
1776
1777
1778
1780 {
1783
1785 }
1786
1788 {
1789 string soundName = "";
1790
1793
1795 {
1797 }
1798 else
1799 {
1801 {
1803 {
1808 else
1809 soundName = "";
1810 break;
1811 }
1812
1814 {
1819 else
1820 soundName = "";
1821 break;
1822 }
1823
1825 {
1830 else
1831 soundName = "";
1832 break;
1833 }
1834
1835 default:
1836 soundName = "";
1837 break;
1838 }
1839
1841 {
1842 if (soundName == "")
1843 {
1845 }
1846 else
1847 {
1849 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1850 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1852 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1853 {
1855 }
1856 }
1857 }
1858 }
1859
1861 }
1862
1864 {
1867 }
1868
1869
1870
1871
1873 {
1874 super.OnStoreSave(ctx);
1875
1877 {
1879 }
1880
1881
1884 }
1885
1887 {
1888 if (!super.OnStoreLoad(ctx, version))
1889 return false;
1890
1892 {
1894 return false;
1895 }
1896
1897 if (version >= 115)
1898 {
1900 {
1902 return false;
1903 }
1905 {
1907 return false;
1908 }
1909 }
1910
1913
1914 return true;
1915 }
1916
1918 {
1919 super.AfterStoreLoad();
1920
1922 }
1923
1924
1926 {
1928 }
1929
1930
1932 {
1933 return false;
1934 }
1935
1937 {
1938 return false;
1939 }
1940
1942 {
1943 return false;
1944 }
1945
1947 {
1948 return false;
1949 }
1950
1951
1952
1953
1954
1956 {
1959 {
1960 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1961 }
1962 else if (classname != "" && food_stage)
1963 {
1964 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1965 }
1966 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1967 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1968
1969 }
1970
1972 {
1975 {
1977 }
1978 else if (classname != "" && food_stage)
1979 {
1980 return FoodStage.GetEnergy(null, food_stage, classname);
1981 }
1982 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1983 return g_Game.ConfigGetFloat( class_path +
" energy" );
1984 }
1985
1987 {
1990 {
1992 }
1993 else if (classname != "" && food_stage)
1994 {
1995 return FoodStage.GetWater(null, food_stage, classname);
1996 }
1997 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1998 return g_Game.ConfigGetFloat( class_path +
" water" );
1999 }
2000
2002 {
2005 {
2006 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2007 }
2008 else if (classname != "" && food_stage)
2009 {
2010 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2011 }
2012 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2013 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2014
2015 }
2016
2018 {
2021 {
2022 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2023 }
2024 else if (classname != "" && food_stage)
2025 {
2026 return FoodStage.GetToxicity(null, food_stage, classname);
2027 }
2028 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2029 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2030 }
2031
2033 {
2036 {
2038 }
2039 else if (classname != "" && food_stage)
2040 {
2041 return FoodStage.GetAgents(null, food_stage, classname);
2042 }
2043 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2044 return g_Game.ConfigGetInt( class_path +
" agents" );
2045 }
2046
2048 {
2051 {
2052 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2053 }
2054 else if (classname != "" && food_stage)
2055 {
2056 return FoodStage.GetDigestibility(null, food_stage, classname);
2057 }
2058 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2059 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2060 }
2061
2063 {
2066 {
2067 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2068 }
2069 else if (className != "" && foodStage)
2070 {
2071 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2072 }
2073 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2074 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2075 }
2076
2078 {
2088
2089 return profile;
2090 }
2091
2092
2093
2094
2096 {
2098 }
2099
2100
2102 {
2104 {
2106 }
2107
2108 return false;
2109 }
2110
2112 {
2114 {
2116 }
2117
2118 return false;
2119 }
2120
2122 {
2124 {
2126 }
2127
2128 return false;
2129 }
2130
2132 {
2134 {
2136 }
2137
2138 return false;
2139 }
2140
2142 {
2144 {
2146 }
2147
2148 return false;
2149 }
2150
2152 {
2154 {
2156 }
2157
2158 return false;
2159 }
2160
2161
2163 {
2165 }
2166
2168 {
2169 return GetFoodStage().GetNextFoodStageType( cooking_method );
2170 }
2171
2173 {
2174 return GetFoodStage().GetFoodStageName( food_stage_type );
2175 }
2176
2178 {
2179 return GetFoodStage().CanChangeToNewStage( cooking_method );
2180 }
2181
2182
2184 {
2185 if ( !source.GetFoodStage())
2186 return;
2191 }
2192
2195 {
2198 }
2199
2202 {
2203 switch (stageNew)
2204 {
2209 break;
2210
2213 break;
2214 }
2215 }
2216
2217
2218
2219
2220
2222 {
2224 }
2225
2227 {
2229
2230
2232 }
2233
2235 {
2237 {
2240 }
2241 }
2242
2243
2245 {
2247 if (player)
2248 {
2250 player.ServerReplaceItemInHandsWithNew(lambda);
2251 }
2252 else
2253 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2254 }
2255
2257 {
2259 }
2260
2262 {
2263 super.SetActions();
2264
2267 }
2268
2270 {
2271 #ifndef SERVER
2272 #ifndef NO_GUI
2274 {
2276
2279 }
2280 #endif
2281 #endif
2282 }
2283
2285 {
2286 #ifndef SERVER
2287 #ifndef NO_GUI
2289 {
2293 }
2294 #endif
2295 #endif
2296 }
2297
2299 {
2300 return false;
2301 }
2302
2304 {
2306 }
2307
2308 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2309 {
2311
2312 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2314 if ( hasRootAsPlayer )
2316
2317
2318
2319
2320
2321
2322
2324 {
2325
2327 {
2329 {
2333 break;
2334
2338 break;
2339
2343 break;
2344
2348 default:
2351 return;
2352 }
2353
2354
2355 }
2356
2358
2360 {
2362 {
2363
2365 {
2367 }
2369 {
2372 {
2374 }
2375 else
2376 {
2378 {
2380 }
2381 else
2382 {
2384 }
2385 }
2386 }
2387 }
2388 }
2389
2390 }
2392 {
2393
2395 {
2397 {
2401 break;
2402
2406 break;
2407
2411 break;
2412
2416 break;
2417
2420 default:
2423 return;
2424 }
2425 }
2426
2428
2430 {
2432 {
2433
2435 {
2437 }
2438 }
2439 }
2440 }
2442 {
2443
2445 {
2447 {
2451 break;
2452
2455 default:
2458 return;
2459 }
2460 }
2461
2463
2465 {
2467 {
2468
2470 {
2472 }
2473 }
2474 }
2475 }
2476 else
2477 {
2478
2480
2482 {
2485
2486 }
2487 else
2488 {
2490 {
2493 }
2494 }
2495 }
2496 }
2497
2499 {
2500 if (
g_Game.IsHeadlessOrDedicatedServer())
2501 return;
2502
2504 {
2506 GetInventory().GetCurrentInventoryLocation(invLoc);
2508 {
2510 if (ptcMgr)
2511 {
2516 }
2517 }
2518 }
2520 {
2522 {
2525 return;
2526 }
2527
2529 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2531 {
2534 }
2535 }
2536 }
2537
2538 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2539 {
2541 {
2546 }
2547
2548 super.GetDebugActions(outputList);
2549 }
2550
2552 {
2553 super.OnAction(action_id, player, ctx);
2554
2556 {
2557 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2558 {
2560 if (food_stage_prev <= 0)
2561 {
2563 }
2565 return true;
2566 }
2567 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2568 {
2571 {
2573 }
2575 return true;
2576 }
2577
2578 }
2579
2580 #ifdef DIAG_DEVELOPER
2581 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2582 {
2583 PrintNutritionsData();
2584 return true;
2585 }
2586 #endif
2587
2588 return false;
2589 }
2590
2592 {
2593 string debug_output;
2594
2595 debug_output = super.GetDebugText();
2596
2599
2600 return debug_output;
2601 }
2602
2603
2604
2605
2606
2608 {
2609 float ret = super.GetBaitEffectivity();
2610
2612 {
2613 ret *= 0.5;
2614 }
2615
2616 return ret;
2617 }
2618
2620 {
2622 }
2623
2625 {
2627 }
2628
2630 {
2632 }
2633
2634 #ifdef DIAG_DEVELOPER
2635 private void PrintNutritionsData()
2636 {
2637 string nutritionsData = "";
2638
2641
2643 if (profile)
2644 {
2645 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2647 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2651 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2653
2656
2657 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2659 }
2660
2661 nutritionsData += "-----\n";
2662
2664 }
2665 #endif
2666
2668
2671 {
2673 }
2674}
2675
2677{
2679};
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.