1596{
1598
1606
1616
1618
1620 {
1622 {
1624
1626 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1627
1631 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1632 }
1633 }
1634
1636 {
1638
1640 }
1641
1643 {
1644 super.EEDelete(parent);
1645
1647
1650 }
1651
1653 {
1654 super.EEItemLocationChanged(oldLoc, newLoc);
1655
1658 {
1659 switch (oldLoc.GetParent().GetType())
1660 {
1661 case "FryingPan":
1662 case "Pot":
1663 case "Cauldron":
1664 case "SharpWoodenStick":
1666 break;
1667 }
1668
1671 {
1673 }
1674 }
1675
1676 if (oldLoc.IsValid())
1678
1681 }
1682
1684 {
1687 }
1688
1690 {
1693
1694 return true;
1695 }
1696
1698 {
1700 {
1702 }
1703 }
1704
1707 {
1708 int foodStageType;
1709
1711 if (foodStage)
1712 foodStageType = foodStage.GetFoodStageType();
1713
1718
1719 return agentsIn;
1720 }
1721
1722
1724 {
1725 return false;
1726 }
1727
1729 {
1730 return false;
1731 }
1732
1734 {
1736 {
1738 {
1741
1744
1745 default:
1746 return super.GetTemperatureFreezeTime();
1747 }
1748 }
1749
1750 return super.GetTemperatureFreezeTime();
1751 }
1752
1754 {
1756 {
1758 {
1761
1764
1765 default:
1766 return super.GetTemperatureThawTime();
1767 }
1768 }
1769
1770 return super.GetTemperatureThawTime();
1771 }
1772
1774 {
1776 }
1777
1778
1779
1780
1782 {
1783 SetSynchDirty();
1784 }
1785
1787 {
1788 super.OnVariablesSynchronized();
1789
1790
1791
1792
1794 {
1796 }
1797 else
1798 {
1800 }
1801
1804 }
1805
1806
1807
1808
1810 {
1813
1815 }
1816
1818 {
1819 string soundName = "";
1820
1823
1825 {
1827 }
1828 else
1829 {
1831 {
1833 {
1838 else
1839 soundName = "";
1840 break;
1841 }
1842
1844 {
1849 else
1850 soundName = "";
1851 break;
1852 }
1853
1855 {
1860 else
1861 soundName = "";
1862 break;
1863 }
1864
1865 default:
1866 soundName = "";
1867 break;
1868 }
1869
1871 {
1872 if (soundName == "")
1873 {
1875 }
1876 else
1877 {
1879 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1880 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1882 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1883 {
1885 }
1886 }
1887 }
1888 }
1889
1891 }
1892
1894 {
1897 }
1898
1899
1900
1901
1903 {
1904 super.OnStoreSave(ctx);
1905
1907 {
1909 }
1910
1911
1914 }
1915
1917 {
1918 if (!super.OnStoreLoad(ctx, version))
1919 return false;
1920
1922 {
1924 return false;
1925 }
1926
1927 if (version >= 115)
1928 {
1930 {
1932 return false;
1933 }
1935 {
1937 return false;
1938 }
1939 }
1940
1943
1944 return true;
1945 }
1946
1948 {
1949 super.AfterStoreLoad();
1950
1952 }
1953
1954
1956 {
1958 }
1959
1960
1962 {
1963 return false;
1964 }
1965
1967 {
1968 return false;
1969 }
1970
1972 {
1973 return false;
1974 }
1975
1977 {
1978 return false;
1979 }
1980
1981
1982
1983
1984
1986 {
1989 {
1990 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1991 }
1992 else if (classname != "" && food_stage)
1993 {
1994 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1995 }
1996 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1997 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1998
1999 }
2000
2002 {
2005 {
2007 }
2008 else if (classname != "" && food_stage)
2009 {
2010 return FoodStage.GetEnergy(null, food_stage, classname);
2011 }
2012 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2013 return g_Game.ConfigGetFloat( class_path +
" energy" );
2014 }
2015
2017 {
2020 {
2022 }
2023 else if (classname != "" && food_stage)
2024 {
2025 return FoodStage.GetWater(null, food_stage, classname);
2026 }
2027 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2028 return g_Game.ConfigGetFloat( class_path +
" water" );
2029 }
2030
2032 {
2035 {
2036 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2037 }
2038 else if (classname != "" && food_stage)
2039 {
2040 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2041 }
2042 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2043 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2044
2045 }
2046
2048 {
2051 {
2052 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2053 }
2054 else if (classname != "" && food_stage)
2055 {
2056 return FoodStage.GetToxicity(null, food_stage, classname);
2057 }
2058 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2059 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2060 }
2061
2063 {
2066 {
2068 }
2069 else if (classname != "" && food_stage)
2070 {
2071 return FoodStage.GetAgents(null, food_stage, classname);
2072 }
2073 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2074 return g_Game.ConfigGetInt( class_path +
" agents" );
2075 }
2076
2078 {
2081 {
2082 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2083 }
2084 else if (classname != "" && food_stage)
2085 {
2086 return FoodStage.GetDigestibility(null, food_stage, classname);
2087 }
2088 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2089 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2090 }
2091
2093 {
2096 {
2097 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2098 }
2099 else if (className != "" && foodStage)
2100 {
2101 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2102 }
2103 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2104 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2105 }
2106
2108 {
2118
2119 return profile;
2120 }
2121
2122
2123
2124
2126 {
2128 }
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
2162 {
2164 {
2166 }
2167
2168 return false;
2169 }
2170
2172 {
2174 {
2176 }
2177
2178 return false;
2179 }
2180
2182 {
2184 {
2186 }
2187
2188 return false;
2189 }
2190
2191
2193 {
2195 }
2196
2198 {
2199 return GetFoodStage().GetNextFoodStageType( cooking_method );
2200 }
2201
2203 {
2204 return GetFoodStage().GetFoodStageName( food_stage_type );
2205 }
2206
2208 {
2209 return GetFoodStage().CanChangeToNewStage( cooking_method );
2210 }
2211
2212
2214 {
2215 if ( !source.GetFoodStage())
2216 return;
2221 }
2222
2225 {
2228 }
2229
2232 {
2233 switch (stageNew)
2234 {
2239 break;
2240
2243 break;
2244 }
2245 }
2246
2247
2248
2249
2250
2252 {
2254 }
2255
2257 {
2259
2260
2262 }
2263
2265 {
2267 {
2270 }
2271 }
2272
2273
2275 {
2277 if (player)
2278 {
2280 player.ServerReplaceItemInHandsWithNew(lambda);
2281 }
2282 else
2283 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2284 }
2285
2287 {
2289 }
2290
2292 {
2293 super.SetActions();
2294
2297 }
2298
2300 {
2301 #ifndef SERVER
2302 #ifndef NO_GUI
2304 {
2306
2309 }
2310 #endif
2311 #endif
2312 }
2313
2315 {
2316 #ifndef SERVER
2317 #ifndef NO_GUI
2319 {
2323 }
2324 #endif
2325 #endif
2326 }
2327
2329 {
2330 return false;
2331 }
2332
2334 {
2336 }
2337
2338 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2339 {
2341
2342 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2344 if ( hasRootAsPlayer )
2346
2347
2348
2349
2350
2351
2352
2354 {
2355
2357 {
2359 {
2363 break;
2364
2368 break;
2369
2373 break;
2374
2378 default:
2381 return;
2382 }
2383
2384
2385 }
2386
2388
2390 {
2392 {
2393
2395 {
2397 }
2399 {
2402 {
2404 }
2405 else
2406 {
2408 {
2410 }
2411 else
2412 {
2414 }
2415 }
2416 }
2417 }
2418 }
2419
2420 }
2422 {
2423
2425 {
2427 {
2431 break;
2432
2436 break;
2437
2441 break;
2442
2446 break;
2447
2450 default:
2453 return;
2454 }
2455 }
2456
2458
2460 {
2462 {
2463
2465 {
2467 }
2468 }
2469 }
2470 }
2472 {
2473
2475 {
2477 {
2481 break;
2482
2485 default:
2488 return;
2489 }
2490 }
2491
2493
2495 {
2497 {
2498
2500 {
2502 }
2503 }
2504 }
2505 }
2506 else
2507 {
2508
2510
2512 {
2515
2516 }
2517 else
2518 {
2520 {
2523 }
2524 }
2525 }
2526 }
2527
2529 {
2530 if (
g_Game.IsHeadlessOrDedicatedServer())
2531 return;
2532
2534 {
2536 GetInventory().GetCurrentInventoryLocation(invLoc);
2538 {
2540 if (ptcMgr)
2541 {
2546 }
2547 }
2548 }
2550 {
2552 {
2555 return;
2556 }
2557
2559 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2561 {
2564 }
2565 }
2566 }
2567
2568 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2569 {
2571 {
2576 }
2577
2578 super.GetDebugActions(outputList);
2579 }
2580
2582 {
2583 super.OnAction(action_id, player, ctx);
2584
2586 {
2587 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2588 {
2590 if (food_stage_prev <= 0)
2591 {
2593 }
2595 return true;
2596 }
2597 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2598 {
2601 {
2603 }
2605 return true;
2606 }
2607
2608 }
2609
2610 #ifdef DIAG_DEVELOPER
2611 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2612 {
2613 PrintNutritionsData();
2614 return true;
2615 }
2616 #endif
2617
2618 return false;
2619 }
2620
2622 {
2623 string debug_output;
2624
2625 debug_output = super.GetDebugText();
2626
2629
2630 return debug_output;
2631 }
2632
2633
2634
2635
2636
2638 {
2639 float ret = super.GetBaitEffectivity();
2640
2642 {
2643 ret *= 0.5;
2644 }
2645
2646 return ret;
2647 }
2648
2650 {
2652 }
2653
2655 {
2657 }
2658
2660 {
2662 }
2663
2664 #ifdef DIAG_DEVELOPER
2665 private void PrintNutritionsData()
2666 {
2667 string nutritionsData = "";
2668
2671
2673 if (profile)
2674 {
2675 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2677 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2681 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2683
2686
2687 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2689 }
2690
2691 nutritionsData += "-----\n";
2692
2694 }
2695 #endif
2696
2698
2701 {
2703 }
2704}
2705
2707{
2709};
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.