1847{
1849
1857
1867
1869
1871 {
1873 {
1875
1877 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1878
1882 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1883 }
1884 }
1885
1887 {
1889
1891 }
1892
1894 {
1895 super.EEDelete(parent);
1896
1898
1901 }
1902
1904 {
1905 super.EEItemLocationChanged(oldLoc, newLoc);
1906
1909 {
1910 switch (oldLoc.GetParent().GetType())
1911 {
1912 case "FryingPan":
1913 case "Pot":
1914 case "Cauldron":
1915 case "SharpWoodenStick":
1917 break;
1918 }
1919
1922 {
1924 }
1925 }
1926
1927 if (oldLoc.IsValid())
1929
1932 }
1933
1935 {
1938 }
1939
1941 {
1944
1945 return true;
1946 }
1947
1949 {
1951 {
1953 }
1954 }
1955
1958 {
1959 int foodStageType;
1960
1962 if (foodStage)
1963 foodStageType = foodStage.GetFoodStageType();
1964
1969
1970 return agentsIn;
1971 }
1972
1973
1975 {
1976 return false;
1977 }
1978
1980 {
1981 return false;
1982 }
1983
1985 {
1987 {
1989 {
1992
1995
1996 default:
1997 return super.GetTemperatureFreezeTime();
1998 }
1999 }
2000
2001 return super.GetTemperatureFreezeTime();
2002 }
2003
2005 {
2007 {
2009 {
2012
2015
2016 default:
2017 return super.GetTemperatureThawTime();
2018 }
2019 }
2020
2021 return super.GetTemperatureThawTime();
2022 }
2023
2025 {
2027 }
2028
2029
2030
2031
2033 {
2034 SetSynchDirty();
2035 }
2036
2038 {
2039 super.OnVariablesSynchronized();
2040
2041
2042
2043
2045 {
2047 }
2048 else
2049 {
2051 }
2052
2055 }
2056
2057
2058
2059
2061 {
2064
2066 }
2067
2069 {
2070 string soundName = "";
2071
2074
2076 {
2078 }
2079 else
2080 {
2082 {
2084 {
2089 else
2090 soundName = "";
2091 break;
2092 }
2093
2095 {
2100 else
2101 soundName = "";
2102 break;
2103 }
2104
2106 {
2111 else
2112 soundName = "";
2113 break;
2114 }
2115
2116 default:
2117 soundName = "";
2118 break;
2119 }
2120
2122 {
2123 if (soundName == "")
2124 {
2126 }
2127 else
2128 {
2130 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2131 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2133 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2134 {
2136 }
2137 }
2138 }
2139 }
2140
2142 }
2143
2145 {
2148 }
2149
2150
2151
2152
2154 {
2155 super.OnStoreSave(ctx);
2156
2158 {
2160 }
2161
2162
2165 }
2166
2168 {
2169 if (!super.OnStoreLoad(ctx, version))
2170 return false;
2171
2173 {
2175 return false;
2176 }
2177
2178 if (version >= 115)
2179 {
2181 {
2183 return false;
2184 }
2186 {
2188 return false;
2189 }
2190 }
2191
2194
2195 return true;
2196 }
2197
2199 {
2200 super.AfterStoreLoad();
2201
2203 }
2204
2205
2207 {
2209 }
2210
2211
2213 {
2214 return false;
2215 }
2216
2218 {
2219 return false;
2220 }
2221
2223 {
2224 return false;
2225 }
2226
2228 {
2229 return false;
2230 }
2231
2232
2233
2234
2235
2237 {
2240 {
2241 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2242 }
2243 else if (classname != "" && food_stage)
2244 {
2245 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2246 }
2247 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2248 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2249
2250 }
2251
2253 {
2256 {
2258 }
2259 else if (classname != "" && food_stage)
2260 {
2261 return FoodStage.GetEnergy(null, food_stage, classname);
2262 }
2263 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2264 return g_Game.ConfigGetFloat( class_path +
" energy" );
2265 }
2266
2268 {
2271 {
2273 }
2274 else if (classname != "" && food_stage)
2275 {
2276 return FoodStage.GetWater(null, food_stage, classname);
2277 }
2278 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2279 return g_Game.ConfigGetFloat( class_path +
" water" );
2280 }
2281
2283 {
2286 {
2287 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2288 }
2289 else if (classname != "" && food_stage)
2290 {
2291 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2292 }
2293 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2294 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2295
2296 }
2297
2299 {
2302 {
2303 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2304 }
2305 else if (classname != "" && food_stage)
2306 {
2307 return FoodStage.GetToxicity(null, food_stage, classname);
2308 }
2309 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2310 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2311 }
2312
2314 {
2317 {
2319 }
2320 else if (classname != "" && food_stage)
2321 {
2322 return FoodStage.GetAgents(null, food_stage, classname);
2323 }
2324 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2325 return g_Game.ConfigGetInt( class_path +
" agents" );
2326 }
2327
2329 {
2332 {
2333 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2334 }
2335 else if (classname != "" && food_stage)
2336 {
2337 return FoodStage.GetDigestibility(null, food_stage, classname);
2338 }
2339 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2340 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2341 }
2342
2344 {
2347 {
2348 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2349 }
2350 else if (className != "" && foodStage)
2351 {
2352 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2353 }
2354 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2355 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2356 }
2357
2359 {
2369
2370 return profile;
2371 }
2372
2373
2374
2375
2377 {
2379 }
2380
2381
2383 {
2385 {
2387 }
2388
2389 return false;
2390 }
2391
2393 {
2395 {
2397 }
2398
2399 return false;
2400 }
2401
2403 {
2405 {
2407 }
2408
2409 return false;
2410 }
2411
2413 {
2415 {
2417 }
2418
2419 return false;
2420 }
2421
2423 {
2425 {
2427 }
2428
2429 return false;
2430 }
2431
2433 {
2435 {
2437 }
2438
2439 return false;
2440 }
2441
2442
2444 {
2446 }
2447
2449 {
2450 return GetFoodStage().GetNextFoodStageType( cooking_method );
2451 }
2452
2454 {
2455 return GetFoodStage().GetFoodStageName( food_stage_type );
2456 }
2457
2459 {
2460 return GetFoodStage().CanChangeToNewStage( cooking_method );
2461 }
2462
2463
2465 {
2466 if ( !source.GetFoodStage())
2467 return;
2472 }
2473
2476 {
2479 }
2480
2483 {
2484 switch (stageNew)
2485 {
2490 break;
2491
2494 break;
2495 }
2496 }
2497
2498
2499
2500
2501
2503 {
2505 }
2506
2508 {
2510
2511
2513 }
2514
2516 {
2518 {
2521 }
2522 }
2523
2524
2526 {
2528 if (player)
2529 {
2531 player.ServerReplaceItemInHandsWithNew(lambda);
2532 }
2533 else
2534 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2535 }
2536
2538 {
2540 }
2541
2543 {
2544 super.SetActions();
2545
2548 }
2549
2551 {
2552 #ifndef SERVER
2553 #ifndef NO_GUI
2555 {
2557
2560 }
2561 #endif
2562 #endif
2563 }
2564
2566 {
2567 #ifndef SERVER
2568 #ifndef NO_GUI
2570 {
2574 }
2575 #endif
2576 #endif
2577 }
2578
2580 {
2581 return false;
2582 }
2583
2585 {
2587 }
2588
2589 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2590 {
2592
2593 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2595 if ( hasRootAsPlayer )
2597
2598
2599
2600
2601
2602
2603
2605 {
2606
2608 {
2610 {
2614 break;
2615
2619 break;
2620
2624 break;
2625
2629 default:
2632 return;
2633 }
2634
2635
2636 }
2637
2639
2641 {
2643 {
2644
2646 {
2648 }
2650 {
2653 {
2655 }
2656 else
2657 {
2659 {
2661 }
2662 else
2663 {
2665 }
2666 }
2667 }
2668 }
2669 }
2670
2671 }
2673 {
2674
2676 {
2678 {
2682 break;
2683
2687 break;
2688
2692 break;
2693
2697 break;
2698
2701 default:
2704 return;
2705 }
2706 }
2707
2709
2711 {
2713 {
2714
2716 {
2718 }
2719 }
2720 }
2721 }
2723 {
2724
2726 {
2728 {
2732 break;
2733
2736 default:
2739 return;
2740 }
2741 }
2742
2744
2746 {
2748 {
2749
2751 {
2753 }
2754 }
2755 }
2756 }
2757 else
2758 {
2759
2761
2763 {
2766
2767 }
2768 else
2769 {
2771 {
2774 }
2775 }
2776 }
2777 }
2778
2780 {
2781 if (
g_Game.IsHeadlessOrDedicatedServer())
2782 return;
2783
2785 {
2787 GetInventory().GetCurrentInventoryLocation(invLoc);
2789 {
2791 if (ptcMgr)
2792 {
2797 }
2798 }
2799 }
2801 {
2803 {
2806 return;
2807 }
2808
2810 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2812 {
2815 }
2816 }
2817 }
2818
2819 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2820 {
2822 {
2827 }
2828
2829 super.GetDebugActions(outputList);
2830 }
2831
2833 {
2834 super.OnAction(action_id, player, ctx);
2835
2837 {
2838 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2839 {
2841 if (food_stage_prev <= 0)
2842 {
2844 }
2846 return true;
2847 }
2848 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2849 {
2852 {
2854 }
2856 return true;
2857 }
2858
2859 }
2860
2861 #ifdef DIAG_DEVELOPER
2862 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2863 {
2864 PrintNutritionsData();
2865 return true;
2866 }
2867 #endif
2868
2869 return false;
2870 }
2871
2873 {
2874 string debug_output;
2875
2876 debug_output = super.GetDebugText();
2877
2880
2881 return debug_output;
2882 }
2883
2884
2885
2886
2887
2889 {
2890 float ret = super.GetBaitEffectivity();
2891
2893 {
2894 ret *= 0.5;
2895 }
2896
2897 return ret;
2898 }
2899
2901 {
2903 }
2904
2906 {
2908 }
2909
2911 {
2913 }
2914
2915 #ifdef DIAG_DEVELOPER
2916 private void PrintNutritionsData()
2917 {
2918 string nutritionsData = "";
2919
2922
2924 if (profile)
2925 {
2926 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2928 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2932 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2934
2937
2938 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2940 }
2941
2942 nutritionsData += "-----\n";
2943
2945 }
2946 #endif
2947
2949
2952 {
2954 }
2955}
2956
2958{
2960};
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.