2178{
2180
2188
2198
2200
2202 {
2204 {
2206
2208 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2209
2213 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2214 }
2215 }
2216
2218 {
2220
2222 }
2223
2225 {
2226 super.EEDelete(parent);
2227
2229
2232 }
2233
2235 {
2236 super.EEItemLocationChanged(oldLoc, newLoc);
2237
2240 {
2241 switch (oldLoc.GetParent().GetType())
2242 {
2243 case "FryingPan":
2244 case "Pot":
2245 case "Cauldron":
2246 case "SharpWoodenStick":
2248 break;
2249 }
2250
2253 {
2255 }
2256 }
2257
2258 if (oldLoc.IsValid())
2260
2263 }
2264
2266 {
2269 }
2270
2272 {
2275
2276 return true;
2277 }
2278
2280 {
2282 {
2284 }
2285 }
2286
2289 {
2290 int foodStageType;
2291
2293 if (foodStage)
2294 foodStageType = foodStage.GetFoodStageType();
2295
2300
2301 return agentsIn;
2302 }
2303
2304
2306 {
2307 return false;
2308 }
2309
2311 {
2312 return false;
2313 }
2314
2316 {
2318 {
2320 {
2323
2326
2327 default:
2328 return super.GetTemperatureFreezeTime();
2329 }
2330 }
2331
2332 return super.GetTemperatureFreezeTime();
2333 }
2334
2336 {
2338 {
2340 {
2343
2346
2347 default:
2348 return super.GetTemperatureThawTime();
2349 }
2350 }
2351
2352 return super.GetTemperatureThawTime();
2353 }
2354
2356 {
2358 }
2359
2360
2361
2362
2364 {
2365 SetSynchDirty();
2366 }
2367
2369 {
2370 super.OnVariablesSynchronized();
2371
2372
2373
2374
2376 {
2378 }
2379 else
2380 {
2382 }
2383
2386 }
2387
2388
2389
2390
2392 {
2395
2397 }
2398
2400 {
2401 string soundName = "";
2402
2405
2407 {
2409 }
2410 else
2411 {
2413 {
2415 {
2420 else
2421 soundName = "";
2422 break;
2423 }
2424
2426 {
2431 else
2432 soundName = "";
2433 break;
2434 }
2435
2437 {
2442 else
2443 soundName = "";
2444 break;
2445 }
2446
2447 default:
2448 soundName = "";
2449 break;
2450 }
2451
2453 {
2454 if (soundName == "")
2455 {
2457 }
2458 else
2459 {
2461 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2462 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2464 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2465 {
2467 }
2468 }
2469 }
2470 }
2471
2473 }
2474
2476 {
2479 }
2480
2481
2482
2483
2485 {
2486 super.OnStoreSave(ctx);
2487
2489 {
2491 }
2492
2493
2496 }
2497
2499 {
2500 if (!super.OnStoreLoad(ctx, version))
2501 return false;
2502
2504 {
2506 return false;
2507 }
2508
2509 if (version >= 115)
2510 {
2512 {
2514 return false;
2515 }
2517 {
2519 return false;
2520 }
2521 }
2522
2525
2526 return true;
2527 }
2528
2530 {
2531 super.AfterStoreLoad();
2532
2534 }
2535
2536
2538 {
2540 }
2541
2542
2544 {
2545 return false;
2546 }
2547
2549 {
2550 return false;
2551 }
2552
2554 {
2555 return false;
2556 }
2557
2559 {
2560 return false;
2561 }
2562
2563
2564
2565
2566
2568 {
2571 {
2572 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2573 }
2574 else if (classname != "" && food_stage)
2575 {
2576 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2577 }
2578 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2579 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2580
2581 }
2582
2584 {
2587 {
2589 }
2590 else if (classname != "" && food_stage)
2591 {
2592 return FoodStage.GetEnergy(null, food_stage, classname);
2593 }
2594 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2595 return g_Game.ConfigGetFloat( class_path +
" energy" );
2596 }
2597
2599 {
2602 {
2604 }
2605 else if (classname != "" && food_stage)
2606 {
2607 return FoodStage.GetWater(null, food_stage, classname);
2608 }
2609 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2610 return g_Game.ConfigGetFloat( class_path +
" water" );
2611 }
2612
2614 {
2617 {
2618 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2619 }
2620 else if (classname != "" && food_stage)
2621 {
2622 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2623 }
2624 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2625 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2626
2627 }
2628
2630 {
2633 {
2634 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2635 }
2636 else if (classname != "" && food_stage)
2637 {
2638 return FoodStage.GetToxicity(null, food_stage, classname);
2639 }
2640 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2641 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2642 }
2643
2645 {
2648 {
2650 }
2651 else if (classname != "" && food_stage)
2652 {
2653 return FoodStage.GetAgents(null, food_stage, classname);
2654 }
2655 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2656 return g_Game.ConfigGetInt( class_path +
" agents" );
2657 }
2658
2660 {
2663 {
2664 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2665 }
2666 else if (classname != "" && food_stage)
2667 {
2668 return FoodStage.GetDigestibility(null, food_stage, classname);
2669 }
2670 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2671 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2672 }
2673
2675 {
2678 {
2679 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2680 }
2681 else if (className != "" && foodStage)
2682 {
2683 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2684 }
2685 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2686 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2687 }
2688
2690 {
2700
2701 return profile;
2702 }
2703
2704
2705
2706
2708 {
2710 }
2711
2712
2714 {
2716 {
2718 }
2719
2720 return false;
2721 }
2722
2724 {
2726 {
2728 }
2729
2730 return false;
2731 }
2732
2734 {
2736 {
2738 }
2739
2740 return false;
2741 }
2742
2744 {
2746 {
2748 }
2749
2750 return false;
2751 }
2752
2754 {
2756 {
2758 }
2759
2760 return false;
2761 }
2762
2764 {
2766 {
2768 }
2769
2770 return false;
2771 }
2772
2773
2775 {
2777 }
2778
2780 {
2781 return GetFoodStage().GetNextFoodStageType( cooking_method );
2782 }
2783
2785 {
2786 return GetFoodStage().GetFoodStageName( food_stage_type );
2787 }
2788
2790 {
2791 return GetFoodStage().CanChangeToNewStage( cooking_method );
2792 }
2793
2794
2796 {
2797 if ( !source.GetFoodStage())
2798 return;
2803 }
2804
2807 {
2810 }
2811
2814 {
2815 switch (stageNew)
2816 {
2821 break;
2822
2825 break;
2826 }
2827 }
2828
2829
2830
2831
2832
2834 {
2836 }
2837
2839 {
2841
2842
2844 }
2845
2847 {
2849 {
2852 }
2853 }
2854
2855
2857 {
2859 if (player)
2860 {
2862 player.ServerReplaceItemInHandsWithNew(lambda);
2863 }
2864 else
2865 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2866 }
2867
2869 {
2871 }
2872
2874 {
2875 super.SetActions();
2876
2879 }
2880
2882 {
2883 #ifndef SERVER
2884 #ifndef NO_GUI
2886 {
2888
2891 }
2892 #endif
2893 #endif
2894 }
2895
2897 {
2898 #ifndef SERVER
2899 #ifndef NO_GUI
2901 {
2905 }
2906 #endif
2907 #endif
2908 }
2909
2911 {
2912 return false;
2913 }
2914
2916 {
2918 }
2919
2920 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2921 {
2923
2924 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2926 if ( hasRootAsPlayer )
2928
2929
2930
2931
2932
2933
2934
2936 {
2937
2939 {
2941 {
2945 break;
2946
2950 break;
2951
2955 break;
2956
2960 default:
2963 return;
2964 }
2965
2966
2967 }
2968
2970
2972 {
2974 {
2975
2977 {
2979 }
2981 {
2984 {
2986 }
2987 else
2988 {
2990 {
2992 }
2993 else
2994 {
2996 }
2997 }
2998 }
2999 }
3000 }
3001
3002 }
3004 {
3005
3007 {
3009 {
3013 break;
3014
3018 break;
3019
3023 break;
3024
3028 break;
3029
3032 default:
3035 return;
3036 }
3037 }
3038
3040
3042 {
3044 {
3045
3047 {
3049 }
3050 }
3051 }
3052 }
3054 {
3055
3057 {
3059 {
3063 break;
3064
3067 default:
3070 return;
3071 }
3072 }
3073
3075
3077 {
3079 {
3080
3082 {
3084 }
3085 }
3086 }
3087 }
3088 else
3089 {
3090
3092
3094 {
3097
3098 }
3099 else
3100 {
3102 {
3105 }
3106 }
3107 }
3108 }
3109
3111 {
3112 if (
g_Game.IsHeadlessOrDedicatedServer())
3113 return;
3114
3116 {
3118 GetInventory().GetCurrentInventoryLocation(invLoc);
3120 {
3122 if (ptcMgr)
3123 {
3128 }
3129 }
3130 }
3132 {
3134 {
3137 return;
3138 }
3139
3141 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3143 {
3146 }
3147 }
3148 }
3149
3150 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3151 {
3153 {
3158 }
3159
3160 super.GetDebugActions(outputList);
3161 }
3162
3164 {
3165 super.OnAction(action_id, player, ctx);
3166
3168 {
3169 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3170 {
3172 if (food_stage_prev <= 0)
3173 {
3175 }
3177 return true;
3178 }
3179 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3180 {
3183 {
3185 }
3187 return true;
3188 }
3189
3190 }
3191
3192 #ifdef DIAG_DEVELOPER
3193 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3194 {
3195 PrintNutritionsData();
3196 return true;
3197 }
3198 #endif
3199
3200 return false;
3201 }
3202
3204 {
3205 string debug_output;
3206
3207 debug_output = super.GetDebugText();
3208
3211
3212 return debug_output;
3213 }
3214
3215
3216
3217
3218
3220 {
3221 float ret = super.GetBaitEffectivity();
3222
3224 {
3225 ret *= 0.5;
3226 }
3227
3228 return ret;
3229 }
3230
3232 {
3234 }
3235
3237 {
3239 }
3240
3242 {
3244 }
3245
3246 #ifdef DIAG_DEVELOPER
3247 private void PrintNutritionsData()
3248 {
3249 string nutritionsData = "";
3250
3253
3255 if (profile)
3256 {
3257 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3259 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3263 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3265
3268
3269 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3271 }
3272
3273 nutritionsData += "-----\n";
3274
3276 }
3277 #endif
3278
3280
3283 {
3285 }
3286}
3287
3289{
3291};
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.