2092{
2094
2102
2112
2114
2116 {
2118 {
2120
2122 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2123
2127 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2128 }
2129 }
2130
2132 {
2134
2136 }
2137
2139 {
2140 super.EEDelete(parent);
2141
2143
2146 }
2147
2149 {
2150 super.EEItemLocationChanged(oldLoc, newLoc);
2151
2154 {
2155 switch (oldLoc.GetParent().GetType())
2156 {
2157 case "FryingPan":
2158 case "Pot":
2159 case "Cauldron":
2160 case "SharpWoodenStick":
2162 break;
2163 }
2164
2167 {
2169 }
2170 }
2171
2172 if (oldLoc.IsValid())
2174
2177 }
2178
2180 {
2183 }
2184
2186 {
2189
2190 return true;
2191 }
2192
2194 {
2196 {
2198 }
2199 }
2200
2203 {
2204 int foodStageType;
2205
2207 if (foodStage)
2208 foodStageType = foodStage.GetFoodStageType();
2209
2214
2215 return agentsIn;
2216 }
2217
2218
2220 {
2221 return false;
2222 }
2223
2225 {
2226 return false;
2227 }
2228
2230 {
2232 {
2234 {
2237
2240
2241 default:
2242 return super.GetTemperatureFreezeTime();
2243 }
2244 }
2245
2246 return super.GetTemperatureFreezeTime();
2247 }
2248
2250 {
2252 {
2254 {
2257
2260
2261 default:
2262 return super.GetTemperatureThawTime();
2263 }
2264 }
2265
2266 return super.GetTemperatureThawTime();
2267 }
2268
2270 {
2272 }
2273
2274
2275
2276
2278 {
2279 SetSynchDirty();
2280 }
2281
2283 {
2284 super.OnVariablesSynchronized();
2285
2286
2287
2288
2290 {
2292 }
2293 else
2294 {
2296 }
2297
2300 }
2301
2302
2303
2304
2306 {
2309
2311 }
2312
2314 {
2315 string soundName = "";
2316
2319
2321 {
2323 }
2324 else
2325 {
2327 {
2329 {
2334 else
2335 soundName = "";
2336 break;
2337 }
2338
2340 {
2345 else
2346 soundName = "";
2347 break;
2348 }
2349
2351 {
2356 else
2357 soundName = "";
2358 break;
2359 }
2360
2361 default:
2362 soundName = "";
2363 break;
2364 }
2365
2367 {
2368 if (soundName == "")
2369 {
2371 }
2372 else
2373 {
2375 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2376 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2378 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2379 {
2381 }
2382 }
2383 }
2384 }
2385
2387 }
2388
2390 {
2393 }
2394
2395
2396
2397
2399 {
2400 super.OnStoreSave(ctx);
2401
2403 {
2405 }
2406
2407
2410 }
2411
2413 {
2414 if (!super.OnStoreLoad(ctx, version))
2415 return false;
2416
2418 {
2420 return false;
2421 }
2422
2423 if (version >= 115)
2424 {
2426 {
2428 return false;
2429 }
2431 {
2433 return false;
2434 }
2435 }
2436
2439
2440 return true;
2441 }
2442
2444 {
2445 super.AfterStoreLoad();
2446
2448 }
2449
2450
2452 {
2454 }
2455
2456
2458 {
2459 return false;
2460 }
2461
2463 {
2464 return false;
2465 }
2466
2468 {
2469 return false;
2470 }
2471
2473 {
2474 return false;
2475 }
2476
2477
2478
2479
2480
2482 {
2485 {
2486 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2487 }
2488 else if (classname != "" && food_stage)
2489 {
2490 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2491 }
2492 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2494
2495 }
2496
2498 {
2501 {
2503 }
2504 else if (classname != "" && food_stage)
2505 {
2506 return FoodStage.GetEnergy(null, food_stage, classname);
2507 }
2508 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2510 }
2511
2513 {
2516 {
2518 }
2519 else if (classname != "" && food_stage)
2520 {
2521 return FoodStage.GetWater(null, food_stage, classname);
2522 }
2523 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2525 }
2526
2528 {
2531 {
2532 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2533 }
2534 else if (classname != "" && food_stage)
2535 {
2536 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2537 }
2538 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2540
2541 }
2542
2544 {
2547 {
2548 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2549 }
2550 else if (classname != "" && food_stage)
2551 {
2552 return FoodStage.GetToxicity(null, food_stage, classname);
2553 }
2554 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2556 }
2557
2559 {
2562 {
2564 }
2565 else if (classname != "" && food_stage)
2566 {
2567 return FoodStage.GetAgents(null, food_stage, classname);
2568 }
2569 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2571 }
2572
2574 {
2577 {
2578 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2579 }
2580 else if (classname != "" && food_stage)
2581 {
2582 return FoodStage.GetDigestibility(null, food_stage, classname);
2583 }
2584 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2586 }
2587
2589 {
2592 {
2593 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2594 }
2595 else if (className != "" && foodStage)
2596 {
2597 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2598 }
2599 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2601 }
2602
2604 {
2614
2615 return profile;
2616 }
2617
2618
2619
2620
2622 {
2624 }
2625
2626
2628 {
2630 {
2632 }
2633
2634 return false;
2635 }
2636
2638 {
2640 {
2642 }
2643
2644 return false;
2645 }
2646
2648 {
2650 {
2652 }
2653
2654 return false;
2655 }
2656
2658 {
2660 {
2662 }
2663
2664 return false;
2665 }
2666
2668 {
2670 {
2672 }
2673
2674 return false;
2675 }
2676
2678 {
2680 {
2682 }
2683
2684 return false;
2685 }
2686
2687
2689 {
2691 }
2692
2694 {
2695 return GetFoodStage().GetNextFoodStageType( cooking_method );
2696 }
2697
2699 {
2700 return GetFoodStage().GetFoodStageName( food_stage_type );
2701 }
2702
2704 {
2705 return GetFoodStage().CanChangeToNewStage( cooking_method );
2706 }
2707
2708
2710 {
2711 if ( !source.GetFoodStage())
2712 return;
2717 }
2718
2721 {
2724 }
2725
2728 {
2729 switch (stageNew)
2730 {
2735 break;
2736
2739 break;
2740 }
2741 }
2742
2743
2744
2745
2746
2748 {
2750 }
2751
2753 {
2755
2756
2758 }
2759
2761 {
2763 {
2766 }
2767 }
2768
2769
2771 {
2773 if (player)
2774 {
2776 player.ServerReplaceItemInHandsWithNew(lambda);
2777 }
2778 else
2779 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2780 }
2781
2783 {
2785 }
2786
2788 {
2789 super.SetActions();
2790
2793 }
2794
2796 {
2797 #ifndef SERVER
2799 {
2801
2804 }
2805 #endif
2806 }
2807
2809 {
2810 #ifndef SERVER
2812 {
2816 }
2817 #endif
2818 }
2819
2821 {
2822 return false;
2823 }
2824
2826 {
2828 }
2829
2830 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2831 {
2833
2834 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2836 if ( hasRootAsPlayer )
2838
2839
2840
2841
2842
2843
2844
2846 {
2847
2849 {
2851 {
2855 break;
2856
2860 break;
2861
2865 break;
2866
2870 default:
2873 return;
2874 }
2875
2876
2877 }
2878
2880
2882 {
2884 {
2885
2887 {
2889 }
2891 {
2894 {
2896 }
2897 else
2898 {
2900 {
2902 }
2903 else
2904 {
2906 }
2907 }
2908 }
2909 }
2910 }
2911
2912 }
2914 {
2915
2917 {
2919 {
2923 break;
2924
2928 break;
2929
2933 break;
2934
2938 break;
2939
2942 default:
2945 return;
2946 }
2947 }
2948
2950
2952 {
2954 {
2955
2957 {
2959 }
2960 }
2961 }
2962 }
2964 {
2965
2967 {
2969 {
2973 break;
2974
2977 default:
2980 return;
2981 }
2982 }
2983
2985
2987 {
2989 {
2990
2992 {
2994 }
2995 }
2996 }
2997 }
2998 else
2999 {
3000
3002
3004 {
3007
3008 }
3009 else
3010 {
3012 {
3015 }
3016 }
3017 }
3018 }
3019
3021 {
3022 if (
GetGame().IsDedicatedServer())
3023 return;
3024
3026 {
3028 GetInventory().GetCurrentInventoryLocation(invLoc);
3030 {
3032 if (ptcMgr)
3033 {
3038 }
3039 }
3040 }
3042 {
3044 {
3047 return;
3048 }
3049
3051 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3053 {
3056 }
3057 }
3058 }
3059
3060 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3061 {
3063 {
3068 }
3069
3070 super.GetDebugActions(outputList);
3071 }
3072
3074 {
3075 super.OnAction(action_id, player, ctx);
3076
3078 {
3079 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3080 {
3082 if (food_stage_prev <= 0)
3083 {
3085 }
3087 return true;
3088 }
3089 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3090 {
3093 {
3095 }
3097 return true;
3098 }
3099
3100 }
3101
3102 #ifdef DIAG_DEVELOPER
3103 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3104 {
3105 PrintNutritionsData();
3106 return true;
3107 }
3108 #endif
3109
3110 return false;
3111 }
3112
3114 {
3115 string debug_output;
3116
3117 debug_output = super.GetDebugText();
3118
3121
3122 return debug_output;
3123 }
3124
3125
3126
3127
3128
3130 {
3131 float ret = super.GetBaitEffectivity();
3132
3134 {
3135 ret *= 0.5;
3136 }
3137
3138 return ret;
3139 }
3140
3142 {
3144 }
3145
3147 {
3149 }
3150
3152 {
3154 }
3155
3156 #ifdef DIAG_DEVELOPER
3157 private void PrintNutritionsData()
3158 {
3159 string nutritionsData = "";
3160
3163
3165 if (profile)
3166 {
3167 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3169 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3173 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3175
3178
3179 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3181 }
3182
3183 nutritionsData += "-----\n";
3184
3186 }
3187 #endif
3188
3190
3193 {
3195 }
3196}
3197
3199{
3201};
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.