2173{
2175
2183
2193
2195
2197 {
2199 {
2201
2203 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2204
2208 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2209 }
2210 }
2211
2213 {
2215
2217 }
2218
2220 {
2221 super.EEDelete(parent);
2222
2224
2227 }
2228
2230 {
2231 super.EEItemLocationChanged(oldLoc, newLoc);
2232
2235 {
2236 switch (oldLoc.GetParent().GetType())
2237 {
2238 case "FryingPan":
2239 case "Pot":
2240 case "Cauldron":
2241 case "SharpWoodenStick":
2243 break;
2244 }
2245
2248 {
2250 }
2251 }
2252
2253 if (oldLoc.IsValid())
2255
2258 }
2259
2261 {
2264 }
2265
2267 {
2270
2271 return true;
2272 }
2273
2275 {
2277 {
2279 }
2280 }
2281
2284 {
2285 int foodStageType;
2286
2288 if (foodStage)
2289 foodStageType = foodStage.GetFoodStageType();
2290
2295
2296 return agentsIn;
2297 }
2298
2299
2301 {
2302 return false;
2303 }
2304
2306 {
2307 return false;
2308 }
2309
2311 {
2313 {
2315 {
2318
2321
2322 default:
2323 return super.GetTemperatureFreezeTime();
2324 }
2325 }
2326
2327 return super.GetTemperatureFreezeTime();
2328 }
2329
2331 {
2333 {
2335 {
2338
2341
2342 default:
2343 return super.GetTemperatureThawTime();
2344 }
2345 }
2346
2347 return super.GetTemperatureThawTime();
2348 }
2349
2351 {
2353 }
2354
2355
2356
2357
2359 {
2360 SetSynchDirty();
2361 }
2362
2364 {
2365 super.OnVariablesSynchronized();
2366
2367
2368
2369
2371 {
2373 }
2374 else
2375 {
2377 }
2378
2381 }
2382
2383
2384
2385
2387 {
2390
2392 }
2393
2395 {
2396 string soundName = "";
2397
2400
2402 {
2404 }
2405 else
2406 {
2408 {
2410 {
2415 else
2416 soundName = "";
2417 break;
2418 }
2419
2421 {
2426 else
2427 soundName = "";
2428 break;
2429 }
2430
2432 {
2437 else
2438 soundName = "";
2439 break;
2440 }
2441
2442 default:
2443 soundName = "";
2444 break;
2445 }
2446
2448 {
2449 if (soundName == "")
2450 {
2452 }
2453 else
2454 {
2456 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2457 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2459 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2460 {
2462 }
2463 }
2464 }
2465 }
2466
2468 }
2469
2471 {
2474 }
2475
2476
2477
2478
2480 {
2481 super.OnStoreSave(ctx);
2482
2484 {
2486 }
2487
2488
2491 }
2492
2494 {
2495 if (!super.OnStoreLoad(ctx, version))
2496 return false;
2497
2499 {
2501 return false;
2502 }
2503
2504 if (version >= 115)
2505 {
2507 {
2509 return false;
2510 }
2512 {
2514 return false;
2515 }
2516 }
2517
2520
2521 return true;
2522 }
2523
2525 {
2526 super.AfterStoreLoad();
2527
2529 }
2530
2531
2533 {
2535 }
2536
2537
2539 {
2540 return false;
2541 }
2542
2544 {
2545 return false;
2546 }
2547
2549 {
2550 return false;
2551 }
2552
2554 {
2555 return false;
2556 }
2557
2558
2559
2560
2561
2563 {
2566 {
2567 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2568 }
2569 else if (classname != "" && food_stage)
2570 {
2571 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2572 }
2573 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2574 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2575
2576 }
2577
2579 {
2582 {
2584 }
2585 else if (classname != "" && food_stage)
2586 {
2587 return FoodStage.GetEnergy(null, food_stage, classname);
2588 }
2589 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2590 return g_Game.ConfigGetFloat( class_path +
" energy" );
2591 }
2592
2594 {
2597 {
2599 }
2600 else if (classname != "" && food_stage)
2601 {
2602 return FoodStage.GetWater(null, food_stage, classname);
2603 }
2604 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2605 return g_Game.ConfigGetFloat( class_path +
" water" );
2606 }
2607
2609 {
2612 {
2613 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2614 }
2615 else if (classname != "" && food_stage)
2616 {
2617 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2618 }
2619 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2620 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2621
2622 }
2623
2625 {
2628 {
2629 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2630 }
2631 else if (classname != "" && food_stage)
2632 {
2633 return FoodStage.GetToxicity(null, food_stage, classname);
2634 }
2635 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2636 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2637 }
2638
2640 {
2643 {
2645 }
2646 else if (classname != "" && food_stage)
2647 {
2648 return FoodStage.GetAgents(null, food_stage, classname);
2649 }
2650 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2651 return g_Game.ConfigGetInt( class_path +
" agents" );
2652 }
2653
2655 {
2658 {
2659 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2660 }
2661 else if (classname != "" && food_stage)
2662 {
2663 return FoodStage.GetDigestibility(null, food_stage, classname);
2664 }
2665 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2666 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2667 }
2668
2670 {
2673 {
2674 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2675 }
2676 else if (className != "" && foodStage)
2677 {
2678 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2679 }
2680 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2681 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2682 }
2683
2685 {
2695
2696 return profile;
2697 }
2698
2699
2700
2701
2703 {
2705 }
2706
2707
2709 {
2711 {
2713 }
2714
2715 return false;
2716 }
2717
2719 {
2721 {
2723 }
2724
2725 return false;
2726 }
2727
2729 {
2731 {
2733 }
2734
2735 return false;
2736 }
2737
2739 {
2741 {
2743 }
2744
2745 return false;
2746 }
2747
2749 {
2751 {
2753 }
2754
2755 return false;
2756 }
2757
2759 {
2761 {
2763 }
2764
2765 return false;
2766 }
2767
2768
2770 {
2772 }
2773
2775 {
2776 return GetFoodStage().GetNextFoodStageType( cooking_method );
2777 }
2778
2780 {
2781 return GetFoodStage().GetFoodStageName( food_stage_type );
2782 }
2783
2785 {
2786 return GetFoodStage().CanChangeToNewStage( cooking_method );
2787 }
2788
2789
2791 {
2792 if ( !source.GetFoodStage())
2793 return;
2798 }
2799
2802 {
2805 }
2806
2809 {
2810 switch (stageNew)
2811 {
2816 break;
2817
2820 break;
2821 }
2822 }
2823
2824
2825
2826
2827
2829 {
2831 }
2832
2834 {
2836
2837
2839 }
2840
2842 {
2844 {
2847 }
2848 }
2849
2850
2852 {
2854 if (player)
2855 {
2857 player.ServerReplaceItemInHandsWithNew(lambda);
2858 }
2859 else
2860 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2861 }
2862
2864 {
2866 }
2867
2869 {
2870 super.SetActions();
2871
2874 }
2875
2877 {
2878 #ifndef SERVER
2879 #ifndef NO_GUI
2881 {
2883
2886 }
2887 #endif
2888 #endif
2889 }
2890
2892 {
2893 #ifndef SERVER
2894 #ifndef NO_GUI
2896 {
2900 }
2901 #endif
2902 #endif
2903 }
2904
2906 {
2907 return false;
2908 }
2909
2911 {
2913 }
2914
2915 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2916 {
2918
2919 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2921 if ( hasRootAsPlayer )
2923
2924
2925
2926
2927
2928
2929
2931 {
2932
2934 {
2936 {
2940 break;
2941
2945 break;
2946
2950 break;
2951
2955 default:
2958 return;
2959 }
2960
2961
2962 }
2963
2965
2967 {
2969 {
2970
2972 {
2974 }
2976 {
2979 {
2981 }
2982 else
2983 {
2985 {
2987 }
2988 else
2989 {
2991 }
2992 }
2993 }
2994 }
2995 }
2996
2997 }
2999 {
3000
3002 {
3004 {
3008 break;
3009
3013 break;
3014
3018 break;
3019
3023 break;
3024
3027 default:
3030 return;
3031 }
3032 }
3033
3035
3037 {
3039 {
3040
3042 {
3044 }
3045 }
3046 }
3047 }
3049 {
3050
3052 {
3054 {
3058 break;
3059
3062 default:
3065 return;
3066 }
3067 }
3068
3070
3072 {
3074 {
3075
3077 {
3079 }
3080 }
3081 }
3082 }
3083 else
3084 {
3085
3087
3089 {
3092
3093 }
3094 else
3095 {
3097 {
3100 }
3101 }
3102 }
3103 }
3104
3106 {
3107 if (
g_Game.IsHeadlessOrDedicatedServer())
3108 return;
3109
3111 {
3113 GetInventory().GetCurrentInventoryLocation(invLoc);
3115 {
3117 if (ptcMgr)
3118 {
3123 }
3124 }
3125 }
3127 {
3129 {
3132 return;
3133 }
3134
3136 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3138 {
3141 }
3142 }
3143 }
3144
3145 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3146 {
3148 {
3153 }
3154
3155 super.GetDebugActions(outputList);
3156 }
3157
3159 {
3160 super.OnAction(action_id, player, ctx);
3161
3163 {
3164 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3165 {
3167 if (food_stage_prev <= 0)
3168 {
3170 }
3172 return true;
3173 }
3174 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3175 {
3178 {
3180 }
3182 return true;
3183 }
3184
3185 }
3186
3187 #ifdef DIAG_DEVELOPER
3188 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3189 {
3190 PrintNutritionsData();
3191 return true;
3192 }
3193 #endif
3194
3195 return false;
3196 }
3197
3199 {
3200 string debug_output;
3201
3202 debug_output = super.GetDebugText();
3203
3206
3207 return debug_output;
3208 }
3209
3210
3211
3212
3213
3215 {
3216 float ret = super.GetBaitEffectivity();
3217
3219 {
3220 ret *= 0.5;
3221 }
3222
3223 return ret;
3224 }
3225
3227 {
3229 }
3230
3232 {
3234 }
3235
3237 {
3239 }
3240
3241 #ifdef DIAG_DEVELOPER
3242 private void PrintNutritionsData()
3243 {
3244 string nutritionsData = "";
3245
3248
3250 if (profile)
3251 {
3252 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3254 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3258 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3260
3263
3264 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3266 }
3267
3268 nutritionsData += "-----\n";
3269
3271 }
3272 #endif
3273
3275
3278 {
3280 }
3281}
3282
3284{
3286};
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.