2219{
2221
2229
2239
2241
2243 {
2245 {
2247
2249 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2250
2254 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2255 }
2256 }
2257
2259 {
2261
2263 }
2264
2266 {
2267 super.EEDelete(parent);
2268
2270
2273 }
2274
2276 {
2277 super.EEItemLocationChanged(oldLoc, newLoc);
2278
2281 {
2282 switch (oldLoc.GetParent().GetType())
2283 {
2284 case "FryingPan":
2285 case "Pot":
2286 case "Cauldron":
2287 case "SharpWoodenStick":
2289 break;
2290 }
2291
2294 {
2296 }
2297 }
2298
2299 if (oldLoc.IsValid())
2301
2304 }
2305
2307 {
2310 }
2311
2313 {
2316
2317 return true;
2318 }
2319
2321 {
2323 {
2325 }
2326 }
2327
2330 {
2331 int foodStageType;
2332
2334 if (foodStage)
2335 foodStageType = foodStage.GetFoodStageType();
2336
2341
2342 return agentsIn;
2343 }
2344
2345
2347 {
2348 return false;
2349 }
2350
2352 {
2353 return false;
2354 }
2355
2357 {
2359 {
2361 {
2364
2367
2368 default:
2369 return super.GetTemperatureFreezeTime();
2370 }
2371 }
2372
2373 return super.GetTemperatureFreezeTime();
2374 }
2375
2377 {
2379 {
2381 {
2384
2387
2388 default:
2389 return super.GetTemperatureThawTime();
2390 }
2391 }
2392
2393 return super.GetTemperatureThawTime();
2394 }
2395
2397 {
2399 }
2400
2401
2402
2403
2405 {
2406 SetSynchDirty();
2407 }
2408
2410 {
2411 super.OnVariablesSynchronized();
2412
2413
2414
2415
2417 {
2419 }
2420 else
2421 {
2423 }
2424
2427 }
2428
2429
2430
2431
2433 {
2436
2438 }
2439
2441 {
2442 string soundName = "";
2443
2446
2448 {
2450 }
2451 else
2452 {
2454 {
2456 {
2461 else
2462 soundName = "";
2463 break;
2464 }
2465
2467 {
2472 else
2473 soundName = "";
2474 break;
2475 }
2476
2478 {
2483 else
2484 soundName = "";
2485 break;
2486 }
2487
2488 default:
2489 soundName = "";
2490 break;
2491 }
2492
2494 {
2495 if (soundName == "")
2496 {
2498 }
2499 else
2500 {
2502 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2503 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2505 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2506 {
2508 }
2509 }
2510 }
2511 }
2512
2514 }
2515
2517 {
2520 }
2521
2522
2523
2524
2526 {
2527 super.OnStoreSave(ctx);
2528
2530 {
2532 }
2533
2534
2537 }
2538
2540 {
2541 if (!super.OnStoreLoad(ctx, version))
2542 return false;
2543
2545 {
2547 return false;
2548 }
2549
2550 if (version >= 115)
2551 {
2553 {
2555 return false;
2556 }
2558 {
2560 return false;
2561 }
2562 }
2563
2566
2567 return true;
2568 }
2569
2571 {
2572 super.AfterStoreLoad();
2573
2575 }
2576
2577
2579 {
2581 }
2582
2583
2585 {
2586 return false;
2587 }
2588
2590 {
2591 return false;
2592 }
2593
2595 {
2596 return false;
2597 }
2598
2600 {
2601 return false;
2602 }
2603
2604
2605
2606
2607
2609 {
2612 {
2613 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2614 }
2615 else if (classname != "" && food_stage)
2616 {
2617 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2618 }
2619 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2620 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2621
2622 }
2623
2625 {
2628 {
2630 }
2631 else if (classname != "" && food_stage)
2632 {
2633 return FoodStage.GetEnergy(null, food_stage, classname);
2634 }
2635 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2636 return g_Game.ConfigGetFloat( class_path +
" energy" );
2637 }
2638
2640 {
2643 {
2645 }
2646 else if (classname != "" && food_stage)
2647 {
2648 return FoodStage.GetWater(null, food_stage, classname);
2649 }
2650 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2651 return g_Game.ConfigGetFloat( class_path +
" water" );
2652 }
2653
2655 {
2658 {
2659 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2660 }
2661 else if (classname != "" && food_stage)
2662 {
2663 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2664 }
2665 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2666 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2667
2668 }
2669
2671 {
2674 {
2675 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2676 }
2677 else if (classname != "" && food_stage)
2678 {
2679 return FoodStage.GetToxicity(null, food_stage, classname);
2680 }
2681 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2682 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2683 }
2684
2686 {
2689 {
2691 }
2692 else if (classname != "" && food_stage)
2693 {
2694 return FoodStage.GetAgents(null, food_stage, classname);
2695 }
2696 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2697 return g_Game.ConfigGetInt( class_path +
" agents" );
2698 }
2699
2701 {
2704 {
2705 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2706 }
2707 else if (classname != "" && food_stage)
2708 {
2709 return FoodStage.GetDigestibility(null, food_stage, classname);
2710 }
2711 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2712 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2713 }
2714
2716 {
2719 {
2720 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2721 }
2722 else if (className != "" && foodStage)
2723 {
2724 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2725 }
2726 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2727 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2728 }
2729
2731 {
2741
2742 return profile;
2743 }
2744
2745
2746
2747
2749 {
2751 }
2752
2753
2755 {
2757 {
2759 }
2760
2761 return false;
2762 }
2763
2765 {
2767 {
2769 }
2770
2771 return false;
2772 }
2773
2775 {
2777 {
2779 }
2780
2781 return false;
2782 }
2783
2785 {
2787 {
2789 }
2790
2791 return false;
2792 }
2793
2795 {
2797 {
2799 }
2800
2801 return false;
2802 }
2803
2805 {
2807 {
2809 }
2810
2811 return false;
2812 }
2813
2814
2816 {
2818 }
2819
2821 {
2822 return GetFoodStage().GetNextFoodStageType( cooking_method );
2823 }
2824
2826 {
2827 return GetFoodStage().GetFoodStageName( food_stage_type );
2828 }
2829
2831 {
2832 return GetFoodStage().CanChangeToNewStage( cooking_method );
2833 }
2834
2835
2837 {
2838 if ( !source.GetFoodStage())
2839 return;
2844 }
2845
2848 {
2851 }
2852
2855 {
2856 switch (stageNew)
2857 {
2862 break;
2863
2866 break;
2867 }
2868 }
2869
2870
2871
2872
2873
2875 {
2877 }
2878
2880 {
2882
2883
2885 }
2886
2888 {
2890 {
2893 }
2894 }
2895
2896
2898 {
2900 if (player)
2901 {
2903 player.ServerReplaceItemInHandsWithNew(lambda);
2904 }
2905 else
2906 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2907 }
2908
2910 {
2912 }
2913
2915 {
2916 super.SetActions();
2917
2920 }
2921
2923 {
2924 #ifndef SERVER
2925 #ifndef NO_GUI
2927 {
2929
2932 }
2933 #endif
2934 #endif
2935 }
2936
2938 {
2939 #ifndef SERVER
2940 #ifndef NO_GUI
2942 {
2946 }
2947 #endif
2948 #endif
2949 }
2950
2952 {
2953 return false;
2954 }
2955
2957 {
2959 }
2960
2961 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2962 {
2964
2965 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2967 if ( hasRootAsPlayer )
2969
2970
2971
2972
2973
2974
2975
2977 {
2978
2980 {
2982 {
2986 break;
2987
2991 break;
2992
2996 break;
2997
3001 default:
3004 return;
3005 }
3006
3007
3008 }
3009
3011
3013 {
3015 {
3016
3018 {
3020 }
3022 {
3025 {
3027 }
3028 else
3029 {
3031 {
3033 }
3034 else
3035 {
3037 }
3038 }
3039 }
3040 }
3041 }
3042
3043 }
3045 {
3046
3048 {
3050 {
3054 break;
3055
3059 break;
3060
3064 break;
3065
3069 break;
3070
3073 default:
3076 return;
3077 }
3078 }
3079
3081
3083 {
3085 {
3086
3088 {
3090 }
3091 }
3092 }
3093 }
3095 {
3096
3098 {
3100 {
3104 break;
3105
3108 default:
3111 return;
3112 }
3113 }
3114
3116
3118 {
3120 {
3121
3123 {
3125 }
3126 }
3127 }
3128 }
3129 else
3130 {
3131
3133
3135 {
3138
3139 }
3140 else
3141 {
3143 {
3146 }
3147 }
3148 }
3149 }
3150
3152 {
3153 if (
g_Game.IsHeadlessOrDedicatedServer())
3154 return;
3155
3157 {
3159 GetInventory().GetCurrentInventoryLocation(invLoc);
3161 {
3163 if (ptcMgr)
3164 {
3169 }
3170 }
3171 }
3173 {
3175 {
3178 return;
3179 }
3180
3182 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3184 {
3187 }
3188 }
3189 }
3190
3191 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3192 {
3194 {
3199 }
3200
3201 super.GetDebugActions(outputList);
3202 }
3203
3205 {
3206 super.OnAction(action_id, player, ctx);
3207
3209 {
3210 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3211 {
3213 if (food_stage_prev <= 0)
3214 {
3216 }
3218 return true;
3219 }
3220 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3221 {
3224 {
3226 }
3228 return true;
3229 }
3230
3231 }
3232
3233 #ifdef DIAG_DEVELOPER
3234 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3235 {
3236 PrintNutritionsData();
3237 return true;
3238 }
3239 #endif
3240
3241 return false;
3242 }
3243
3245 {
3246 string debug_output;
3247
3248 debug_output = super.GetDebugText();
3249
3252
3253 return debug_output;
3254 }
3255
3256
3257
3258
3259
3261 {
3262 float ret = super.GetBaitEffectivity();
3263
3265 {
3266 ret *= 0.5;
3267 }
3268
3269 return ret;
3270 }
3271
3273 {
3275 }
3276
3278 {
3280 }
3281
3283 {
3285 }
3286
3287 #ifdef DIAG_DEVELOPER
3288 private void PrintNutritionsData()
3289 {
3290 string nutritionsData = "";
3291
3294
3296 if (profile)
3297 {
3298 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3300 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3304 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3306
3309
3310 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3312 }
3313
3314 nutritionsData += "-----\n";
3315
3317 }
3318 #endif
3319
3321
3324 {
3326 }
3327}
3328
3330{
3332};
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.