2087{
2089
2097
2107
2109
2111 {
2113 {
2115
2117 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2118
2122 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2123 }
2124 }
2125
2127 {
2129
2131 }
2132
2134 {
2135 super.EEDelete(parent);
2136
2138
2141 }
2142
2144 {
2145 super.EEItemLocationChanged(oldLoc, newLoc);
2146
2149 {
2150 switch (oldLoc.GetParent().GetType())
2151 {
2152 case "FryingPan":
2153 case "Pot":
2154 case "Cauldron":
2155 case "SharpWoodenStick":
2157 break;
2158 }
2159
2162 {
2164 }
2165 }
2166
2167 if (oldLoc.IsValid())
2169
2172 }
2173
2175 {
2178 }
2179
2181 {
2184
2185 return true;
2186 }
2187
2189 {
2191 {
2193 }
2194 }
2195
2198 {
2199 int foodStageType;
2200
2202 if (foodStage)
2203 foodStageType = foodStage.GetFoodStageType();
2204
2209
2210 return agentsIn;
2211 }
2212
2213
2215 {
2216 return false;
2217 }
2218
2220 {
2221 return false;
2222 }
2223
2225 {
2227 {
2229 {
2232
2235
2236 default:
2237 return super.GetTemperatureFreezeTime();
2238 }
2239 }
2240
2241 return super.GetTemperatureFreezeTime();
2242 }
2243
2245 {
2247 {
2249 {
2252
2255
2256 default:
2257 return super.GetTemperatureThawTime();
2258 }
2259 }
2260
2261 return super.GetTemperatureThawTime();
2262 }
2263
2265 {
2267 }
2268
2269
2270
2271
2273 {
2274 SetSynchDirty();
2275 }
2276
2278 {
2279 super.OnVariablesSynchronized();
2280
2281
2282
2283
2285 {
2287 }
2288 else
2289 {
2291 }
2292
2295 }
2296
2297
2298
2299
2301 {
2304
2306 }
2307
2309 {
2310 string soundName = "";
2311
2314
2316 {
2318 }
2319 else
2320 {
2322 {
2324 {
2329 else
2330 soundName = "";
2331 break;
2332 }
2333
2335 {
2340 else
2341 soundName = "";
2342 break;
2343 }
2344
2346 {
2351 else
2352 soundName = "";
2353 break;
2354 }
2355
2356 default:
2357 soundName = "";
2358 break;
2359 }
2360
2362 {
2363 if (soundName == "")
2364 {
2366 }
2367 else
2368 {
2370 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2371 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2373 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2374 {
2376 }
2377 }
2378 }
2379 }
2380
2382 }
2383
2385 {
2388 }
2389
2390
2391
2392
2394 {
2395 super.OnStoreSave(ctx);
2396
2398 {
2400 }
2401
2402
2405 }
2406
2408 {
2409 if (!super.OnStoreLoad(ctx, version))
2410 return false;
2411
2413 {
2415 return false;
2416 }
2417
2418 if (version >= 115)
2419 {
2421 {
2423 return false;
2424 }
2426 {
2428 return false;
2429 }
2430 }
2431
2434
2435 return true;
2436 }
2437
2439 {
2440 super.AfterStoreLoad();
2441
2443 }
2444
2445
2447 {
2449 }
2450
2451
2453 {
2454 return false;
2455 }
2456
2458 {
2459 return false;
2460 }
2461
2463 {
2464 return false;
2465 }
2466
2468 {
2469 return false;
2470 }
2471
2472
2473
2474
2475
2477 {
2480 {
2481 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2482 }
2483 else if (classname != "" && food_stage)
2484 {
2485 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2486 }
2487 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2488 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2489
2490 }
2491
2493 {
2496 {
2498 }
2499 else if (classname != "" && food_stage)
2500 {
2501 return FoodStage.GetEnergy(null, food_stage, classname);
2502 }
2503 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2504 return g_Game.ConfigGetFloat( class_path +
" energy" );
2505 }
2506
2508 {
2511 {
2513 }
2514 else if (classname != "" && food_stage)
2515 {
2516 return FoodStage.GetWater(null, food_stage, classname);
2517 }
2518 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2519 return g_Game.ConfigGetFloat( class_path +
" water" );
2520 }
2521
2523 {
2526 {
2527 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2528 }
2529 else if (classname != "" && food_stage)
2530 {
2531 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2532 }
2533 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2534 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2535
2536 }
2537
2539 {
2542 {
2543 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2544 }
2545 else if (classname != "" && food_stage)
2546 {
2547 return FoodStage.GetToxicity(null, food_stage, classname);
2548 }
2549 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2550 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2551 }
2552
2554 {
2557 {
2559 }
2560 else if (classname != "" && food_stage)
2561 {
2562 return FoodStage.GetAgents(null, food_stage, classname);
2563 }
2564 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2565 return g_Game.ConfigGetInt( class_path +
" agents" );
2566 }
2567
2569 {
2572 {
2573 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2574 }
2575 else if (classname != "" && food_stage)
2576 {
2577 return FoodStage.GetDigestibility(null, food_stage, classname);
2578 }
2579 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2580 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2581 }
2582
2584 {
2587 {
2588 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2589 }
2590 else if (className != "" && foodStage)
2591 {
2592 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2593 }
2594 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2595 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2596 }
2597
2599 {
2609
2610 return profile;
2611 }
2612
2613
2614
2615
2617 {
2619 }
2620
2621
2623 {
2625 {
2627 }
2628
2629 return false;
2630 }
2631
2633 {
2635 {
2637 }
2638
2639 return false;
2640 }
2641
2643 {
2645 {
2647 }
2648
2649 return false;
2650 }
2651
2653 {
2655 {
2657 }
2658
2659 return false;
2660 }
2661
2663 {
2665 {
2667 }
2668
2669 return false;
2670 }
2671
2673 {
2675 {
2677 }
2678
2679 return false;
2680 }
2681
2682
2684 {
2686 }
2687
2689 {
2690 return GetFoodStage().GetNextFoodStageType( cooking_method );
2691 }
2692
2694 {
2695 return GetFoodStage().GetFoodStageName( food_stage_type );
2696 }
2697
2699 {
2700 return GetFoodStage().CanChangeToNewStage( cooking_method );
2701 }
2702
2703
2705 {
2706 if ( !source.GetFoodStage())
2707 return;
2712 }
2713
2716 {
2719 }
2720
2723 {
2724 switch (stageNew)
2725 {
2730 break;
2731
2734 break;
2735 }
2736 }
2737
2738
2739
2740
2741
2743 {
2745 }
2746
2748 {
2750
2751
2753 }
2754
2756 {
2758 {
2761 }
2762 }
2763
2764
2766 {
2768 if (player)
2769 {
2771 player.ServerReplaceItemInHandsWithNew(lambda);
2772 }
2773 else
2774 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2775 }
2776
2778 {
2780 }
2781
2783 {
2784 super.SetActions();
2785
2788 }
2789
2791 {
2792 #ifndef SERVER
2793 #ifndef NO_GUI
2795 {
2797
2800 }
2801 #endif
2802 #endif
2803 }
2804
2806 {
2807 #ifndef SERVER
2808 #ifndef NO_GUI
2810 {
2814 }
2815 #endif
2816 #endif
2817 }
2818
2820 {
2821 return false;
2822 }
2823
2825 {
2827 }
2828
2829 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2830 {
2832
2833 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2835 if ( hasRootAsPlayer )
2837
2838
2839
2840
2841
2842
2843
2845 {
2846
2848 {
2850 {
2854 break;
2855
2859 break;
2860
2864 break;
2865
2869 default:
2872 return;
2873 }
2874
2875
2876 }
2877
2879
2881 {
2883 {
2884
2886 {
2888 }
2890 {
2893 {
2895 }
2896 else
2897 {
2899 {
2901 }
2902 else
2903 {
2905 }
2906 }
2907 }
2908 }
2909 }
2910
2911 }
2913 {
2914
2916 {
2918 {
2922 break;
2923
2927 break;
2928
2932 break;
2933
2937 break;
2938
2941 default:
2944 return;
2945 }
2946 }
2947
2949
2951 {
2953 {
2954
2956 {
2958 }
2959 }
2960 }
2961 }
2963 {
2964
2966 {
2968 {
2972 break;
2973
2976 default:
2979 return;
2980 }
2981 }
2982
2984
2986 {
2988 {
2989
2991 {
2993 }
2994 }
2995 }
2996 }
2997 else
2998 {
2999
3001
3003 {
3006
3007 }
3008 else
3009 {
3011 {
3014 }
3015 }
3016 }
3017 }
3018
3020 {
3021 if (
g_Game.IsHeadlessOrDedicatedServer())
3022 return;
3023
3025 {
3027 GetInventory().GetCurrentInventoryLocation(invLoc);
3029 {
3031 if (ptcMgr)
3032 {
3037 }
3038 }
3039 }
3041 {
3043 {
3046 return;
3047 }
3048
3050 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3052 {
3055 }
3056 }
3057 }
3058
3059 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3060 {
3062 {
3067 }
3068
3069 super.GetDebugActions(outputList);
3070 }
3071
3073 {
3074 super.OnAction(action_id, player, ctx);
3075
3077 {
3078 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3079 {
3081 if (food_stage_prev <= 0)
3082 {
3084 }
3086 return true;
3087 }
3088 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3089 {
3092 {
3094 }
3096 return true;
3097 }
3098
3099 }
3100
3101 #ifdef DIAG_DEVELOPER
3102 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3103 {
3104 PrintNutritionsData();
3105 return true;
3106 }
3107 #endif
3108
3109 return false;
3110 }
3111
3113 {
3114 string debug_output;
3115
3116 debug_output = super.GetDebugText();
3117
3120
3121 return debug_output;
3122 }
3123
3124
3125
3126
3127
3129 {
3130 float ret = super.GetBaitEffectivity();
3131
3133 {
3134 ret *= 0.5;
3135 }
3136
3137 return ret;
3138 }
3139
3141 {
3143 }
3144
3146 {
3148 }
3149
3151 {
3153 }
3154
3155 #ifdef DIAG_DEVELOPER
3156 private void PrintNutritionsData()
3157 {
3158 string nutritionsData = "";
3159
3162
3164 if (profile)
3165 {
3166 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3168 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3172 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3174
3177
3178 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3180 }
3181
3182 nutritionsData += "-----\n";
3183
3185 }
3186 #endif
3187
3189
3192 {
3194 }
3195}
3196
3198{
3200};
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.