1810{
1812
1820
1830
1832
1834 {
1836 {
1838
1840 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1841
1845 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1846 }
1847 }
1848
1850 {
1852
1854 }
1855
1857 {
1858 super.EEDelete(parent);
1859
1861
1864 }
1865
1867 {
1868 super.EEItemLocationChanged(oldLoc, newLoc);
1869
1872 {
1873 switch (oldLoc.GetParent().GetType())
1874 {
1875 case "FryingPan":
1876 case "Pot":
1877 case "Cauldron":
1878 case "SharpWoodenStick":
1880 break;
1881 }
1882
1885 {
1887 }
1888 }
1889
1890 if (oldLoc.IsValid())
1892
1895 }
1896
1898 {
1901 }
1902
1904 {
1907
1908 return true;
1909 }
1910
1912 {
1914 {
1916 }
1917 }
1918
1921 {
1922 int foodStageType;
1923
1925 if (foodStage)
1926 foodStageType = foodStage.GetFoodStageType();
1927
1932
1933 return agentsIn;
1934 }
1935
1936
1938 {
1939 return false;
1940 }
1941
1943 {
1944 return false;
1945 }
1946
1948 {
1950 {
1952 {
1955
1958
1959 default:
1960 return super.GetTemperatureFreezeTime();
1961 }
1962 }
1963
1964 return super.GetTemperatureFreezeTime();
1965 }
1966
1968 {
1970 {
1972 {
1975
1978
1979 default:
1980 return super.GetTemperatureThawTime();
1981 }
1982 }
1983
1984 return super.GetTemperatureThawTime();
1985 }
1986
1988 {
1990 }
1991
1992
1993
1994
1996 {
1997 SetSynchDirty();
1998 }
1999
2001 {
2002 super.OnVariablesSynchronized();
2003
2004
2005
2006
2008 {
2010 }
2011 else
2012 {
2014 }
2015
2018 }
2019
2020
2021
2022
2024 {
2027
2029 }
2030
2032 {
2033 string soundName = "";
2034
2037
2039 {
2041 }
2042 else
2043 {
2045 {
2047 {
2052 else
2053 soundName = "";
2054 break;
2055 }
2056
2058 {
2063 else
2064 soundName = "";
2065 break;
2066 }
2067
2069 {
2074 else
2075 soundName = "";
2076 break;
2077 }
2078
2079 default:
2080 soundName = "";
2081 break;
2082 }
2083
2085 {
2086 if (soundName == "")
2087 {
2089 }
2090 else
2091 {
2093 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2094 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2096 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2097 {
2099 }
2100 }
2101 }
2102 }
2103
2105 }
2106
2108 {
2111 }
2112
2113
2114
2115
2117 {
2118 super.OnStoreSave(ctx);
2119
2121 {
2123 }
2124
2125
2128 }
2129
2131 {
2132 if (!super.OnStoreLoad(ctx, version))
2133 return false;
2134
2136 {
2138 return false;
2139 }
2140
2141 if (version >= 115)
2142 {
2144 {
2146 return false;
2147 }
2149 {
2151 return false;
2152 }
2153 }
2154
2157
2158 return true;
2159 }
2160
2162 {
2163 super.AfterStoreLoad();
2164
2166 }
2167
2168
2170 {
2172 }
2173
2174
2176 {
2177 return false;
2178 }
2179
2181 {
2182 return false;
2183 }
2184
2186 {
2187 return false;
2188 }
2189
2191 {
2192 return false;
2193 }
2194
2195
2196
2197
2198
2200 {
2203 {
2204 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2205 }
2206 else if (classname != "" && food_stage)
2207 {
2208 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2209 }
2210 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2211 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2212
2213 }
2214
2216 {
2219 {
2221 }
2222 else if (classname != "" && food_stage)
2223 {
2224 return FoodStage.GetEnergy(null, food_stage, classname);
2225 }
2226 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2227 return g_Game.ConfigGetFloat( class_path +
" energy" );
2228 }
2229
2231 {
2234 {
2236 }
2237 else if (classname != "" && food_stage)
2238 {
2239 return FoodStage.GetWater(null, food_stage, classname);
2240 }
2241 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2242 return g_Game.ConfigGetFloat( class_path +
" water" );
2243 }
2244
2246 {
2249 {
2250 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2251 }
2252 else if (classname != "" && food_stage)
2253 {
2254 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2255 }
2256 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2257 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2258
2259 }
2260
2262 {
2265 {
2266 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2267 }
2268 else if (classname != "" && food_stage)
2269 {
2270 return FoodStage.GetToxicity(null, food_stage, classname);
2271 }
2272 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2273 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2274 }
2275
2277 {
2280 {
2282 }
2283 else if (classname != "" && food_stage)
2284 {
2285 return FoodStage.GetAgents(null, food_stage, classname);
2286 }
2287 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2288 return g_Game.ConfigGetInt( class_path +
" agents" );
2289 }
2290
2292 {
2295 {
2296 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2297 }
2298 else if (classname != "" && food_stage)
2299 {
2300 return FoodStage.GetDigestibility(null, food_stage, classname);
2301 }
2302 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2303 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2304 }
2305
2307 {
2310 {
2311 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2312 }
2313 else if (className != "" && foodStage)
2314 {
2315 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2316 }
2317 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2318 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2319 }
2320
2322 {
2332
2333 return profile;
2334 }
2335
2336
2337
2338
2340 {
2342 }
2343
2344
2346 {
2348 {
2350 }
2351
2352 return false;
2353 }
2354
2356 {
2358 {
2360 }
2361
2362 return false;
2363 }
2364
2366 {
2368 {
2370 }
2371
2372 return false;
2373 }
2374
2376 {
2378 {
2380 }
2381
2382 return false;
2383 }
2384
2386 {
2388 {
2390 }
2391
2392 return false;
2393 }
2394
2396 {
2398 {
2400 }
2401
2402 return false;
2403 }
2404
2405
2407 {
2409 }
2410
2412 {
2413 return GetFoodStage().GetNextFoodStageType( cooking_method );
2414 }
2415
2417 {
2418 return GetFoodStage().GetFoodStageName( food_stage_type );
2419 }
2420
2422 {
2423 return GetFoodStage().CanChangeToNewStage( cooking_method );
2424 }
2425
2426
2428 {
2429 if ( !source.GetFoodStage())
2430 return;
2435 }
2436
2439 {
2442 }
2443
2446 {
2447 switch (stageNew)
2448 {
2453 break;
2454
2457 break;
2458 }
2459 }
2460
2461
2462
2463
2464
2466 {
2468 }
2469
2471 {
2473
2474
2476 }
2477
2479 {
2481 {
2484 }
2485 }
2486
2487
2489 {
2491 if (player)
2492 {
2494 player.ServerReplaceItemInHandsWithNew(lambda);
2495 }
2496 else
2497 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2498 }
2499
2501 {
2503 }
2504
2506 {
2507 super.SetActions();
2508
2511 }
2512
2514 {
2515 #ifndef SERVER
2516 #ifndef NO_GUI
2518 {
2520
2523 }
2524 #endif
2525 #endif
2526 }
2527
2529 {
2530 #ifndef SERVER
2531 #ifndef NO_GUI
2533 {
2537 }
2538 #endif
2539 #endif
2540 }
2541
2543 {
2544 return false;
2545 }
2546
2548 {
2550 }
2551
2552 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2553 {
2555
2556 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2558 if ( hasRootAsPlayer )
2560
2561
2562
2563
2564
2565
2566
2568 {
2569
2571 {
2573 {
2577 break;
2578
2582 break;
2583
2587 break;
2588
2592 default:
2595 return;
2596 }
2597
2598
2599 }
2600
2602
2604 {
2606 {
2607
2609 {
2611 }
2613 {
2616 {
2618 }
2619 else
2620 {
2622 {
2624 }
2625 else
2626 {
2628 }
2629 }
2630 }
2631 }
2632 }
2633
2634 }
2636 {
2637
2639 {
2641 {
2645 break;
2646
2650 break;
2651
2655 break;
2656
2660 break;
2661
2664 default:
2667 return;
2668 }
2669 }
2670
2672
2674 {
2676 {
2677
2679 {
2681 }
2682 }
2683 }
2684 }
2686 {
2687
2689 {
2691 {
2695 break;
2696
2699 default:
2702 return;
2703 }
2704 }
2705
2707
2709 {
2711 {
2712
2714 {
2716 }
2717 }
2718 }
2719 }
2720 else
2721 {
2722
2724
2726 {
2729
2730 }
2731 else
2732 {
2734 {
2737 }
2738 }
2739 }
2740 }
2741
2743 {
2744 if (
g_Game.IsHeadlessOrDedicatedServer())
2745 return;
2746
2748 {
2750 GetInventory().GetCurrentInventoryLocation(invLoc);
2752 {
2754 if (ptcMgr)
2755 {
2760 }
2761 }
2762 }
2764 {
2766 {
2769 return;
2770 }
2771
2773 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2775 {
2778 }
2779 }
2780 }
2781
2782 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2783 {
2785 {
2790 }
2791
2792 super.GetDebugActions(outputList);
2793 }
2794
2796 {
2797 super.OnAction(action_id, player, ctx);
2798
2800 {
2801 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2802 {
2804 if (food_stage_prev <= 0)
2805 {
2807 }
2809 return true;
2810 }
2811 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2812 {
2815 {
2817 }
2819 return true;
2820 }
2821
2822 }
2823
2824 #ifdef DIAG_DEVELOPER
2825 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2826 {
2827 PrintNutritionsData();
2828 return true;
2829 }
2830 #endif
2831
2832 return false;
2833 }
2834
2836 {
2837 string debug_output;
2838
2839 debug_output = super.GetDebugText();
2840
2843
2844 return debug_output;
2845 }
2846
2847
2848
2849
2850
2852 {
2853 float ret = super.GetBaitEffectivity();
2854
2856 {
2857 ret *= 0.5;
2858 }
2859
2860 return ret;
2861 }
2862
2864 {
2866 }
2867
2869 {
2871 }
2872
2874 {
2876 }
2877
2878 #ifdef DIAG_DEVELOPER
2879 private void PrintNutritionsData()
2880 {
2881 string nutritionsData = "";
2882
2885
2887 if (profile)
2888 {
2889 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2891 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2895 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2897
2900
2901 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2903 }
2904
2905 nutritionsData += "-----\n";
2906
2908 }
2909 #endif
2910
2912
2915 {
2917 }
2918}
2919
2921{
2923};
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.