2168{
2170
2178
2188
2190
2192 {
2194 {
2196
2198 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2199
2203 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2204 }
2205 }
2206
2208 {
2210
2212 }
2213
2215 {
2216 super.EEDelete(parent);
2217
2219
2222 }
2223
2225 {
2226 super.EEItemLocationChanged(oldLoc, newLoc);
2227
2230 {
2231 switch (oldLoc.GetParent().GetType())
2232 {
2233 case "FryingPan":
2234 case "Pot":
2235 case "Cauldron":
2236 case "SharpWoodenStick":
2238 break;
2239 }
2240
2243 {
2245 }
2246 }
2247
2248 if (oldLoc.IsValid())
2250
2253 }
2254
2256 {
2259 }
2260
2262 {
2265
2266 return true;
2267 }
2268
2270 {
2272 {
2274 }
2275 }
2276
2279 {
2280 int foodStageType;
2281
2283 if (foodStage)
2284 foodStageType = foodStage.GetFoodStageType();
2285
2290
2291 return agentsIn;
2292 }
2293
2294
2296 {
2297 return false;
2298 }
2299
2301 {
2302 return false;
2303 }
2304
2306 {
2308 {
2310 {
2313
2316
2317 default:
2318 return super.GetTemperatureFreezeTime();
2319 }
2320 }
2321
2322 return super.GetTemperatureFreezeTime();
2323 }
2324
2326 {
2328 {
2330 {
2333
2336
2337 default:
2338 return super.GetTemperatureThawTime();
2339 }
2340 }
2341
2342 return super.GetTemperatureThawTime();
2343 }
2344
2346 {
2348 }
2349
2350
2351
2352
2354 {
2355 SetSynchDirty();
2356 }
2357
2359 {
2360 super.OnVariablesSynchronized();
2361
2362
2363
2364
2366 {
2368 }
2369 else
2370 {
2372 }
2373
2376 }
2377
2378
2379
2380
2382 {
2385
2387 }
2388
2390 {
2391 string soundName = "";
2392
2395
2397 {
2399 }
2400 else
2401 {
2403 {
2405 {
2410 else
2411 soundName = "";
2412 break;
2413 }
2414
2416 {
2421 else
2422 soundName = "";
2423 break;
2424 }
2425
2427 {
2432 else
2433 soundName = "";
2434 break;
2435 }
2436
2437 default:
2438 soundName = "";
2439 break;
2440 }
2441
2443 {
2444 if (soundName == "")
2445 {
2447 }
2448 else
2449 {
2451 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2452 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2454 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2455 {
2457 }
2458 }
2459 }
2460 }
2461
2463 }
2464
2466 {
2469 }
2470
2471
2472
2473
2475 {
2476 super.OnStoreSave(ctx);
2477
2479 {
2481 }
2482
2483
2486 }
2487
2489 {
2490 if (!super.OnStoreLoad(ctx, version))
2491 return false;
2492
2494 {
2496 return false;
2497 }
2498
2499 if (version >= 115)
2500 {
2502 {
2504 return false;
2505 }
2507 {
2509 return false;
2510 }
2511 }
2512
2515
2516 return true;
2517 }
2518
2520 {
2521 super.AfterStoreLoad();
2522
2524 }
2525
2526
2528 {
2530 }
2531
2532
2534 {
2535 return false;
2536 }
2537
2539 {
2540 return false;
2541 }
2542
2544 {
2545 return false;
2546 }
2547
2549 {
2550 return false;
2551 }
2552
2553
2554
2555
2556
2558 {
2561 {
2562 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2563 }
2564 else if (classname != "" && food_stage)
2565 {
2566 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2567 }
2568 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2570
2571 }
2572
2574 {
2577 {
2579 }
2580 else if (classname != "" && food_stage)
2581 {
2582 return FoodStage.GetEnergy(null, food_stage, classname);
2583 }
2584 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2586 }
2587
2589 {
2592 {
2594 }
2595 else if (classname != "" && food_stage)
2596 {
2597 return FoodStage.GetWater(null, food_stage, classname);
2598 }
2599 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2601 }
2602
2604 {
2607 {
2608 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2609 }
2610 else if (classname != "" && food_stage)
2611 {
2612 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2613 }
2614 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2616
2617 }
2618
2620 {
2623 {
2624 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2625 }
2626 else if (classname != "" && food_stage)
2627 {
2628 return FoodStage.GetToxicity(null, food_stage, classname);
2629 }
2630 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2632 }
2633
2635 {
2638 {
2640 }
2641 else if (classname != "" && food_stage)
2642 {
2643 return FoodStage.GetAgents(null, food_stage, classname);
2644 }
2645 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2647 }
2648
2650 {
2653 {
2654 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2655 }
2656 else if (classname != "" && food_stage)
2657 {
2658 return FoodStage.GetDigestibility(null, food_stage, classname);
2659 }
2660 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2662 }
2663
2665 {
2668 {
2669 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2670 }
2671 else if (className != "" && foodStage)
2672 {
2673 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2674 }
2675 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2677 }
2678
2680 {
2690
2691 return profile;
2692 }
2693
2694
2695
2696
2698 {
2700 }
2701
2702
2704 {
2706 {
2708 }
2709
2710 return false;
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
2763
2765 {
2767 }
2768
2770 {
2771 return GetFoodStage().GetNextFoodStageType( cooking_method );
2772 }
2773
2775 {
2776 return GetFoodStage().GetFoodStageName( food_stage_type );
2777 }
2778
2780 {
2781 return GetFoodStage().CanChangeToNewStage( cooking_method );
2782 }
2783
2784
2786 {
2787 if ( !source.GetFoodStage())
2788 return;
2793 }
2794
2797 {
2800 }
2801
2804 {
2805 switch (stageNew)
2806 {
2811 break;
2812
2815 break;
2816 }
2817 }
2818
2819
2820
2821
2822
2824 {
2826 }
2827
2829 {
2831
2832
2834 }
2835
2837 {
2839 {
2842 }
2843 }
2844
2845
2847 {
2849 if (player)
2850 {
2852 player.ServerReplaceItemInHandsWithNew(lambda);
2853 }
2854 else
2855 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2856 }
2857
2859 {
2861 }
2862
2864 {
2865 super.SetActions();
2866
2869 }
2870
2872 {
2873 #ifndef SERVER
2875 {
2877
2880 }
2881 #endif
2882 }
2883
2885 {
2886 #ifndef SERVER
2888 {
2892 }
2893 #endif
2894 }
2895
2897 {
2898 return false;
2899 }
2900
2902 {
2904 }
2905
2906 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2907 {
2909
2910 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2912 if ( hasRootAsPlayer )
2914
2915
2916
2917
2918
2919
2920
2922 {
2923
2925 {
2927 {
2931 break;
2932
2936 break;
2937
2941 break;
2942
2946 default:
2949 return;
2950 }
2951
2952
2953 }
2954
2956
2958 {
2960 {
2961
2963 {
2965 }
2967 {
2970 {
2972 }
2973 else
2974 {
2976 {
2978 }
2979 else
2980 {
2982 }
2983 }
2984 }
2985 }
2986 }
2987
2988 }
2990 {
2991
2993 {
2995 {
2999 break;
3000
3004 break;
3005
3009 break;
3010
3014 break;
3015
3018 default:
3021 return;
3022 }
3023 }
3024
3026
3028 {
3030 {
3031
3033 {
3035 }
3036 }
3037 }
3038 }
3040 {
3041
3043 {
3045 {
3049 break;
3050
3053 default:
3056 return;
3057 }
3058 }
3059
3061
3063 {
3065 {
3066
3068 {
3070 }
3071 }
3072 }
3073 }
3074 else
3075 {
3076
3078
3080 {
3083
3084 }
3085 else
3086 {
3088 {
3091 }
3092 }
3093 }
3094 }
3095
3097 {
3098 if (
GetGame().IsDedicatedServer())
3099 return;
3100
3102 {
3104 GetInventory().GetCurrentInventoryLocation(invLoc);
3106 {
3108 if (ptcMgr)
3109 {
3114 }
3115 }
3116 }
3118 {
3120 {
3123 return;
3124 }
3125
3127 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3129 {
3132 }
3133 }
3134 }
3135
3136 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3137 {
3138 super.GetDebugActions(outputList);
3139
3141 {
3145 }
3146 }
3147
3149 {
3150 super.OnAction(action_id, player, ctx);
3151
3153 {
3154 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3155 {
3157 if (food_stage_prev <= 0)
3158 {
3160 }
3162 return true;
3163 }
3164 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3165 {
3168 {
3170 }
3172 return true;
3173 }
3174
3175 }
3176
3177 #ifdef DIAG_DEVELOPER
3178 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3179 {
3180 PrintNutritionsData();
3181 return true;
3182 }
3183 #endif
3184
3185 return false;
3186 }
3187
3189 {
3190 string debug_output;
3191
3192 debug_output = super.GetDebugText();
3193
3196
3197 return debug_output;
3198 }
3199
3200
3201
3202
3203
3205 {
3206 float ret = super.GetBaitEffectivity();
3207
3209 {
3210 ret *= 0.5;
3211 }
3212
3213 return ret;
3214 }
3215
3217 {
3219 }
3220
3222 {
3224 }
3225
3227 {
3229 }
3230
3231 #ifdef DIAG_DEVELOPER
3232 private void PrintNutritionsData()
3233 {
3234 string nutritionsData = "";
3235
3238
3240 if (profile)
3241 {
3242 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3244 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3248 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3250
3253
3254 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3256 }
3257
3258 nutritionsData += "-----\n";
3259
3261 }
3262 #endif
3263
3265
3268 {
3270 }
3271}
3272
3274{
3276};
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.