2132{
2134
2142
2152
2154
2156 {
2158 {
2160
2162 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2163
2167 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2168 }
2169 }
2170
2172 {
2174
2176 }
2177
2179 {
2180 super.EEDelete(parent);
2181
2183
2186 }
2187
2189 {
2190 super.EEItemLocationChanged(oldLoc, newLoc);
2191
2194 {
2195 switch (oldLoc.GetParent().GetType())
2196 {
2197 case "FryingPan":
2198 case "Pot":
2199 case "Cauldron":
2200 case "SharpWoodenStick":
2202 break;
2203 }
2204
2207 {
2209 }
2210 }
2211
2212 if (oldLoc.IsValid())
2214
2217 }
2218
2220 {
2223 }
2224
2226 {
2229
2230 return true;
2231 }
2232
2234 {
2236 {
2238 }
2239 }
2240
2243 {
2244 int foodStageType;
2245
2247 if (foodStage)
2248 foodStageType = foodStage.GetFoodStageType();
2249
2254
2255 return agentsIn;
2256 }
2257
2258
2260 {
2261 return false;
2262 }
2263
2265 {
2266 return false;
2267 }
2268
2270 {
2272 {
2274 {
2277
2280
2281 default:
2282 return super.GetTemperatureFreezeTime();
2283 }
2284 }
2285
2286 return super.GetTemperatureFreezeTime();
2287 }
2288
2290 {
2292 {
2294 {
2297
2300
2301 default:
2302 return super.GetTemperatureThawTime();
2303 }
2304 }
2305
2306 return super.GetTemperatureThawTime();
2307 }
2308
2310 {
2312 }
2313
2314
2315
2316
2318 {
2319 SetSynchDirty();
2320 }
2321
2323 {
2324 super.OnVariablesSynchronized();
2325
2326
2327
2328
2330 {
2332 }
2333 else
2334 {
2336 }
2337
2340 }
2341
2342
2343
2344
2346 {
2349
2351 }
2352
2354 {
2355 string soundName = "";
2356
2359
2361 {
2363 }
2364 else
2365 {
2367 {
2369 {
2374 else
2375 soundName = "";
2376 break;
2377 }
2378
2380 {
2385 else
2386 soundName = "";
2387 break;
2388 }
2389
2391 {
2396 else
2397 soundName = "";
2398 break;
2399 }
2400
2401 default:
2402 soundName = "";
2403 break;
2404 }
2405
2407 {
2408 if (soundName == "")
2409 {
2411 }
2412 else
2413 {
2415 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2416 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2418 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2419 {
2421 }
2422 }
2423 }
2424 }
2425
2427 }
2428
2430 {
2433 }
2434
2435
2436
2437
2439 {
2440 super.OnStoreSave(ctx);
2441
2443 {
2445 }
2446
2447
2450 }
2451
2453 {
2454 if (!super.OnStoreLoad(ctx, version))
2455 return false;
2456
2458 {
2460 return false;
2461 }
2462
2463 if (version >= 115)
2464 {
2466 {
2468 return false;
2469 }
2471 {
2473 return false;
2474 }
2475 }
2476
2479
2480 return true;
2481 }
2482
2484 {
2485 super.AfterStoreLoad();
2486
2488 }
2489
2490
2492 {
2494 }
2495
2496
2498 {
2499 return false;
2500 }
2501
2503 {
2504 return false;
2505 }
2506
2508 {
2509 return false;
2510 }
2511
2513 {
2514 return false;
2515 }
2516
2517
2518
2519
2520
2522 {
2525 {
2526 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2527 }
2528 else if (classname != "" && food_stage)
2529 {
2530 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2531 }
2532 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2534
2535 }
2536
2538 {
2541 {
2543 }
2544 else if (classname != "" && food_stage)
2545 {
2546 return FoodStage.GetEnergy(null, food_stage, classname);
2547 }
2548 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2550 }
2551
2553 {
2556 {
2558 }
2559 else if (classname != "" && food_stage)
2560 {
2561 return FoodStage.GetWater(null, food_stage, classname);
2562 }
2563 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2565 }
2566
2568 {
2571 {
2572 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2573 }
2574 else if (classname != "" && food_stage)
2575 {
2576 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2577 }
2578 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2580
2581 }
2582
2584 {
2587 {
2588 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2589 }
2590 else if (classname != "" && food_stage)
2591 {
2592 return FoodStage.GetToxicity(null, food_stage, classname);
2593 }
2594 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2596 }
2597
2599 {
2602 {
2604 }
2605 else if (classname != "" && food_stage)
2606 {
2607 return FoodStage.GetAgents(null, food_stage, classname);
2608 }
2609 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2611 }
2612
2614 {
2617 {
2618 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2619 }
2620 else if (classname != "" && food_stage)
2621 {
2622 return FoodStage.GetDigestibility(null, food_stage, classname);
2623 }
2624 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2626 }
2627
2629 {
2632 {
2633 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2634 }
2635 else if (className != "" && foodStage)
2636 {
2637 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2638 }
2639 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2641 }
2642
2644 {
2654
2655 return profile;
2656 }
2657
2658
2659
2660
2662 {
2664 }
2665
2666
2668 {
2670 {
2672 }
2673
2674 return false;
2675 }
2676
2678 {
2680 {
2682 }
2683
2684 return false;
2685 }
2686
2688 {
2690 {
2692 }
2693
2694 return false;
2695 }
2696
2698 {
2700 {
2702 }
2703
2704 return false;
2705 }
2706
2708 {
2710 {
2712 }
2713
2714 return false;
2715 }
2716
2718 {
2720 {
2722 }
2723
2724 return false;
2725 }
2726
2727
2729 {
2731 }
2732
2734 {
2735 return GetFoodStage().GetNextFoodStageType( cooking_method );
2736 }
2737
2739 {
2740 return GetFoodStage().GetFoodStageName( food_stage_type );
2741 }
2742
2744 {
2745 return GetFoodStage().CanChangeToNewStage( cooking_method );
2746 }
2747
2748
2750 {
2751 if ( !source.GetFoodStage())
2752 return;
2757 }
2758
2761 {
2764 }
2765
2768 {
2769 switch (stageNew)
2770 {
2775 break;
2776
2779 break;
2780 }
2781 }
2782
2783
2784
2785
2786
2788 {
2790 }
2791
2793 {
2795
2796
2798 }
2799
2801 {
2803 {
2806 }
2807 }
2808
2809
2811 {
2813 if (player)
2814 {
2816 player.ServerReplaceItemInHandsWithNew(lambda);
2817 }
2818 else
2819 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2820 }
2821
2823 {
2825 }
2826
2828 {
2829 super.SetActions();
2830
2833 }
2834
2836 {
2837 #ifndef SERVER
2839 {
2841
2844 }
2845 #endif
2846 }
2847
2849 {
2850 #ifndef SERVER
2852 {
2856 }
2857 #endif
2858 }
2859
2861 {
2862 return false;
2863 }
2864
2866 {
2868 }
2869
2870 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2871 {
2873
2874 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2876 if ( hasRootAsPlayer )
2878
2879
2880
2881
2882
2883
2884
2886 {
2887
2889 {
2891 {
2895 break;
2896
2900 break;
2901
2905 break;
2906
2910 default:
2913 return;
2914 }
2915
2916
2917 }
2918
2920
2922 {
2924 {
2925
2927 {
2929 }
2931 {
2934 {
2936 }
2937 else
2938 {
2940 {
2942 }
2943 else
2944 {
2946 }
2947 }
2948 }
2949 }
2950 }
2951
2952 }
2954 {
2955
2957 {
2959 {
2963 break;
2964
2968 break;
2969
2973 break;
2974
2978 break;
2979
2982 default:
2985 return;
2986 }
2987 }
2988
2990
2992 {
2994 {
2995
2997 {
2999 }
3000 }
3001 }
3002 }
3004 {
3005
3007 {
3009 {
3013 break;
3014
3017 default:
3020 return;
3021 }
3022 }
3023
3025
3027 {
3029 {
3030
3032 {
3034 }
3035 }
3036 }
3037 }
3038 else
3039 {
3040
3042
3044 {
3047
3048 }
3049 else
3050 {
3052 {
3055 }
3056 }
3057 }
3058 }
3059
3061 {
3062 if (
GetGame().IsDedicatedServer())
3063 return;
3064
3066 {
3068 GetInventory().GetCurrentInventoryLocation(invLoc);
3070 {
3072 if (ptcMgr)
3073 {
3078 }
3079 }
3080 }
3082 {
3084 {
3087 return;
3088 }
3089
3091 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3093 {
3096 }
3097 }
3098 }
3099
3100 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3101 {
3103 {
3108 }
3109
3110 super.GetDebugActions(outputList);
3111 }
3112
3114 {
3115 super.OnAction(action_id, player, ctx);
3116
3118 {
3119 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3120 {
3122 if (food_stage_prev <= 0)
3123 {
3125 }
3127 return true;
3128 }
3129 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3130 {
3133 {
3135 }
3137 return true;
3138 }
3139
3140 }
3141
3142 #ifdef DIAG_DEVELOPER
3143 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3144 {
3145 PrintNutritionsData();
3146 return true;
3147 }
3148 #endif
3149
3150 return false;
3151 }
3152
3154 {
3155 string debug_output;
3156
3157 debug_output = super.GetDebugText();
3158
3161
3162 return debug_output;
3163 }
3164
3165
3166
3167
3168
3170 {
3171 float ret = super.GetBaitEffectivity();
3172
3174 {
3175 ret *= 0.5;
3176 }
3177
3178 return ret;
3179 }
3180
3182 {
3184 }
3185
3187 {
3189 }
3190
3192 {
3194 }
3195
3196 #ifdef DIAG_DEVELOPER
3197 private void PrintNutritionsData()
3198 {
3199 string nutritionsData = "";
3200
3203
3205 if (profile)
3206 {
3207 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3209 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3213 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3215
3218
3219 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3221 }
3222
3223 nutritionsData += "-----\n";
3224
3226 }
3227 #endif
3228
3230
3233 {
3235 }
3236}
3237
3239{
3241};
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 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.