1743{
1745
1753
1763
1765
1767 {
1769 {
1771
1773 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1774
1778 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1779 }
1780 }
1781
1783 {
1785
1787 }
1788
1790 {
1791 super.EEDelete(parent);
1792
1794
1797 }
1798
1800 {
1801 super.EEItemLocationChanged(oldLoc, newLoc);
1802
1805 {
1806 switch (oldLoc.GetParent().GetType())
1807 {
1808 case "FryingPan":
1809 case "Pot":
1810 case "Cauldron":
1811 case "SharpWoodenStick":
1813 break;
1814 }
1815
1818 {
1820 }
1821 }
1822
1823 if (oldLoc.IsValid())
1825
1828 }
1829
1831 {
1834 }
1835
1837 {
1840
1841 return true;
1842 }
1843
1845 {
1847 {
1849 }
1850 }
1851
1854 {
1855 int foodStageType;
1856
1858 if (foodStage)
1859 foodStageType = foodStage.GetFoodStageType();
1860
1865
1866 return agentsIn;
1867 }
1868
1869
1871 {
1872 return false;
1873 }
1874
1876 {
1877 return false;
1878 }
1879
1881 {
1883 {
1885 {
1888
1891
1892 default:
1893 return super.GetTemperatureFreezeTime();
1894 }
1895 }
1896
1897 return super.GetTemperatureFreezeTime();
1898 }
1899
1901 {
1903 {
1905 {
1908
1911
1912 default:
1913 return super.GetTemperatureThawTime();
1914 }
1915 }
1916
1917 return super.GetTemperatureThawTime();
1918 }
1919
1921 {
1923 }
1924
1925
1926
1927
1929 {
1930 SetSynchDirty();
1931 }
1932
1934 {
1935 super.OnVariablesSynchronized();
1936
1937
1938
1939
1941 {
1943 }
1944 else
1945 {
1947 }
1948
1951 }
1952
1953
1954
1955
1957 {
1960
1962 }
1963
1965 {
1966 string soundName = "";
1967
1970
1972 {
1974 }
1975 else
1976 {
1978 {
1980 {
1985 else
1986 soundName = "";
1987 break;
1988 }
1989
1991 {
1996 else
1997 soundName = "";
1998 break;
1999 }
2000
2002 {
2007 else
2008 soundName = "";
2009 break;
2010 }
2011
2012 default:
2013 soundName = "";
2014 break;
2015 }
2016
2018 {
2019 if (soundName == "")
2020 {
2022 }
2023 else
2024 {
2026 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2027 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2029 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2030 {
2032 }
2033 }
2034 }
2035 }
2036
2038 }
2039
2041 {
2044 }
2045
2046
2047
2048
2050 {
2051 super.OnStoreSave(ctx);
2052
2054 {
2056 }
2057
2058
2061 }
2062
2064 {
2065 if (!super.OnStoreLoad(ctx, version))
2066 return false;
2067
2069 {
2071 return false;
2072 }
2073
2074 if (version >= 115)
2075 {
2077 {
2079 return false;
2080 }
2082 {
2084 return false;
2085 }
2086 }
2087
2090
2091 return true;
2092 }
2093
2095 {
2096 super.AfterStoreLoad();
2097
2099 }
2100
2101
2103 {
2105 }
2106
2107
2109 {
2110 return false;
2111 }
2112
2114 {
2115 return false;
2116 }
2117
2119 {
2120 return false;
2121 }
2122
2124 {
2125 return false;
2126 }
2127
2128
2129
2130
2131
2133 {
2136 {
2137 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2138 }
2139 else if (classname != "" && food_stage)
2140 {
2141 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2142 }
2143 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2144 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2145
2146 }
2147
2149 {
2152 {
2154 }
2155 else if (classname != "" && food_stage)
2156 {
2157 return FoodStage.GetEnergy(null, food_stage, classname);
2158 }
2159 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2160 return g_Game.ConfigGetFloat( class_path +
" energy" );
2161 }
2162
2164 {
2167 {
2169 }
2170 else if (classname != "" && food_stage)
2171 {
2172 return FoodStage.GetWater(null, food_stage, classname);
2173 }
2174 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2175 return g_Game.ConfigGetFloat( class_path +
" water" );
2176 }
2177
2179 {
2182 {
2183 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2184 }
2185 else if (classname != "" && food_stage)
2186 {
2187 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2188 }
2189 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2190 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2191
2192 }
2193
2195 {
2198 {
2199 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2200 }
2201 else if (classname != "" && food_stage)
2202 {
2203 return FoodStage.GetToxicity(null, food_stage, classname);
2204 }
2205 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2206 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2207 }
2208
2210 {
2213 {
2215 }
2216 else if (classname != "" && food_stage)
2217 {
2218 return FoodStage.GetAgents(null, food_stage, classname);
2219 }
2220 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2221 return g_Game.ConfigGetInt( class_path +
" agents" );
2222 }
2223
2225 {
2228 {
2229 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2230 }
2231 else if (classname != "" && food_stage)
2232 {
2233 return FoodStage.GetDigestibility(null, food_stage, classname);
2234 }
2235 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2236 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2237 }
2238
2240 {
2243 {
2244 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2245 }
2246 else if (className != "" && foodStage)
2247 {
2248 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2249 }
2250 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2251 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2252 }
2253
2255 {
2265
2266 return profile;
2267 }
2268
2269
2270
2271
2273 {
2275 }
2276
2277
2279 {
2281 {
2283 }
2284
2285 return false;
2286 }
2287
2289 {
2291 {
2293 }
2294
2295 return false;
2296 }
2297
2299 {
2301 {
2303 }
2304
2305 return false;
2306 }
2307
2309 {
2311 {
2313 }
2314
2315 return false;
2316 }
2317
2319 {
2321 {
2323 }
2324
2325 return false;
2326 }
2327
2329 {
2331 {
2333 }
2334
2335 return false;
2336 }
2337
2338
2340 {
2342 }
2343
2345 {
2346 return GetFoodStage().GetNextFoodStageType( cooking_method );
2347 }
2348
2350 {
2351 return GetFoodStage().GetFoodStageName( food_stage_type );
2352 }
2353
2355 {
2356 return GetFoodStage().CanChangeToNewStage( cooking_method );
2357 }
2358
2359
2361 {
2362 if ( !source.GetFoodStage())
2363 return;
2368 }
2369
2372 {
2375 }
2376
2379 {
2380 switch (stageNew)
2381 {
2386 break;
2387
2390 break;
2391 }
2392 }
2393
2394
2395
2396
2397
2399 {
2401 }
2402
2404 {
2406
2407
2409 }
2410
2412 {
2414 {
2417 }
2418 }
2419
2420
2422 {
2424 if (player)
2425 {
2427 player.ServerReplaceItemInHandsWithNew(lambda);
2428 }
2429 else
2430 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2431 }
2432
2434 {
2436 }
2437
2439 {
2440 super.SetActions();
2441
2444 }
2445
2447 {
2448 #ifndef SERVER
2449 #ifndef NO_GUI
2451 {
2453
2456 }
2457 #endif
2458 #endif
2459 }
2460
2462 {
2463 #ifndef SERVER
2464 #ifndef NO_GUI
2466 {
2470 }
2471 #endif
2472 #endif
2473 }
2474
2476 {
2477 return false;
2478 }
2479
2481 {
2483 }
2484
2485 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2486 {
2488
2489 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2491 if ( hasRootAsPlayer )
2493
2494
2495
2496
2497
2498
2499
2501 {
2502
2504 {
2506 {
2510 break;
2511
2515 break;
2516
2520 break;
2521
2525 default:
2528 return;
2529 }
2530
2531
2532 }
2533
2535
2537 {
2539 {
2540
2542 {
2544 }
2546 {
2549 {
2551 }
2552 else
2553 {
2555 {
2557 }
2558 else
2559 {
2561 }
2562 }
2563 }
2564 }
2565 }
2566
2567 }
2569 {
2570
2572 {
2574 {
2578 break;
2579
2583 break;
2584
2588 break;
2589
2593 break;
2594
2597 default:
2600 return;
2601 }
2602 }
2603
2605
2607 {
2609 {
2610
2612 {
2614 }
2615 }
2616 }
2617 }
2619 {
2620
2622 {
2624 {
2628 break;
2629
2632 default:
2635 return;
2636 }
2637 }
2638
2640
2642 {
2644 {
2645
2647 {
2649 }
2650 }
2651 }
2652 }
2653 else
2654 {
2655
2657
2659 {
2662
2663 }
2664 else
2665 {
2667 {
2670 }
2671 }
2672 }
2673 }
2674
2676 {
2677 if (
g_Game.IsHeadlessOrDedicatedServer())
2678 return;
2679
2681 {
2683 GetInventory().GetCurrentInventoryLocation(invLoc);
2685 {
2687 if (ptcMgr)
2688 {
2693 }
2694 }
2695 }
2697 {
2699 {
2702 return;
2703 }
2704
2706 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2708 {
2711 }
2712 }
2713 }
2714
2715 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2716 {
2718 {
2723 }
2724
2725 super.GetDebugActions(outputList);
2726 }
2727
2729 {
2730 super.OnAction(action_id, player, ctx);
2731
2733 {
2734 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2735 {
2737 if (food_stage_prev <= 0)
2738 {
2740 }
2742 return true;
2743 }
2744 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2745 {
2748 {
2750 }
2752 return true;
2753 }
2754
2755 }
2756
2757 #ifdef DIAG_DEVELOPER
2758 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2759 {
2760 PrintNutritionsData();
2761 return true;
2762 }
2763 #endif
2764
2765 return false;
2766 }
2767
2769 {
2770 string debug_output;
2771
2772 debug_output = super.GetDebugText();
2773
2776
2777 return debug_output;
2778 }
2779
2780
2781
2782
2783
2785 {
2786 float ret = super.GetBaitEffectivity();
2787
2789 {
2790 ret *= 0.5;
2791 }
2792
2793 return ret;
2794 }
2795
2797 {
2799 }
2800
2802 {
2804 }
2805
2807 {
2809 }
2810
2811 #ifdef DIAG_DEVELOPER
2812 private void PrintNutritionsData()
2813 {
2814 string nutritionsData = "";
2815
2818
2820 if (profile)
2821 {
2822 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2824 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2828 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2830
2833
2834 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2836 }
2837
2838 nutritionsData += "-----\n";
2839
2841 }
2842 #endif
2843
2845
2848 {
2850 }
2851}
2852
2854{
2856};
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.