1833{
1835
1843
1853
1855
1857 {
1859 {
1861
1863 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1864
1868 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1869 }
1870 }
1871
1873 {
1875
1877 }
1878
1880 {
1881 super.EEDelete(parent);
1882
1884
1887 }
1888
1890 {
1891 super.EEItemLocationChanged(oldLoc, newLoc);
1892
1895 {
1896 switch (oldLoc.GetParent().GetType())
1897 {
1898 case "FryingPan":
1899 case "Pot":
1900 case "Cauldron":
1901 case "SharpWoodenStick":
1903 break;
1904 }
1905
1908 {
1910 }
1911 }
1912
1913 if (oldLoc.IsValid())
1915
1918 }
1919
1921 {
1924 }
1925
1927 {
1930
1931 return true;
1932 }
1933
1935 {
1937 {
1939 }
1940 }
1941
1944 {
1945 int foodStageType;
1946
1948 if (foodStage)
1949 foodStageType = foodStage.GetFoodStageType();
1950
1955
1956 return agentsIn;
1957 }
1958
1959
1961 {
1962 return false;
1963 }
1964
1966 {
1967 return false;
1968 }
1969
1971 {
1973 {
1975 {
1978
1981
1982 default:
1983 return super.GetTemperatureFreezeTime();
1984 }
1985 }
1986
1987 return super.GetTemperatureFreezeTime();
1988 }
1989
1991 {
1993 {
1995 {
1998
2001
2002 default:
2003 return super.GetTemperatureThawTime();
2004 }
2005 }
2006
2007 return super.GetTemperatureThawTime();
2008 }
2009
2011 {
2013 }
2014
2015
2016
2017
2019 {
2020 SetSynchDirty();
2021 }
2022
2024 {
2025 super.OnVariablesSynchronized();
2026
2027
2028
2029
2031 {
2033 }
2034 else
2035 {
2037 }
2038
2041 }
2042
2043
2044
2045
2047 {
2050
2052 }
2053
2055 {
2056 string soundName = "";
2057
2060
2062 {
2064 }
2065 else
2066 {
2068 {
2070 {
2075 else
2076 soundName = "";
2077 break;
2078 }
2079
2081 {
2086 else
2087 soundName = "";
2088 break;
2089 }
2090
2092 {
2097 else
2098 soundName = "";
2099 break;
2100 }
2101
2102 default:
2103 soundName = "";
2104 break;
2105 }
2106
2108 {
2109 if (soundName == "")
2110 {
2112 }
2113 else
2114 {
2116 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2117 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2119 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2120 {
2122 }
2123 }
2124 }
2125 }
2126
2128 }
2129
2131 {
2134 }
2135
2136
2137
2138
2140 {
2141 super.OnStoreSave(ctx);
2142
2144 {
2146 }
2147
2148
2151 }
2152
2154 {
2155 if (!super.OnStoreLoad(ctx, version))
2156 return false;
2157
2159 {
2161 return false;
2162 }
2163
2164 if (version >= 115)
2165 {
2167 {
2169 return false;
2170 }
2172 {
2174 return false;
2175 }
2176 }
2177
2180
2181 return true;
2182 }
2183
2185 {
2186 super.AfterStoreLoad();
2187
2189 }
2190
2191
2193 {
2195 }
2196
2197
2199 {
2200 return false;
2201 }
2202
2204 {
2205 return false;
2206 }
2207
2209 {
2210 return false;
2211 }
2212
2214 {
2215 return false;
2216 }
2217
2218
2219
2220
2221
2223 {
2226 {
2227 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2228 }
2229 else if (classname != "" && food_stage)
2230 {
2231 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2232 }
2233 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2234 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2235
2236 }
2237
2239 {
2242 {
2244 }
2245 else if (classname != "" && food_stage)
2246 {
2247 return FoodStage.GetEnergy(null, food_stage, classname);
2248 }
2249 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2250 return g_Game.ConfigGetFloat( class_path +
" energy" );
2251 }
2252
2254 {
2257 {
2259 }
2260 else if (classname != "" && food_stage)
2261 {
2262 return FoodStage.GetWater(null, food_stage, classname);
2263 }
2264 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2265 return g_Game.ConfigGetFloat( class_path +
" water" );
2266 }
2267
2269 {
2272 {
2273 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2274 }
2275 else if (classname != "" && food_stage)
2276 {
2277 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2278 }
2279 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2280 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2281
2282 }
2283
2285 {
2288 {
2289 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2290 }
2291 else if (classname != "" && food_stage)
2292 {
2293 return FoodStage.GetToxicity(null, food_stage, classname);
2294 }
2295 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2296 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2297 }
2298
2300 {
2303 {
2305 }
2306 else if (classname != "" && food_stage)
2307 {
2308 return FoodStage.GetAgents(null, food_stage, classname);
2309 }
2310 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2311 return g_Game.ConfigGetInt( class_path +
" agents" );
2312 }
2313
2315 {
2318 {
2319 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2320 }
2321 else if (classname != "" && food_stage)
2322 {
2323 return FoodStage.GetDigestibility(null, food_stage, classname);
2324 }
2325 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2326 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2327 }
2328
2330 {
2333 {
2334 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2335 }
2336 else if (className != "" && foodStage)
2337 {
2338 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2339 }
2340 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2341 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2342 }
2343
2345 {
2355
2356 return profile;
2357 }
2358
2359
2360
2361
2363 {
2365 }
2366
2367
2369 {
2371 {
2373 }
2374
2375 return false;
2376 }
2377
2379 {
2381 {
2383 }
2384
2385 return false;
2386 }
2387
2389 {
2391 {
2393 }
2394
2395 return false;
2396 }
2397
2399 {
2401 {
2403 }
2404
2405 return false;
2406 }
2407
2409 {
2411 {
2413 }
2414
2415 return false;
2416 }
2417
2419 {
2421 {
2423 }
2424
2425 return false;
2426 }
2427
2428
2430 {
2432 }
2433
2435 {
2436 return GetFoodStage().GetNextFoodStageType( cooking_method );
2437 }
2438
2440 {
2441 return GetFoodStage().GetFoodStageName( food_stage_type );
2442 }
2443
2445 {
2446 return GetFoodStage().CanChangeToNewStage( cooking_method );
2447 }
2448
2449
2451 {
2452 if ( !source.GetFoodStage())
2453 return;
2458 }
2459
2462 {
2465 }
2466
2469 {
2470 switch (stageNew)
2471 {
2476 break;
2477
2480 break;
2481 }
2482 }
2483
2484
2485
2486
2487
2489 {
2491 }
2492
2494 {
2496
2497
2499 }
2500
2502 {
2504 {
2507 }
2508 }
2509
2510
2512 {
2514 if (player)
2515 {
2517 player.ServerReplaceItemInHandsWithNew(lambda);
2518 }
2519 else
2520 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2521 }
2522
2524 {
2526 }
2527
2529 {
2530 super.SetActions();
2531
2534 }
2535
2537 {
2538 #ifndef SERVER
2539 #ifndef NO_GUI
2541 {
2543
2546 }
2547 #endif
2548 #endif
2549 }
2550
2552 {
2553 #ifndef SERVER
2554 #ifndef NO_GUI
2556 {
2560 }
2561 #endif
2562 #endif
2563 }
2564
2566 {
2567 return false;
2568 }
2569
2571 {
2573 }
2574
2575 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2576 {
2578
2579 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2581 if ( hasRootAsPlayer )
2583
2584
2585
2586
2587
2588
2589
2591 {
2592
2594 {
2596 {
2600 break;
2601
2605 break;
2606
2610 break;
2611
2615 default:
2618 return;
2619 }
2620
2621
2622 }
2623
2625
2627 {
2629 {
2630
2632 {
2634 }
2636 {
2639 {
2641 }
2642 else
2643 {
2645 {
2647 }
2648 else
2649 {
2651 }
2652 }
2653 }
2654 }
2655 }
2656
2657 }
2659 {
2660
2662 {
2664 {
2668 break;
2669
2673 break;
2674
2678 break;
2679
2683 break;
2684
2687 default:
2690 return;
2691 }
2692 }
2693
2695
2697 {
2699 {
2700
2702 {
2704 }
2705 }
2706 }
2707 }
2709 {
2710
2712 {
2714 {
2718 break;
2719
2722 default:
2725 return;
2726 }
2727 }
2728
2730
2732 {
2734 {
2735
2737 {
2739 }
2740 }
2741 }
2742 }
2743 else
2744 {
2745
2747
2749 {
2752
2753 }
2754 else
2755 {
2757 {
2760 }
2761 }
2762 }
2763 }
2764
2766 {
2767 if (
g_Game.IsHeadlessOrDedicatedServer())
2768 return;
2769
2771 {
2773 GetInventory().GetCurrentInventoryLocation(invLoc);
2775 {
2777 if (ptcMgr)
2778 {
2783 }
2784 }
2785 }
2787 {
2789 {
2792 return;
2793 }
2794
2796 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2798 {
2801 }
2802 }
2803 }
2804
2805 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2806 {
2808 {
2813 }
2814
2815 super.GetDebugActions(outputList);
2816 }
2817
2819 {
2820 super.OnAction(action_id, player, ctx);
2821
2823 {
2824 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2825 {
2827 if (food_stage_prev <= 0)
2828 {
2830 }
2832 return true;
2833 }
2834 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2835 {
2838 {
2840 }
2842 return true;
2843 }
2844
2845 }
2846
2847 #ifdef DIAG_DEVELOPER
2848 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2849 {
2850 PrintNutritionsData();
2851 return true;
2852 }
2853 #endif
2854
2855 return false;
2856 }
2857
2859 {
2860 string debug_output;
2861
2862 debug_output = super.GetDebugText();
2863
2866
2867 return debug_output;
2868 }
2869
2870
2871
2872
2873
2875 {
2876 float ret = super.GetBaitEffectivity();
2877
2879 {
2880 ret *= 0.5;
2881 }
2882
2883 return ret;
2884 }
2885
2887 {
2889 }
2890
2892 {
2894 }
2895
2897 {
2899 }
2900
2901 #ifdef DIAG_DEVELOPER
2902 private void PrintNutritionsData()
2903 {
2904 string nutritionsData = "";
2905
2908
2910 if (profile)
2911 {
2912 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2914 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2918 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2920
2923
2924 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2926 }
2927
2928 nutritionsData += "-----\n";
2929
2931 }
2932 #endif
2933
2935
2938 {
2940 }
2941}
2942
2944{
2946};
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.