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);
2569 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
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);
2585 return g_Game.ConfigGetFloat( class_path +
" energy" );
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);
2600 return g_Game.ConfigGetFloat( class_path +
" water" );
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);
2615 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
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);
2631 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
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);
2646 return g_Game.ConfigGetInt( class_path +
" agents" );
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);
2661 return g_Game.ConfigGetInt( class_path +
" digestibility" );
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);
2676 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
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
2874 #ifndef NO_GUI
2876 {
2878
2881 }
2882 #endif
2883 #endif
2884 }
2885
2887 {
2888 #ifndef SERVER
2889 #ifndef NO_GUI
2891 {
2895 }
2896 #endif
2897 #endif
2898 }
2899
2901 {
2902 return false;
2903 }
2904
2906 {
2908 }
2909
2910 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2911 {
2913
2914 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2916 if ( hasRootAsPlayer )
2918
2919
2920
2921
2922
2923
2924
2926 {
2927
2929 {
2931 {
2935 break;
2936
2940 break;
2941
2945 break;
2946
2950 default:
2953 return;
2954 }
2955
2956
2957 }
2958
2960
2962 {
2964 {
2965
2967 {
2969 }
2971 {
2974 {
2976 }
2977 else
2978 {
2980 {
2982 }
2983 else
2984 {
2986 }
2987 }
2988 }
2989 }
2990 }
2991
2992 }
2994 {
2995
2997 {
2999 {
3003 break;
3004
3008 break;
3009
3013 break;
3014
3018 break;
3019
3022 default:
3025 return;
3026 }
3027 }
3028
3030
3032 {
3034 {
3035
3037 {
3039 }
3040 }
3041 }
3042 }
3044 {
3045
3047 {
3049 {
3053 break;
3054
3057 default:
3060 return;
3061 }
3062 }
3063
3065
3067 {
3069 {
3070
3072 {
3074 }
3075 }
3076 }
3077 }
3078 else
3079 {
3080
3082
3084 {
3087
3088 }
3089 else
3090 {
3092 {
3095 }
3096 }
3097 }
3098 }
3099
3101 {
3102 if (
g_Game.IsHeadlessOrDedicatedServer())
3103 return;
3104
3106 {
3108 GetInventory().GetCurrentInventoryLocation(invLoc);
3110 {
3112 if (ptcMgr)
3113 {
3118 }
3119 }
3120 }
3122 {
3124 {
3127 return;
3128 }
3129
3131 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3133 {
3136 }
3137 }
3138 }
3139
3140 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3141 {
3143 {
3148 }
3149
3150 super.GetDebugActions(outputList);
3151 }
3152
3154 {
3155 super.OnAction(action_id, player, ctx);
3156
3158 {
3159 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3160 {
3162 if (food_stage_prev <= 0)
3163 {
3165 }
3167 return true;
3168 }
3169 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3170 {
3173 {
3175 }
3177 return true;
3178 }
3179
3180 }
3181
3182 #ifdef DIAG_DEVELOPER
3183 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3184 {
3185 PrintNutritionsData();
3186 return true;
3187 }
3188 #endif
3189
3190 return false;
3191 }
3192
3194 {
3195 string debug_output;
3196
3197 debug_output = super.GetDebugText();
3198
3201
3202 return debug_output;
3203 }
3204
3205
3206
3207
3208
3210 {
3211 float ret = super.GetBaitEffectivity();
3212
3214 {
3215 ret *= 0.5;
3216 }
3217
3218 return ret;
3219 }
3220
3222 {
3224 }
3225
3227 {
3229 }
3230
3232 {
3234 }
3235
3236 #ifdef DIAG_DEVELOPER
3237 private void PrintNutritionsData()
3238 {
3239 string nutritionsData = "";
3240
3243
3245 if (profile)
3246 {
3247 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3249 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3253 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3255
3258
3259 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3261 }
3262
3263 nutritionsData += "-----\n";
3264
3266 }
3267 #endif
3268
3270
3273 {
3275 }
3276}
3277
3279{
3281};
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.