2140{
2142
2150
2160
2162
2164 {
2166 {
2168
2170 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2171
2175 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2176 }
2177 }
2178
2180 {
2182
2184 }
2185
2187 {
2188 super.EEDelete(parent);
2189
2191
2194 }
2195
2197 {
2198 super.EEItemLocationChanged(oldLoc, newLoc);
2199
2202 {
2203 switch (oldLoc.GetParent().GetType())
2204 {
2205 case "FryingPan":
2206 case "Pot":
2207 case "Cauldron":
2208 case "SharpWoodenStick":
2210 break;
2211 }
2212
2215 {
2217 }
2218 }
2219
2220 if (oldLoc.IsValid())
2222
2225 }
2226
2228 {
2231 }
2232
2234 {
2237
2238 return true;
2239 }
2240
2242 {
2244 {
2246 }
2247 }
2248
2251 {
2252 int foodStageType;
2253
2255 if (foodStage)
2256 foodStageType = foodStage.GetFoodStageType();
2257
2262
2263 return agentsIn;
2264 }
2265
2266
2268 {
2269 return false;
2270 }
2271
2273 {
2274 return false;
2275 }
2276
2278 {
2280 {
2282 {
2285
2288
2289 default:
2290 return super.GetTemperatureFreezeTime();
2291 }
2292 }
2293
2294 return super.GetTemperatureFreezeTime();
2295 }
2296
2298 {
2300 {
2302 {
2305
2308
2309 default:
2310 return super.GetTemperatureThawTime();
2311 }
2312 }
2313
2314 return super.GetTemperatureThawTime();
2315 }
2316
2318 {
2320 }
2321
2322
2323
2324
2326 {
2327 SetSynchDirty();
2328 }
2329
2331 {
2332 super.OnVariablesSynchronized();
2333
2334
2335
2336
2338 {
2340 }
2341 else
2342 {
2344 }
2345
2348 }
2349
2350
2351
2352
2354 {
2357
2359 }
2360
2362 {
2363 string soundName = "";
2364
2367
2369 {
2371 }
2372 else
2373 {
2375 {
2377 {
2382 else
2383 soundName = "";
2384 break;
2385 }
2386
2388 {
2393 else
2394 soundName = "";
2395 break;
2396 }
2397
2399 {
2404 else
2405 soundName = "";
2406 break;
2407 }
2408
2409 default:
2410 soundName = "";
2411 break;
2412 }
2413
2415 {
2416 if (soundName == "")
2417 {
2419 }
2420 else
2421 {
2423 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2424 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2426 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2427 {
2429 }
2430 }
2431 }
2432 }
2433
2435 }
2436
2438 {
2441 }
2442
2443
2444
2445
2447 {
2448 super.OnStoreSave(ctx);
2449
2451 {
2453 }
2454
2455
2458 }
2459
2461 {
2462 if (!super.OnStoreLoad(ctx, version))
2463 return false;
2464
2466 {
2468 return false;
2469 }
2470
2471 if (version >= 115)
2472 {
2474 {
2476 return false;
2477 }
2479 {
2481 return false;
2482 }
2483 }
2484
2487
2488 return true;
2489 }
2490
2492 {
2493 super.AfterStoreLoad();
2494
2496 }
2497
2498
2500 {
2502 }
2503
2504
2506 {
2507 return false;
2508 }
2509
2511 {
2512 return false;
2513 }
2514
2516 {
2517 return false;
2518 }
2519
2521 {
2522 return false;
2523 }
2524
2525
2526
2527
2528
2530 {
2533 {
2534 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2535 }
2536 else if (classname != "" && food_stage)
2537 {
2538 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2539 }
2540 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2541 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2542
2543 }
2544
2546 {
2549 {
2551 }
2552 else if (classname != "" && food_stage)
2553 {
2554 return FoodStage.GetEnergy(null, food_stage, classname);
2555 }
2556 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2557 return g_Game.ConfigGetFloat( class_path +
" energy" );
2558 }
2559
2561 {
2564 {
2566 }
2567 else if (classname != "" && food_stage)
2568 {
2569 return FoodStage.GetWater(null, food_stage, classname);
2570 }
2571 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2572 return g_Game.ConfigGetFloat( class_path +
" water" );
2573 }
2574
2576 {
2579 {
2580 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2581 }
2582 else if (classname != "" && food_stage)
2583 {
2584 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2585 }
2586 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2587 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2588
2589 }
2590
2592 {
2595 {
2596 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2597 }
2598 else if (classname != "" && food_stage)
2599 {
2600 return FoodStage.GetToxicity(null, food_stage, classname);
2601 }
2602 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2603 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2604 }
2605
2607 {
2610 {
2612 }
2613 else if (classname != "" && food_stage)
2614 {
2615 return FoodStage.GetAgents(null, food_stage, classname);
2616 }
2617 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2618 return g_Game.ConfigGetInt( class_path +
" agents" );
2619 }
2620
2622 {
2625 {
2626 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2627 }
2628 else if (classname != "" && food_stage)
2629 {
2630 return FoodStage.GetDigestibility(null, food_stage, classname);
2631 }
2632 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2633 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2634 }
2635
2637 {
2640 {
2641 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2642 }
2643 else if (className != "" && foodStage)
2644 {
2645 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2646 }
2647 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2648 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2649 }
2650
2652 {
2662
2663 return profile;
2664 }
2665
2666
2667
2668
2670 {
2672 }
2673
2674
2676 {
2678 {
2680 }
2681
2682 return false;
2683 }
2684
2686 {
2688 {
2690 }
2691
2692 return false;
2693 }
2694
2696 {
2698 {
2700 }
2701
2702 return false;
2703 }
2704
2706 {
2708 {
2710 }
2711
2712 return false;
2713 }
2714
2716 {
2718 {
2720 }
2721
2722 return false;
2723 }
2724
2726 {
2728 {
2730 }
2731
2732 return false;
2733 }
2734
2735
2737 {
2739 }
2740
2742 {
2743 return GetFoodStage().GetNextFoodStageType( cooking_method );
2744 }
2745
2747 {
2748 return GetFoodStage().GetFoodStageName( food_stage_type );
2749 }
2750
2752 {
2753 return GetFoodStage().CanChangeToNewStage( cooking_method );
2754 }
2755
2756
2758 {
2759 if ( !source.GetFoodStage())
2760 return;
2765 }
2766
2769 {
2772 }
2773
2776 {
2777 switch (stageNew)
2778 {
2783 break;
2784
2787 break;
2788 }
2789 }
2790
2791
2792
2793
2794
2796 {
2798 }
2799
2801 {
2803
2804
2806 }
2807
2809 {
2811 {
2814 }
2815 }
2816
2817
2819 {
2821 if (player)
2822 {
2824 player.ServerReplaceItemInHandsWithNew(lambda);
2825 }
2826 else
2827 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2828 }
2829
2831 {
2833 }
2834
2836 {
2837 super.SetActions();
2838
2841 }
2842
2844 {
2845 #ifndef SERVER
2846 #ifndef NO_GUI
2848 {
2850
2853 }
2854 #endif
2855 #endif
2856 }
2857
2859 {
2860 #ifndef SERVER
2861 #ifndef NO_GUI
2863 {
2867 }
2868 #endif
2869 #endif
2870 }
2871
2873 {
2874 return false;
2875 }
2876
2878 {
2880 }
2881
2882 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2883 {
2885
2886 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2888 if ( hasRootAsPlayer )
2890
2891
2892
2893
2894
2895
2896
2898 {
2899
2901 {
2903 {
2907 break;
2908
2912 break;
2913
2917 break;
2918
2922 default:
2925 return;
2926 }
2927
2928
2929 }
2930
2932
2934 {
2936 {
2937
2939 {
2941 }
2943 {
2946 {
2948 }
2949 else
2950 {
2952 {
2954 }
2955 else
2956 {
2958 }
2959 }
2960 }
2961 }
2962 }
2963
2964 }
2966 {
2967
2969 {
2971 {
2975 break;
2976
2980 break;
2981
2985 break;
2986
2990 break;
2991
2994 default:
2997 return;
2998 }
2999 }
3000
3002
3004 {
3006 {
3007
3009 {
3011 }
3012 }
3013 }
3014 }
3016 {
3017
3019 {
3021 {
3025 break;
3026
3029 default:
3032 return;
3033 }
3034 }
3035
3037
3039 {
3041 {
3042
3044 {
3046 }
3047 }
3048 }
3049 }
3050 else
3051 {
3052
3054
3056 {
3059
3060 }
3061 else
3062 {
3064 {
3067 }
3068 }
3069 }
3070 }
3071
3073 {
3074 if (
g_Game.IsHeadlessOrDedicatedServer())
3075 return;
3076
3078 {
3080 GetInventory().GetCurrentInventoryLocation(invLoc);
3082 {
3084 if (ptcMgr)
3085 {
3090 }
3091 }
3092 }
3094 {
3096 {
3099 return;
3100 }
3101
3103 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3105 {
3108 }
3109 }
3110 }
3111
3112 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3113 {
3115 {
3120 }
3121
3122 super.GetDebugActions(outputList);
3123 }
3124
3126 {
3127 super.OnAction(action_id, player, ctx);
3128
3130 {
3131 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3132 {
3134 if (food_stage_prev <= 0)
3135 {
3137 }
3139 return true;
3140 }
3141 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3142 {
3145 {
3147 }
3149 return true;
3150 }
3151
3152 }
3153
3154 #ifdef DIAG_DEVELOPER
3155 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3156 {
3157 PrintNutritionsData();
3158 return true;
3159 }
3160 #endif
3161
3162 return false;
3163 }
3164
3166 {
3167 string debug_output;
3168
3169 debug_output = super.GetDebugText();
3170
3173
3174 return debug_output;
3175 }
3176
3177
3178
3179
3180
3182 {
3183 float ret = super.GetBaitEffectivity();
3184
3186 {
3187 ret *= 0.5;
3188 }
3189
3190 return ret;
3191 }
3192
3194 {
3196 }
3197
3199 {
3201 }
3202
3204 {
3206 }
3207
3208 #ifdef DIAG_DEVELOPER
3209 private void PrintNutritionsData()
3210 {
3211 string nutritionsData = "";
3212
3215
3217 if (profile)
3218 {
3219 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3221 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3225 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3227
3230
3231 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3233 }
3234
3235 nutritionsData += "-----\n";
3236
3238 }
3239 #endif
3240
3242
3245 {
3247 }
3248}
3249
3251{
3253};
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.