2100{
2102
2110
2120
2122
2124 {
2126 {
2128
2130 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2131
2135 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2136 }
2137 }
2138
2140 {
2142
2144 }
2145
2147 {
2148 super.EEDelete(parent);
2149
2151
2154 }
2155
2157 {
2158 super.EEItemLocationChanged(oldLoc, newLoc);
2159
2162 {
2163 switch (oldLoc.GetParent().GetType())
2164 {
2165 case "FryingPan":
2166 case "Pot":
2167 case "Cauldron":
2168 case "SharpWoodenStick":
2170 break;
2171 }
2172
2175 {
2177 }
2178 }
2179
2180 if (oldLoc.IsValid())
2182
2185 }
2186
2188 {
2191 }
2192
2194 {
2197
2198 return true;
2199 }
2200
2202 {
2204 {
2206 }
2207 }
2208
2211 {
2212 int foodStageType;
2213
2215 if (foodStage)
2216 foodStageType = foodStage.GetFoodStageType();
2217
2222
2223 return agentsIn;
2224 }
2225
2226
2228 {
2229 return false;
2230 }
2231
2233 {
2234 return false;
2235 }
2236
2238 {
2240 {
2242 {
2245
2248
2249 default:
2250 return super.GetTemperatureFreezeTime();
2251 }
2252 }
2253
2254 return super.GetTemperatureFreezeTime();
2255 }
2256
2258 {
2260 {
2262 {
2265
2268
2269 default:
2270 return super.GetTemperatureThawTime();
2271 }
2272 }
2273
2274 return super.GetTemperatureThawTime();
2275 }
2276
2278 {
2280 }
2281
2282
2283
2284
2286 {
2287 SetSynchDirty();
2288 }
2289
2291 {
2292 super.OnVariablesSynchronized();
2293
2294
2295
2296
2298 {
2300 }
2301 else
2302 {
2304 }
2305
2308 }
2309
2310
2311
2312
2314 {
2317
2319 }
2320
2322 {
2323 string soundName = "";
2324
2327
2329 {
2331 }
2332 else
2333 {
2335 {
2337 {
2342 else
2343 soundName = "";
2344 break;
2345 }
2346
2348 {
2353 else
2354 soundName = "";
2355 break;
2356 }
2357
2359 {
2364 else
2365 soundName = "";
2366 break;
2367 }
2368
2369 default:
2370 soundName = "";
2371 break;
2372 }
2373
2375 {
2376 if (soundName == "")
2377 {
2379 }
2380 else
2381 {
2383 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2384 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2386 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2387 {
2389 }
2390 }
2391 }
2392 }
2393
2395 }
2396
2398 {
2401 }
2402
2403
2404
2405
2407 {
2408 super.OnStoreSave(ctx);
2409
2411 {
2413 }
2414
2415
2418 }
2419
2421 {
2422 if (!super.OnStoreLoad(ctx, version))
2423 return false;
2424
2426 {
2428 return false;
2429 }
2430
2431 if (version >= 115)
2432 {
2434 {
2436 return false;
2437 }
2439 {
2441 return false;
2442 }
2443 }
2444
2447
2448 return true;
2449 }
2450
2452 {
2453 super.AfterStoreLoad();
2454
2456 }
2457
2458
2460 {
2462 }
2463
2464
2466 {
2467 return false;
2468 }
2469
2471 {
2472 return false;
2473 }
2474
2476 {
2477 return false;
2478 }
2479
2481 {
2482 return false;
2483 }
2484
2485
2486
2487
2488
2490 {
2493 {
2494 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2495 }
2496 else if (classname != "" && food_stage)
2497 {
2498 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2499 }
2500 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2501 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2502
2503 }
2504
2506 {
2509 {
2511 }
2512 else if (classname != "" && food_stage)
2513 {
2514 return FoodStage.GetEnergy(null, food_stage, classname);
2515 }
2516 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2517 return g_Game.ConfigGetFloat( class_path +
" energy" );
2518 }
2519
2521 {
2524 {
2526 }
2527 else if (classname != "" && food_stage)
2528 {
2529 return FoodStage.GetWater(null, food_stage, classname);
2530 }
2531 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2532 return g_Game.ConfigGetFloat( class_path +
" water" );
2533 }
2534
2536 {
2539 {
2540 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2541 }
2542 else if (classname != "" && food_stage)
2543 {
2544 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2545 }
2546 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2547 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2548
2549 }
2550
2552 {
2555 {
2556 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2557 }
2558 else if (classname != "" && food_stage)
2559 {
2560 return FoodStage.GetToxicity(null, food_stage, classname);
2561 }
2562 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2563 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2564 }
2565
2567 {
2570 {
2572 }
2573 else if (classname != "" && food_stage)
2574 {
2575 return FoodStage.GetAgents(null, food_stage, classname);
2576 }
2577 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2578 return g_Game.ConfigGetInt( class_path +
" agents" );
2579 }
2580
2582 {
2585 {
2586 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2587 }
2588 else if (classname != "" && food_stage)
2589 {
2590 return FoodStage.GetDigestibility(null, food_stage, classname);
2591 }
2592 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2593 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2594 }
2595
2597 {
2600 {
2601 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2602 }
2603 else if (className != "" && foodStage)
2604 {
2605 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2606 }
2607 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2608 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2609 }
2610
2612 {
2622
2623 return profile;
2624 }
2625
2626
2627
2628
2630 {
2632 }
2633
2634
2636 {
2638 {
2640 }
2641
2642 return false;
2643 }
2644
2646 {
2648 {
2650 }
2651
2652 return false;
2653 }
2654
2656 {
2658 {
2660 }
2661
2662 return false;
2663 }
2664
2666 {
2668 {
2670 }
2671
2672 return false;
2673 }
2674
2676 {
2678 {
2680 }
2681
2682 return false;
2683 }
2684
2686 {
2688 {
2690 }
2691
2692 return false;
2693 }
2694
2695
2697 {
2699 }
2700
2702 {
2703 return GetFoodStage().GetNextFoodStageType( cooking_method );
2704 }
2705
2707 {
2708 return GetFoodStage().GetFoodStageName( food_stage_type );
2709 }
2710
2712 {
2713 return GetFoodStage().CanChangeToNewStage( cooking_method );
2714 }
2715
2716
2718 {
2719 if ( !source.GetFoodStage())
2720 return;
2725 }
2726
2729 {
2732 }
2733
2736 {
2737 switch (stageNew)
2738 {
2743 break;
2744
2747 break;
2748 }
2749 }
2750
2751
2752
2753
2754
2756 {
2758 }
2759
2761 {
2763
2764
2766 }
2767
2769 {
2771 {
2774 }
2775 }
2776
2777
2779 {
2781 if (player)
2782 {
2784 player.ServerReplaceItemInHandsWithNew(lambda);
2785 }
2786 else
2787 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2788 }
2789
2791 {
2793 }
2794
2796 {
2797 super.SetActions();
2798
2801 }
2802
2804 {
2805 #ifndef SERVER
2806 #ifndef NO_GUI
2808 {
2810
2813 }
2814 #endif
2815 #endif
2816 }
2817
2819 {
2820 #ifndef SERVER
2821 #ifndef NO_GUI
2823 {
2827 }
2828 #endif
2829 #endif
2830 }
2831
2833 {
2834 return false;
2835 }
2836
2838 {
2840 }
2841
2842 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2843 {
2845
2846 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2848 if ( hasRootAsPlayer )
2850
2851
2852
2853
2854
2855
2856
2858 {
2859
2861 {
2863 {
2867 break;
2868
2872 break;
2873
2877 break;
2878
2882 default:
2885 return;
2886 }
2887
2888
2889 }
2890
2892
2894 {
2896 {
2897
2899 {
2901 }
2903 {
2906 {
2908 }
2909 else
2910 {
2912 {
2914 }
2915 else
2916 {
2918 }
2919 }
2920 }
2921 }
2922 }
2923
2924 }
2926 {
2927
2929 {
2931 {
2935 break;
2936
2940 break;
2941
2945 break;
2946
2950 break;
2951
2954 default:
2957 return;
2958 }
2959 }
2960
2962
2964 {
2966 {
2967
2969 {
2971 }
2972 }
2973 }
2974 }
2976 {
2977
2979 {
2981 {
2985 break;
2986
2989 default:
2992 return;
2993 }
2994 }
2995
2997
2999 {
3001 {
3002
3004 {
3006 }
3007 }
3008 }
3009 }
3010 else
3011 {
3012
3014
3016 {
3019
3020 }
3021 else
3022 {
3024 {
3027 }
3028 }
3029 }
3030 }
3031
3033 {
3034 if (
g_Game.IsHeadlessOrDedicatedServer())
3035 return;
3036
3038 {
3040 GetInventory().GetCurrentInventoryLocation(invLoc);
3042 {
3044 if (ptcMgr)
3045 {
3050 }
3051 }
3052 }
3054 {
3056 {
3059 return;
3060 }
3061
3063 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3065 {
3068 }
3069 }
3070 }
3071
3072 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3073 {
3075 {
3080 }
3081
3082 super.GetDebugActions(outputList);
3083 }
3084
3086 {
3087 super.OnAction(action_id, player, ctx);
3088
3090 {
3091 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3092 {
3094 if (food_stage_prev <= 0)
3095 {
3097 }
3099 return true;
3100 }
3101 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3102 {
3105 {
3107 }
3109 return true;
3110 }
3111
3112 }
3113
3114 #ifdef DIAG_DEVELOPER
3115 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3116 {
3117 PrintNutritionsData();
3118 return true;
3119 }
3120 #endif
3121
3122 return false;
3123 }
3124
3126 {
3127 string debug_output;
3128
3129 debug_output = super.GetDebugText();
3130
3133
3134 return debug_output;
3135 }
3136
3137
3138
3139
3140
3142 {
3143 float ret = super.GetBaitEffectivity();
3144
3146 {
3147 ret *= 0.5;
3148 }
3149
3150 return ret;
3151 }
3152
3154 {
3156 }
3157
3159 {
3161 }
3162
3164 {
3166 }
3167
3168 #ifdef DIAG_DEVELOPER
3169 private void PrintNutritionsData()
3170 {
3171 string nutritionsData = "";
3172
3175
3177 if (profile)
3178 {
3179 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3181 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3185 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3187
3190
3191 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3193 }
3194
3195 nutritionsData += "-----\n";
3196
3198 }
3199 #endif
3200
3202
3205 {
3207 }
3208}
3209
3211{
3213};
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.