2090{
2092
2100
2110
2112
2114 {
2116 {
2118
2120 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2121
2125 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2126 }
2127 }
2128
2130 {
2132
2134 }
2135
2137 {
2138 super.EEDelete(parent);
2139
2141
2144 }
2145
2147 {
2148 super.EEItemLocationChanged(oldLoc, newLoc);
2149
2152 {
2153 switch (oldLoc.GetParent().GetType())
2154 {
2155 case "FryingPan":
2156 case "Pot":
2157 case "Cauldron":
2158 case "SharpWoodenStick":
2160 break;
2161 }
2162
2165 {
2167 }
2168 }
2169
2170 if (oldLoc.IsValid())
2172
2175 }
2176
2178 {
2181 }
2182
2184 {
2187
2188 return true;
2189 }
2190
2192 {
2194 {
2196 }
2197 }
2198
2201 {
2202 int foodStageType;
2203
2205 if (foodStage)
2206 foodStageType = foodStage.GetFoodStageType();
2207
2212
2213 return agentsIn;
2214 }
2215
2216
2218 {
2219 return false;
2220 }
2221
2223 {
2224 return false;
2225 }
2226
2228 {
2230 {
2232 {
2235
2238
2239 default:
2240 return super.GetTemperatureFreezeTime();
2241 }
2242 }
2243
2244 return super.GetTemperatureFreezeTime();
2245 }
2246
2248 {
2250 {
2252 {
2255
2258
2259 default:
2260 return super.GetTemperatureThawTime();
2261 }
2262 }
2263
2264 return super.GetTemperatureThawTime();
2265 }
2266
2268 {
2270 }
2271
2272
2273
2274
2276 {
2277 SetSynchDirty();
2278 }
2279
2281 {
2282 super.OnVariablesSynchronized();
2283
2284
2285
2286
2288 {
2290 }
2291 else
2292 {
2294 }
2295
2298 }
2299
2300
2301
2302
2304 {
2307
2309 }
2310
2312 {
2313 string soundName = "";
2314
2317
2319 {
2321 }
2322 else
2323 {
2325 {
2327 {
2332 else
2333 soundName = "";
2334 break;
2335 }
2336
2338 {
2343 else
2344 soundName = "";
2345 break;
2346 }
2347
2349 {
2354 else
2355 soundName = "";
2356 break;
2357 }
2358
2359 default:
2360 soundName = "";
2361 break;
2362 }
2363
2365 {
2366 if (soundName == "")
2367 {
2369 }
2370 else
2371 {
2373 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2374 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2376 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2377 {
2379 }
2380 }
2381 }
2382 }
2383
2385 }
2386
2388 {
2391 }
2392
2393
2394
2395
2397 {
2398 super.OnStoreSave(ctx);
2399
2401 {
2403 }
2404
2405
2408 }
2409
2411 {
2412 if (!super.OnStoreLoad(ctx, version))
2413 return false;
2414
2416 {
2418 return false;
2419 }
2420
2421 if (version >= 115)
2422 {
2424 {
2426 return false;
2427 }
2429 {
2431 return false;
2432 }
2433 }
2434
2437
2438 return true;
2439 }
2440
2442 {
2443 super.AfterStoreLoad();
2444
2446 }
2447
2448
2450 {
2452 }
2453
2454
2456 {
2457 return false;
2458 }
2459
2461 {
2462 return false;
2463 }
2464
2466 {
2467 return false;
2468 }
2469
2471 {
2472 return false;
2473 }
2474
2475
2476
2477
2478
2480 {
2483 {
2484 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2485 }
2486 else if (classname != "" && food_stage)
2487 {
2488 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2489 }
2490 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2492
2493 }
2494
2496 {
2499 {
2501 }
2502 else if (classname != "" && food_stage)
2503 {
2504 return FoodStage.GetEnergy(null, food_stage, classname);
2505 }
2506 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2508 }
2509
2511 {
2514 {
2516 }
2517 else if (classname != "" && food_stage)
2518 {
2519 return FoodStage.GetWater(null, food_stage, classname);
2520 }
2521 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2523 }
2524
2526 {
2529 {
2530 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2531 }
2532 else if (classname != "" && food_stage)
2533 {
2534 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2535 }
2536 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2538
2539 }
2540
2542 {
2545 {
2546 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2547 }
2548 else if (classname != "" && food_stage)
2549 {
2550 return FoodStage.GetToxicity(null, food_stage, classname);
2551 }
2552 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2554 }
2555
2557 {
2560 {
2562 }
2563 else if (classname != "" && food_stage)
2564 {
2565 return FoodStage.GetAgents(null, food_stage, classname);
2566 }
2567 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2569 }
2570
2572 {
2575 {
2576 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2577 }
2578 else if (classname != "" && food_stage)
2579 {
2580 return FoodStage.GetDigestibility(null, food_stage, classname);
2581 }
2582 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2584 }
2585
2587 {
2590 {
2591 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2592 }
2593 else if (className != "" && foodStage)
2594 {
2595 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2596 }
2597 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2599 }
2600
2602 {
2612
2613 return profile;
2614 }
2615
2616
2617
2618
2620 {
2622 }
2623
2624
2626 {
2628 {
2630 }
2631
2632 return false;
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
2685
2687 {
2689 }
2690
2692 {
2693 return GetFoodStage().GetNextFoodStageType( cooking_method );
2694 }
2695
2697 {
2698 return GetFoodStage().GetFoodStageName( food_stage_type );
2699 }
2700
2702 {
2703 return GetFoodStage().CanChangeToNewStage( cooking_method );
2704 }
2705
2706
2708 {
2709 if ( !source.GetFoodStage())
2710 return;
2715 }
2716
2719 {
2722 }
2723
2726 {
2727 switch (stageNew)
2728 {
2733 break;
2734
2737 break;
2738 }
2739 }
2740
2741
2742
2743
2744
2746 {
2748 }
2749
2751 {
2753
2754
2756 }
2757
2759 {
2761 {
2764 }
2765 }
2766
2767
2769 {
2771 if (player)
2772 {
2774 player.ServerReplaceItemInHandsWithNew(lambda);
2775 }
2776 else
2777 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2778 }
2779
2781 {
2783 }
2784
2786 {
2787 super.SetActions();
2788
2791 }
2792
2794 {
2795 #ifndef SERVER
2797 {
2799
2802 }
2803 #endif
2804 }
2805
2807 {
2808 #ifndef SERVER
2810 {
2814 }
2815 #endif
2816 }
2817
2819 {
2820 return false;
2821 }
2822
2824 {
2826 }
2827
2828 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2829 {
2831
2832 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2834 if ( hasRootAsPlayer )
2836
2837
2838
2839
2840
2841
2842
2844 {
2845
2847 {
2849 {
2853 break;
2854
2858 break;
2859
2863 break;
2864
2868 default:
2871 return;
2872 }
2873
2874
2875 }
2876
2878
2880 {
2882 {
2883
2885 {
2887 }
2889 {
2892 {
2894 }
2895 else
2896 {
2898 {
2900 }
2901 else
2902 {
2904 }
2905 }
2906 }
2907 }
2908 }
2909
2910 }
2912 {
2913
2915 {
2917 {
2921 break;
2922
2926 break;
2927
2931 break;
2932
2936 break;
2937
2940 default:
2943 return;
2944 }
2945 }
2946
2948
2950 {
2952 {
2953
2955 {
2957 }
2958 }
2959 }
2960 }
2962 {
2963
2965 {
2967 {
2971 break;
2972
2975 default:
2978 return;
2979 }
2980 }
2981
2983
2985 {
2987 {
2988
2990 {
2992 }
2993 }
2994 }
2995 }
2996 else
2997 {
2998
3000
3002 {
3005
3006 }
3007 else
3008 {
3010 {
3013 }
3014 }
3015 }
3016 }
3017
3019 {
3020 if (
GetGame().IsDedicatedServer())
3021 return;
3022
3024 {
3026 GetInventory().GetCurrentInventoryLocation(invLoc);
3028 {
3030 if (ptcMgr)
3031 {
3036 }
3037 }
3038 }
3040 {
3042 {
3045 return;
3046 }
3047
3049 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3051 {
3054 }
3055 }
3056 }
3057
3058 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3059 {
3060 super.GetDebugActions(outputList);
3061
3063 {
3067 }
3068 }
3069
3071 {
3072 super.OnAction(action_id, player, ctx);
3073
3075 {
3076 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3077 {
3079 if (food_stage_prev <= 0)
3080 {
3082 }
3084 return true;
3085 }
3086 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3087 {
3090 {
3092 }
3094 return true;
3095 }
3096
3097 }
3098
3099 #ifdef DIAG_DEVELOPER
3100 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3101 {
3102 PrintNutritionsData();
3103 return true;
3104 }
3105 #endif
3106
3107 return false;
3108 }
3109
3111 {
3112 string debug_output;
3113
3114 debug_output = super.GetDebugText();
3115
3118
3119 return debug_output;
3120 }
3121
3122
3123
3124
3125
3127 {
3128 float ret = super.GetBaitEffectivity();
3129
3131 {
3132 ret *= 0.5;
3133 }
3134
3135 return ret;
3136 }
3137
3139 {
3141 }
3142
3144 {
3146 }
3147
3149 {
3151 }
3152
3153 #ifdef DIAG_DEVELOPER
3154 private void PrintNutritionsData()
3155 {
3156 string nutritionsData = "";
3157
3160
3162 if (profile)
3163 {
3164 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3166 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3170 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3172
3175
3176 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3178 }
3179
3180 nutritionsData += "-----\n";
3181
3183 }
3184 #endif
3185
3187
3190 {
3192 }
3193}
3194
3196{
3198};
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.