2156{
2158
2166
2176
2178
2180 {
2182 {
2184
2186 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2187
2191 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2192 }
2193 }
2194
2196 {
2198
2200 }
2201
2203 {
2204 super.EEDelete(parent);
2205
2207
2210 }
2211
2213 {
2214 super.EEItemLocationChanged(oldLoc, newLoc);
2215
2218 {
2219 switch (oldLoc.GetParent().GetType())
2220 {
2221 case "FryingPan":
2222 case "Pot":
2223 case "Cauldron":
2224 case "SharpWoodenStick":
2226 break;
2227 }
2228
2231 {
2233 }
2234 }
2235
2236 if (oldLoc.IsValid())
2238
2241 }
2242
2244 {
2247 }
2248
2250 {
2253
2254 return true;
2255 }
2256
2258 {
2260 {
2262 }
2263 }
2264
2267 {
2268 int foodStageType;
2269
2271 if (foodStage)
2272 foodStageType = foodStage.GetFoodStageType();
2273
2278
2279 return agentsIn;
2280 }
2281
2282
2284 {
2285 return false;
2286 }
2287
2289 {
2290 return false;
2291 }
2292
2294 {
2296 {
2298 {
2301
2304
2305 default:
2306 return super.GetTemperatureFreezeTime();
2307 }
2308 }
2309
2310 return super.GetTemperatureFreezeTime();
2311 }
2312
2314 {
2316 {
2318 {
2321
2324
2325 default:
2326 return super.GetTemperatureThawTime();
2327 }
2328 }
2329
2330 return super.GetTemperatureThawTime();
2331 }
2332
2334 {
2336 }
2337
2338
2339
2340
2342 {
2343 SetSynchDirty();
2344 }
2345
2347 {
2348 super.OnVariablesSynchronized();
2349
2350
2351
2352
2354 {
2356 }
2357 else
2358 {
2360 }
2361
2364 }
2365
2366
2367
2368
2370 {
2373
2375 }
2376
2378 {
2379 string soundName = "";
2380
2383
2385 {
2387 }
2388 else
2389 {
2391 {
2393 {
2398 else
2399 soundName = "";
2400 break;
2401 }
2402
2404 {
2409 else
2410 soundName = "";
2411 break;
2412 }
2413
2415 {
2420 else
2421 soundName = "";
2422 break;
2423 }
2424
2425 default:
2426 soundName = "";
2427 break;
2428 }
2429
2431 {
2432 if (soundName == "")
2433 {
2435 }
2436 else
2437 {
2439 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2440 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2442 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2443 {
2445 }
2446 }
2447 }
2448 }
2449
2451 }
2452
2454 {
2457 }
2458
2459
2460
2461
2463 {
2464 super.OnStoreSave(ctx);
2465
2467 {
2469 }
2470
2471
2474 }
2475
2477 {
2478 if (!super.OnStoreLoad(ctx, version))
2479 return false;
2480
2482 {
2484 return false;
2485 }
2486
2487 if (version >= 115)
2488 {
2490 {
2492 return false;
2493 }
2495 {
2497 return false;
2498 }
2499 }
2500
2503
2504 return true;
2505 }
2506
2508 {
2509 super.AfterStoreLoad();
2510
2512 }
2513
2514
2516 {
2518 }
2519
2520
2522 {
2523 return false;
2524 }
2525
2527 {
2528 return false;
2529 }
2530
2532 {
2533 return false;
2534 }
2535
2537 {
2538 return false;
2539 }
2540
2541
2542
2543
2544
2546 {
2549 {
2550 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2551 }
2552 else if (classname != "" && food_stage)
2553 {
2554 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2555 }
2556 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2557 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2558
2559 }
2560
2562 {
2565 {
2567 }
2568 else if (classname != "" && food_stage)
2569 {
2570 return FoodStage.GetEnergy(null, food_stage, classname);
2571 }
2572 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2573 return g_Game.ConfigGetFloat( class_path +
" energy" );
2574 }
2575
2577 {
2580 {
2582 }
2583 else if (classname != "" && food_stage)
2584 {
2585 return FoodStage.GetWater(null, food_stage, classname);
2586 }
2587 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2588 return g_Game.ConfigGetFloat( class_path +
" water" );
2589 }
2590
2592 {
2595 {
2596 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2597 }
2598 else if (classname != "" && food_stage)
2599 {
2600 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2601 }
2602 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2603 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2604
2605 }
2606
2608 {
2611 {
2612 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2613 }
2614 else if (classname != "" && food_stage)
2615 {
2616 return FoodStage.GetToxicity(null, food_stage, classname);
2617 }
2618 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2619 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2620 }
2621
2623 {
2626 {
2628 }
2629 else if (classname != "" && food_stage)
2630 {
2631 return FoodStage.GetAgents(null, food_stage, classname);
2632 }
2633 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2634 return g_Game.ConfigGetInt( class_path +
" agents" );
2635 }
2636
2638 {
2641 {
2642 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2643 }
2644 else if (classname != "" && food_stage)
2645 {
2646 return FoodStage.GetDigestibility(null, food_stage, classname);
2647 }
2648 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2649 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2650 }
2651
2653 {
2656 {
2657 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2658 }
2659 else if (className != "" && foodStage)
2660 {
2661 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2662 }
2663 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2664 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2665 }
2666
2668 {
2678
2679 return profile;
2680 }
2681
2682
2683
2684
2686 {
2688 }
2689
2690
2692 {
2694 {
2696 }
2697
2698 return false;
2699 }
2700
2702 {
2704 {
2706 }
2707
2708 return false;
2709 }
2710
2712 {
2714 {
2716 }
2717
2718 return false;
2719 }
2720
2722 {
2724 {
2726 }
2727
2728 return false;
2729 }
2730
2732 {
2734 {
2736 }
2737
2738 return false;
2739 }
2740
2742 {
2744 {
2746 }
2747
2748 return false;
2749 }
2750
2751
2753 {
2755 }
2756
2758 {
2759 return GetFoodStage().GetNextFoodStageType( cooking_method );
2760 }
2761
2763 {
2764 return GetFoodStage().GetFoodStageName( food_stage_type );
2765 }
2766
2768 {
2769 return GetFoodStage().CanChangeToNewStage( cooking_method );
2770 }
2771
2772
2774 {
2775 if ( !source.GetFoodStage())
2776 return;
2781 }
2782
2785 {
2788 }
2789
2792 {
2793 switch (stageNew)
2794 {
2799 break;
2800
2803 break;
2804 }
2805 }
2806
2807
2808
2809
2810
2812 {
2814 }
2815
2817 {
2819
2820
2822 }
2823
2825 {
2827 {
2830 }
2831 }
2832
2833
2835 {
2837 if (player)
2838 {
2840 player.ServerReplaceItemInHandsWithNew(lambda);
2841 }
2842 else
2843 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2844 }
2845
2847 {
2849 }
2850
2852 {
2853 super.SetActions();
2854
2857 }
2858
2860 {
2861 #ifndef SERVER
2862 #ifndef NO_GUI
2864 {
2866
2869 }
2870 #endif
2871 #endif
2872 }
2873
2875 {
2876 #ifndef SERVER
2877 #ifndef NO_GUI
2879 {
2883 }
2884 #endif
2885 #endif
2886 }
2887
2889 {
2890 return false;
2891 }
2892
2894 {
2896 }
2897
2898 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2899 {
2901
2902 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2904 if ( hasRootAsPlayer )
2906
2907
2908
2909
2910
2911
2912
2914 {
2915
2917 {
2919 {
2923 break;
2924
2928 break;
2929
2933 break;
2934
2938 default:
2941 return;
2942 }
2943
2944
2945 }
2946
2948
2950 {
2952 {
2953
2955 {
2957 }
2959 {
2962 {
2964 }
2965 else
2966 {
2968 {
2970 }
2971 else
2972 {
2974 }
2975 }
2976 }
2977 }
2978 }
2979
2980 }
2982 {
2983
2985 {
2987 {
2991 break;
2992
2996 break;
2997
3001 break;
3002
3006 break;
3007
3010 default:
3013 return;
3014 }
3015 }
3016
3018
3020 {
3022 {
3023
3025 {
3027 }
3028 }
3029 }
3030 }
3032 {
3033
3035 {
3037 {
3041 break;
3042
3045 default:
3048 return;
3049 }
3050 }
3051
3053
3055 {
3057 {
3058
3060 {
3062 }
3063 }
3064 }
3065 }
3066 else
3067 {
3068
3070
3072 {
3075
3076 }
3077 else
3078 {
3080 {
3083 }
3084 }
3085 }
3086 }
3087
3089 {
3090 if (
g_Game.IsHeadlessOrDedicatedServer())
3091 return;
3092
3094 {
3096 GetInventory().GetCurrentInventoryLocation(invLoc);
3098 {
3100 if (ptcMgr)
3101 {
3106 }
3107 }
3108 }
3110 {
3112 {
3115 return;
3116 }
3117
3119 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3121 {
3124 }
3125 }
3126 }
3127
3128 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3129 {
3131 {
3136 }
3137
3138 super.GetDebugActions(outputList);
3139 }
3140
3142 {
3143 super.OnAction(action_id, player, ctx);
3144
3146 {
3147 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3148 {
3150 if (food_stage_prev <= 0)
3151 {
3153 }
3155 return true;
3156 }
3157 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3158 {
3161 {
3163 }
3165 return true;
3166 }
3167
3168 }
3169
3170 #ifdef DIAG_DEVELOPER
3171 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3172 {
3173 PrintNutritionsData();
3174 return true;
3175 }
3176 #endif
3177
3178 return false;
3179 }
3180
3182 {
3183 string debug_output;
3184
3185 debug_output = super.GetDebugText();
3186
3189
3190 return debug_output;
3191 }
3192
3193
3194
3195
3196
3198 {
3199 float ret = super.GetBaitEffectivity();
3200
3202 {
3203 ret *= 0.5;
3204 }
3205
3206 return ret;
3207 }
3208
3210 {
3212 }
3213
3215 {
3217 }
3218
3220 {
3222 }
3223
3224 #ifdef DIAG_DEVELOPER
3225 private void PrintNutritionsData()
3226 {
3227 string nutritionsData = "";
3228
3231
3233 if (profile)
3234 {
3235 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3237 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3241 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3243
3246
3247 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3249 }
3250
3251 nutritionsData += "-----\n";
3252
3254 }
3255 #endif
3256
3258
3261 {
3263 }
3264}
3265
3267{
3269};
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.