2209{
2211
2219
2229
2231
2233 {
2235 {
2237
2239 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2240
2244 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2245 }
2246 }
2247
2249 {
2251
2253 }
2254
2256 {
2257 super.EEDelete(parent);
2258
2260
2263 }
2264
2266 {
2267 super.EEItemLocationChanged(oldLoc, newLoc);
2268
2271 {
2272 switch (oldLoc.GetParent().GetType())
2273 {
2274 case "FryingPan":
2275 case "Pot":
2276 case "Cauldron":
2277 case "SharpWoodenStick":
2279 break;
2280 }
2281
2284 {
2286 }
2287 }
2288
2289 if (oldLoc.IsValid())
2291
2294 }
2295
2297 {
2300 }
2301
2303 {
2306
2307 return true;
2308 }
2309
2311 {
2313 {
2315 }
2316 }
2317
2320 {
2321 int foodStageType;
2322
2324 if (foodStage)
2325 foodStageType = foodStage.GetFoodStageType();
2326
2331
2332 return agentsIn;
2333 }
2334
2335
2337 {
2338 return false;
2339 }
2340
2342 {
2343 return false;
2344 }
2345
2347 {
2349 {
2351 {
2354
2357
2358 default:
2359 return super.GetTemperatureFreezeTime();
2360 }
2361 }
2362
2363 return super.GetTemperatureFreezeTime();
2364 }
2365
2367 {
2369 {
2371 {
2374
2377
2378 default:
2379 return super.GetTemperatureThawTime();
2380 }
2381 }
2382
2383 return super.GetTemperatureThawTime();
2384 }
2385
2387 {
2389 }
2390
2391
2392
2393
2395 {
2396 SetSynchDirty();
2397 }
2398
2400 {
2401 super.OnVariablesSynchronized();
2402
2403
2404
2405
2407 {
2409 }
2410 else
2411 {
2413 }
2414
2417 }
2418
2419
2420
2421
2423 {
2426
2428 }
2429
2431 {
2432 string soundName = "";
2433
2436
2438 {
2440 }
2441 else
2442 {
2444 {
2446 {
2451 else
2452 soundName = "";
2453 break;
2454 }
2455
2457 {
2462 else
2463 soundName = "";
2464 break;
2465 }
2466
2468 {
2473 else
2474 soundName = "";
2475 break;
2476 }
2477
2478 default:
2479 soundName = "";
2480 break;
2481 }
2482
2484 {
2485 if (soundName == "")
2486 {
2488 }
2489 else
2490 {
2492 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2493 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2495 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2496 {
2498 }
2499 }
2500 }
2501 }
2502
2504 }
2505
2507 {
2510 }
2511
2512
2513
2514
2516 {
2517 super.OnStoreSave(ctx);
2518
2520 {
2522 }
2523
2524
2527 }
2528
2530 {
2531 if (!super.OnStoreLoad(ctx, version))
2532 return false;
2533
2535 {
2537 return false;
2538 }
2539
2540 if (version >= 115)
2541 {
2543 {
2545 return false;
2546 }
2548 {
2550 return false;
2551 }
2552 }
2553
2556
2557 return true;
2558 }
2559
2561 {
2562 super.AfterStoreLoad();
2563
2565 }
2566
2567
2569 {
2571 }
2572
2573
2575 {
2576 return false;
2577 }
2578
2580 {
2581 return false;
2582 }
2583
2585 {
2586 return false;
2587 }
2588
2590 {
2591 return false;
2592 }
2593
2594
2595
2596
2597
2599 {
2602 {
2603 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2604 }
2605 else if (classname != "" && food_stage)
2606 {
2607 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2608 }
2609 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2611
2612 }
2613
2615 {
2618 {
2620 }
2621 else if (classname != "" && food_stage)
2622 {
2623 return FoodStage.GetEnergy(null, food_stage, classname);
2624 }
2625 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2627 }
2628
2630 {
2633 {
2635 }
2636 else if (classname != "" && food_stage)
2637 {
2638 return FoodStage.GetWater(null, food_stage, classname);
2639 }
2640 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2642 }
2643
2645 {
2648 {
2649 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2650 }
2651 else if (classname != "" && food_stage)
2652 {
2653 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2654 }
2655 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2657
2658 }
2659
2661 {
2664 {
2665 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2666 }
2667 else if (classname != "" && food_stage)
2668 {
2669 return FoodStage.GetToxicity(null, food_stage, classname);
2670 }
2671 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2673 }
2674
2676 {
2679 {
2681 }
2682 else if (classname != "" && food_stage)
2683 {
2684 return FoodStage.GetAgents(null, food_stage, classname);
2685 }
2686 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2688 }
2689
2691 {
2694 {
2695 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2696 }
2697 else if (classname != "" && food_stage)
2698 {
2699 return FoodStage.GetDigestibility(null, food_stage, classname);
2700 }
2701 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2703 }
2704
2706 {
2709 {
2710 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2711 }
2712 else if (className != "" && foodStage)
2713 {
2714 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2715 }
2716 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2718 }
2719
2721 {
2731
2732 return profile;
2733 }
2734
2735
2736
2737
2739 {
2741 }
2742
2743
2745 {
2747 {
2749 }
2750
2751 return false;
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
2804
2806 {
2808 }
2809
2811 {
2812 return GetFoodStage().GetNextFoodStageType( cooking_method );
2813 }
2814
2816 {
2817 return GetFoodStage().GetFoodStageName( food_stage_type );
2818 }
2819
2821 {
2822 return GetFoodStage().CanChangeToNewStage( cooking_method );
2823 }
2824
2825
2827 {
2828 if ( !source.GetFoodStage())
2829 return;
2834 }
2835
2838 {
2841 }
2842
2845 {
2846 switch (stageNew)
2847 {
2852 break;
2853
2856 break;
2857 }
2858 }
2859
2860
2861
2862
2863
2865 {
2867 }
2868
2870 {
2872
2873
2875 }
2876
2878 {
2880 {
2883 }
2884 }
2885
2886
2888 {
2890 if (player)
2891 {
2893 player.ServerReplaceItemInHandsWithNew(lambda);
2894 }
2895 else
2896 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2897 }
2898
2900 {
2902 }
2903
2905 {
2906 super.SetActions();
2907
2910 }
2911
2913 {
2914 #ifndef SERVER
2916 {
2918
2921 }
2922 #endif
2923 }
2924
2926 {
2927 #ifndef SERVER
2929 {
2933 }
2934 #endif
2935 }
2936
2938 {
2939 return false;
2940 }
2941
2943 {
2945 }
2946
2947 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2948 {
2950
2951 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2953 if ( hasRootAsPlayer )
2955
2956
2957
2958
2959
2960
2961
2963 {
2964
2966 {
2968 {
2972 break;
2973
2977 break;
2978
2982 break;
2983
2987 default:
2990 return;
2991 }
2992
2993
2994 }
2995
2997
2999 {
3001 {
3002
3004 {
3006 }
3008 {
3011 {
3013 }
3014 else
3015 {
3017 {
3019 }
3020 else
3021 {
3023 }
3024 }
3025 }
3026 }
3027 }
3028
3029 }
3031 {
3032
3034 {
3036 {
3040 break;
3041
3045 break;
3046
3050 break;
3051
3055 break;
3056
3059 default:
3062 return;
3063 }
3064 }
3065
3067
3069 {
3071 {
3072
3074 {
3076 }
3077 }
3078 }
3079 }
3081 {
3082
3084 {
3086 {
3090 break;
3091
3094 default:
3097 return;
3098 }
3099 }
3100
3102
3104 {
3106 {
3107
3109 {
3111 }
3112 }
3113 }
3114 }
3115 else
3116 {
3117
3119
3121 {
3124
3125 }
3126 else
3127 {
3129 {
3132 }
3133 }
3134 }
3135 }
3136
3138 {
3139 if (
GetGame().IsDedicatedServer())
3140 return;
3141
3143 {
3145 GetInventory().GetCurrentInventoryLocation(invLoc);
3147 {
3149 if (ptcMgr)
3150 {
3155 }
3156 }
3157 }
3159 {
3161 {
3164 return;
3165 }
3166
3168 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3170 {
3173 }
3174 }
3175 }
3176
3177 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3178 {
3179 super.GetDebugActions(outputList);
3180
3182 {
3186 }
3187 }
3188
3190 {
3191 super.OnAction(action_id, player, ctx);
3192
3194 {
3195 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3196 {
3198 if (food_stage_prev <= 0)
3199 {
3201 }
3203 return true;
3204 }
3205 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3206 {
3209 {
3211 }
3213 return true;
3214 }
3215
3216 }
3217
3218 #ifdef DIAG_DEVELOPER
3219 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3220 {
3221 PrintNutritionsData();
3222 return true;
3223 }
3224 #endif
3225
3226 return false;
3227 }
3228
3230 {
3231 string debug_output;
3232
3233 debug_output = super.GetDebugText();
3234
3237
3238 return debug_output;
3239 }
3240
3241
3242
3243
3244
3246 {
3247 float ret = super.GetBaitEffectivity();
3248
3250 {
3251 ret *= 0.5;
3252 }
3253
3254 return ret;
3255 }
3256
3258 {
3260 }
3261
3263 {
3265 }
3266
3268 {
3270 }
3271
3272 #ifdef DIAG_DEVELOPER
3273 private void PrintNutritionsData()
3274 {
3275 string nutritionsData = "";
3276
3279
3281 if (profile)
3282 {
3283 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3285 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3289 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3291
3294
3295 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3297 }
3298
3299 nutritionsData += "-----\n";
3300
3302 }
3303 #endif
3304
3306
3309 {
3311 }
3312}
3313
3315{
3317};
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
AttachActionData ActionData ActionAttach()
void AddAction(typename actionName)
DamageType
exposed from C++ (do not change)
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 InsertAgent(int agent, float count=1)
override void RemoveAllAgentsExcept(int agent_to_keep)
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.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native int ConfigGetInt(string path)
Get int value from config on path.
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
proto native CGame GetGame()
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
class JsonUndergroundAreaTriggerData GetPosition
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.