2047{
2049
2057
2067
2069
2071 {
2073 {
2075
2077 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2078
2082 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2083 }
2084 }
2085
2087 {
2089
2091 }
2092
2094 {
2095 super.EEDelete(parent);
2096
2098
2101 }
2102
2104 {
2105 super.EEItemLocationChanged(oldLoc, newLoc);
2106
2109 {
2110 switch (oldLoc.GetParent().GetType())
2111 {
2112 case "FryingPan":
2113 case "Pot":
2114 case "Cauldron":
2115 case "SharpWoodenStick":
2117 break;
2118 }
2119
2122 {
2124 }
2125 }
2126
2127 if (oldLoc.IsValid())
2129
2132 }
2133
2135 {
2138 }
2139
2141 {
2144
2145 return true;
2146 }
2147
2149 {
2151 {
2153 }
2154 }
2155
2158 {
2159 int foodStageType;
2160
2162 if (foodStage)
2163 foodStageType = foodStage.GetFoodStageType();
2164
2169
2170 return agentsIn;
2171 }
2172
2173
2175 {
2176 return false;
2177 }
2178
2180 {
2181 return false;
2182 }
2183
2185 {
2187 {
2189 {
2192
2195
2196 default:
2197 return super.GetTemperatureFreezeTime();
2198 }
2199 }
2200
2201 return super.GetTemperatureFreezeTime();
2202 }
2203
2205 {
2207 {
2209 {
2212
2215
2216 default:
2217 return super.GetTemperatureThawTime();
2218 }
2219 }
2220
2221 return super.GetTemperatureThawTime();
2222 }
2223
2225 {
2227 }
2228
2229
2230
2231
2233 {
2234 SetSynchDirty();
2235 }
2236
2238 {
2239 super.OnVariablesSynchronized();
2240
2241
2242
2243
2245 {
2247 }
2248 else
2249 {
2251 }
2252
2255 }
2256
2257
2258
2259
2261 {
2264
2266 }
2267
2269 {
2270 string soundName = "";
2271
2274
2276 {
2278 }
2279 else
2280 {
2282 {
2284 {
2289 else
2290 soundName = "";
2291 break;
2292 }
2293
2295 {
2300 else
2301 soundName = "";
2302 break;
2303 }
2304
2306 {
2311 else
2312 soundName = "";
2313 break;
2314 }
2315
2316 default:
2317 soundName = "";
2318 break;
2319 }
2320
2322 {
2323 if (soundName == "")
2324 {
2326 }
2327 else
2328 {
2330 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2331 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2333 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2334 {
2336 }
2337 }
2338 }
2339 }
2340
2342 }
2343
2345 {
2348 }
2349
2350
2351
2352
2354 {
2355 super.OnStoreSave(ctx);
2356
2358 {
2360 }
2361
2362
2365 }
2366
2368 {
2369 if (!super.OnStoreLoad(ctx, version))
2370 return false;
2371
2373 {
2375 return false;
2376 }
2377
2378 if (version >= 115)
2379 {
2381 {
2383 return false;
2384 }
2386 {
2388 return false;
2389 }
2390 }
2391
2394
2395 return true;
2396 }
2397
2399 {
2400 super.AfterStoreLoad();
2401
2403 }
2404
2405
2407 {
2409 }
2410
2411
2413 {
2414 return false;
2415 }
2416
2418 {
2419 return false;
2420 }
2421
2423 {
2424 return false;
2425 }
2426
2428 {
2429 return false;
2430 }
2431
2432
2433
2434
2435
2437 {
2440 {
2441 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2442 }
2443 else if (classname != "" && food_stage)
2444 {
2445 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2446 }
2447 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2448 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2449
2450 }
2451
2453 {
2456 {
2458 }
2459 else if (classname != "" && food_stage)
2460 {
2461 return FoodStage.GetEnergy(null, food_stage, classname);
2462 }
2463 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2464 return g_Game.ConfigGetFloat( class_path +
" energy" );
2465 }
2466
2468 {
2471 {
2473 }
2474 else if (classname != "" && food_stage)
2475 {
2476 return FoodStage.GetWater(null, food_stage, classname);
2477 }
2478 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2479 return g_Game.ConfigGetFloat( class_path +
" water" );
2480 }
2481
2483 {
2486 {
2487 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2488 }
2489 else if (classname != "" && food_stage)
2490 {
2491 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2492 }
2493 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2494 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2495
2496 }
2497
2499 {
2502 {
2503 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2504 }
2505 else if (classname != "" && food_stage)
2506 {
2507 return FoodStage.GetToxicity(null, food_stage, classname);
2508 }
2509 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2510 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2511 }
2512
2514 {
2517 {
2519 }
2520 else if (classname != "" && food_stage)
2521 {
2522 return FoodStage.GetAgents(null, food_stage, classname);
2523 }
2524 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2525 return g_Game.ConfigGetInt( class_path +
" agents" );
2526 }
2527
2529 {
2532 {
2533 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2534 }
2535 else if (classname != "" && food_stage)
2536 {
2537 return FoodStage.GetDigestibility(null, food_stage, classname);
2538 }
2539 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2540 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2541 }
2542
2544 {
2547 {
2548 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2549 }
2550 else if (className != "" && foodStage)
2551 {
2552 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2553 }
2554 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2555 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2556 }
2557
2559 {
2569
2570 return profile;
2571 }
2572
2573
2574
2575
2577 {
2579 }
2580
2581
2583 {
2585 {
2587 }
2588
2589 return false;
2590 }
2591
2593 {
2595 {
2597 }
2598
2599 return false;
2600 }
2601
2603 {
2605 {
2607 }
2608
2609 return false;
2610 }
2611
2613 {
2615 {
2617 }
2618
2619 return false;
2620 }
2621
2623 {
2625 {
2627 }
2628
2629 return false;
2630 }
2631
2633 {
2635 {
2637 }
2638
2639 return false;
2640 }
2641
2642
2644 {
2646 }
2647
2649 {
2650 return GetFoodStage().GetNextFoodStageType( cooking_method );
2651 }
2652
2654 {
2655 return GetFoodStage().GetFoodStageName( food_stage_type );
2656 }
2657
2659 {
2660 return GetFoodStage().CanChangeToNewStage( cooking_method );
2661 }
2662
2663
2665 {
2666 if ( !source.GetFoodStage())
2667 return;
2672 }
2673
2676 {
2679 }
2680
2683 {
2684 switch (stageNew)
2685 {
2690 break;
2691
2694 break;
2695 }
2696 }
2697
2698
2699
2700
2701
2703 {
2705 }
2706
2708 {
2710
2711
2713 }
2714
2716 {
2718 {
2721 }
2722 }
2723
2724
2726 {
2728 if (player)
2729 {
2731 player.ServerReplaceItemInHandsWithNew(lambda);
2732 }
2733 else
2734 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2735 }
2736
2738 {
2740 }
2741
2743 {
2744 super.SetActions();
2745
2748 }
2749
2751 {
2752 #ifndef SERVER
2753 #ifndef NO_GUI
2755 {
2757
2760 }
2761 #endif
2762 #endif
2763 }
2764
2766 {
2767 #ifndef SERVER
2768 #ifndef NO_GUI
2770 {
2774 }
2775 #endif
2776 #endif
2777 }
2778
2780 {
2781 return false;
2782 }
2783
2785 {
2787 }
2788
2789 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2790 {
2792
2793 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2795 if ( hasRootAsPlayer )
2797
2798
2799
2800
2801
2802
2803
2805 {
2806
2808 {
2810 {
2814 break;
2815
2819 break;
2820
2824 break;
2825
2829 default:
2832 return;
2833 }
2834
2835
2836 }
2837
2839
2841 {
2843 {
2844
2846 {
2848 }
2850 {
2853 {
2855 }
2856 else
2857 {
2859 {
2861 }
2862 else
2863 {
2865 }
2866 }
2867 }
2868 }
2869 }
2870
2871 }
2873 {
2874
2876 {
2878 {
2882 break;
2883
2887 break;
2888
2892 break;
2893
2897 break;
2898
2901 default:
2904 return;
2905 }
2906 }
2907
2909
2911 {
2913 {
2914
2916 {
2918 }
2919 }
2920 }
2921 }
2923 {
2924
2926 {
2928 {
2932 break;
2933
2936 default:
2939 return;
2940 }
2941 }
2942
2944
2946 {
2948 {
2949
2951 {
2953 }
2954 }
2955 }
2956 }
2957 else
2958 {
2959
2961
2963 {
2966
2967 }
2968 else
2969 {
2971 {
2974 }
2975 }
2976 }
2977 }
2978
2980 {
2981 if (
g_Game.IsHeadlessOrDedicatedServer())
2982 return;
2983
2985 {
2987 GetInventory().GetCurrentInventoryLocation(invLoc);
2989 {
2991 if (ptcMgr)
2992 {
2997 }
2998 }
2999 }
3001 {
3003 {
3006 return;
3007 }
3008
3010 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3012 {
3015 }
3016 }
3017 }
3018
3019 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3020 {
3022 {
3027 }
3028
3029 super.GetDebugActions(outputList);
3030 }
3031
3033 {
3034 super.OnAction(action_id, player, ctx);
3035
3037 {
3038 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3039 {
3041 if (food_stage_prev <= 0)
3042 {
3044 }
3046 return true;
3047 }
3048 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3049 {
3052 {
3054 }
3056 return true;
3057 }
3058
3059 }
3060
3061 #ifdef DIAG_DEVELOPER
3062 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3063 {
3064 PrintNutritionsData();
3065 return true;
3066 }
3067 #endif
3068
3069 return false;
3070 }
3071
3073 {
3074 string debug_output;
3075
3076 debug_output = super.GetDebugText();
3077
3080
3081 return debug_output;
3082 }
3083
3084
3085
3086
3087
3089 {
3090 float ret = super.GetBaitEffectivity();
3091
3093 {
3094 ret *= 0.5;
3095 }
3096
3097 return ret;
3098 }
3099
3101 {
3103 }
3104
3106 {
3108 }
3109
3111 {
3113 }
3114
3115 #ifdef DIAG_DEVELOPER
3116 private void PrintNutritionsData()
3117 {
3118 string nutritionsData = "";
3119
3122
3124 if (profile)
3125 {
3126 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3128 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3132 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3134
3137
3138 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3140 }
3141
3142 nutritionsData += "-----\n";
3143
3145 }
3146 #endif
3147
3149
3152 {
3154 }
3155}
3156
3158{
3160};
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.