2211{
2213
2221
2231
2233
2235 {
2237 {
2239
2241 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2242
2246 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2247 }
2248 }
2249
2251 {
2253
2255 }
2256
2258 {
2259 super.EEDelete(parent);
2260
2262
2265 }
2266
2268 {
2269 super.EEItemLocationChanged(oldLoc, newLoc);
2270
2273 {
2274 switch (oldLoc.GetParent().GetType())
2275 {
2276 case "FryingPan":
2277 case "Pot":
2278 case "Cauldron":
2279 case "SharpWoodenStick":
2281 break;
2282 }
2283
2286 {
2288 }
2289 }
2290
2291 if (oldLoc.IsValid())
2293
2296 }
2297
2299 {
2302 }
2303
2305 {
2308
2309 return true;
2310 }
2311
2313 {
2315 {
2317 }
2318 }
2319
2322 {
2323 int foodStageType;
2324
2326 if (foodStage)
2327 foodStageType = foodStage.GetFoodStageType();
2328
2333
2334 return agentsIn;
2335 }
2336
2337
2339 {
2340 return false;
2341 }
2342
2344 {
2345 return false;
2346 }
2347
2349 {
2351 {
2353 {
2356
2359
2360 default:
2361 return super.GetTemperatureFreezeTime();
2362 }
2363 }
2364
2365 return super.GetTemperatureFreezeTime();
2366 }
2367
2369 {
2371 {
2373 {
2376
2379
2380 default:
2381 return super.GetTemperatureThawTime();
2382 }
2383 }
2384
2385 return super.GetTemperatureThawTime();
2386 }
2387
2389 {
2391 }
2392
2393
2394
2395
2397 {
2398 SetSynchDirty();
2399 }
2400
2402 {
2403 super.OnVariablesSynchronized();
2404
2405
2406
2407
2409 {
2411 }
2412 else
2413 {
2415 }
2416
2419 }
2420
2421
2422
2423
2425 {
2428
2430 }
2431
2433 {
2434 string soundName = "";
2435
2438
2440 {
2442 }
2443 else
2444 {
2446 {
2448 {
2453 else
2454 soundName = "";
2455 break;
2456 }
2457
2459 {
2464 else
2465 soundName = "";
2466 break;
2467 }
2468
2470 {
2475 else
2476 soundName = "";
2477 break;
2478 }
2479
2480 default:
2481 soundName = "";
2482 break;
2483 }
2484
2486 {
2487 if (soundName == "")
2488 {
2490 }
2491 else
2492 {
2494 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2495 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2497 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2498 {
2500 }
2501 }
2502 }
2503 }
2504
2506 }
2507
2509 {
2512 }
2513
2514
2515
2516
2518 {
2519 super.OnStoreSave(ctx);
2520
2522 {
2524 }
2525
2526
2529 }
2530
2532 {
2533 if (!super.OnStoreLoad(ctx, version))
2534 return false;
2535
2537 {
2539 return false;
2540 }
2541
2542 if (version >= 115)
2543 {
2545 {
2547 return false;
2548 }
2550 {
2552 return false;
2553 }
2554 }
2555
2558
2559 return true;
2560 }
2561
2563 {
2564 super.AfterStoreLoad();
2565
2567 }
2568
2569
2571 {
2573 }
2574
2575
2577 {
2578 return false;
2579 }
2580
2582 {
2583 return false;
2584 }
2585
2587 {
2588 return false;
2589 }
2590
2592 {
2593 return false;
2594 }
2595
2596
2597
2598
2599
2601 {
2604 {
2605 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2606 }
2607 else if (classname != "" && food_stage)
2608 {
2609 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2610 }
2611 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2613
2614 }
2615
2617 {
2620 {
2622 }
2623 else if (classname != "" && food_stage)
2624 {
2625 return FoodStage.GetEnergy(null, food_stage, classname);
2626 }
2627 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2629 }
2630
2632 {
2635 {
2637 }
2638 else if (classname != "" && food_stage)
2639 {
2640 return FoodStage.GetWater(null, food_stage, classname);
2641 }
2642 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2644 }
2645
2647 {
2650 {
2651 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2652 }
2653 else if (classname != "" && food_stage)
2654 {
2655 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2656 }
2657 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2659
2660 }
2661
2663 {
2666 {
2667 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2668 }
2669 else if (classname != "" && food_stage)
2670 {
2671 return FoodStage.GetToxicity(null, food_stage, classname);
2672 }
2673 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2675 }
2676
2678 {
2681 {
2683 }
2684 else if (classname != "" && food_stage)
2685 {
2686 return FoodStage.GetAgents(null, food_stage, classname);
2687 }
2688 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2690 }
2691
2693 {
2696 {
2697 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2698 }
2699 else if (classname != "" && food_stage)
2700 {
2701 return FoodStage.GetDigestibility(null, food_stage, classname);
2702 }
2703 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2705 }
2706
2708 {
2711 {
2712 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2713 }
2714 else if (className != "" && foodStage)
2715 {
2716 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2717 }
2718 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2720 }
2721
2723 {
2733
2734 return profile;
2735 }
2736
2737
2738
2739
2741 {
2743 }
2744
2745
2747 {
2749 {
2751 }
2752
2753 return false;
2754 }
2755
2757 {
2759 {
2761 }
2762
2763 return false;
2764 }
2765
2767 {
2769 {
2771 }
2772
2773 return false;
2774 }
2775
2777 {
2779 {
2781 }
2782
2783 return false;
2784 }
2785
2787 {
2789 {
2791 }
2792
2793 return false;
2794 }
2795
2797 {
2799 {
2801 }
2802
2803 return false;
2804 }
2805
2806
2808 {
2810 }
2811
2813 {
2814 return GetFoodStage().GetNextFoodStageType( cooking_method );
2815 }
2816
2818 {
2819 return GetFoodStage().GetFoodStageName( food_stage_type );
2820 }
2821
2823 {
2824 return GetFoodStage().CanChangeToNewStage( cooking_method );
2825 }
2826
2827
2829 {
2830 if ( !source.GetFoodStage())
2831 return;
2836 }
2837
2840 {
2843 }
2844
2847 {
2848 switch (stageNew)
2849 {
2854 break;
2855
2858 break;
2859 }
2860 }
2861
2862
2863
2864
2865
2867 {
2869 }
2870
2872 {
2874
2875
2877 }
2878
2880 {
2882 {
2885 }
2886 }
2887
2888
2890 {
2892 if (player)
2893 {
2895 player.ServerReplaceItemInHandsWithNew(lambda);
2896 }
2897 else
2898 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2899 }
2900
2902 {
2904 }
2905
2907 {
2908 super.SetActions();
2909
2912 }
2913
2915 {
2916 #ifndef SERVER
2918 {
2920
2923 }
2924 #endif
2925 }
2926
2928 {
2929 #ifndef SERVER
2931 {
2935 }
2936 #endif
2937 }
2938
2940 {
2941 return false;
2942 }
2943
2945 {
2947 }
2948
2949 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2950 {
2952
2953 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2955 if ( hasRootAsPlayer )
2957
2958
2959
2960
2961
2962
2963
2965 {
2966
2968 {
2970 {
2974 break;
2975
2979 break;
2980
2984 break;
2985
2989 default:
2992 return;
2993 }
2994
2995
2996 }
2997
2999
3001 {
3003 {
3004
3006 {
3008 }
3010 {
3013 {
3015 }
3016 else
3017 {
3019 {
3021 }
3022 else
3023 {
3025 }
3026 }
3027 }
3028 }
3029 }
3030
3031 }
3033 {
3034
3036 {
3038 {
3042 break;
3043
3047 break;
3048
3052 break;
3053
3057 break;
3058
3061 default:
3064 return;
3065 }
3066 }
3067
3069
3071 {
3073 {
3074
3076 {
3078 }
3079 }
3080 }
3081 }
3083 {
3084
3086 {
3088 {
3092 break;
3093
3096 default:
3099 return;
3100 }
3101 }
3102
3104
3106 {
3108 {
3109
3111 {
3113 }
3114 }
3115 }
3116 }
3117 else
3118 {
3119
3121
3123 {
3126
3127 }
3128 else
3129 {
3131 {
3134 }
3135 }
3136 }
3137 }
3138
3140 {
3141 if (
GetGame().IsDedicatedServer())
3142 return;
3143
3145 {
3147 GetInventory().GetCurrentInventoryLocation(invLoc);
3149 {
3151 if (ptcMgr)
3152 {
3157 }
3158 }
3159 }
3161 {
3163 {
3166 return;
3167 }
3168
3170 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3172 {
3175 }
3176 }
3177 }
3178
3179 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3180 {
3182 {
3187 }
3188
3189 super.GetDebugActions(outputList);
3190 }
3191
3193 {
3194 super.OnAction(action_id, player, ctx);
3195
3197 {
3198 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3199 {
3201 if (food_stage_prev <= 0)
3202 {
3204 }
3206 return true;
3207 }
3208 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3209 {
3212 {
3214 }
3216 return true;
3217 }
3218
3219 }
3220
3221 #ifdef DIAG_DEVELOPER
3222 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3223 {
3224 PrintNutritionsData();
3225 return true;
3226 }
3227 #endif
3228
3229 return false;
3230 }
3231
3233 {
3234 string debug_output;
3235
3236 debug_output = super.GetDebugText();
3237
3240
3241 return debug_output;
3242 }
3243
3244
3245
3246
3247
3249 {
3250 float ret = super.GetBaitEffectivity();
3251
3253 {
3254 ret *= 0.5;
3255 }
3256
3257 return ret;
3258 }
3259
3261 {
3263 }
3264
3266 {
3268 }
3269
3271 {
3273 }
3274
3275 #ifdef DIAG_DEVELOPER
3276 private void PrintNutritionsData()
3277 {
3278 string nutritionsData = "";
3279
3282
3284 if (profile)
3285 {
3286 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3288 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3292 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3294
3297
3298 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3300 }
3301
3302 nutritionsData += "-----\n";
3303
3305 }
3306 #endif
3307
3309
3312 {
3314 }
3315}
3316
3318{
3320};
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.