2146{
2148
2156
2166
2168
2170 {
2172 {
2174
2176 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
2177
2181 RegisterNetSyncVariableBool("m_MakeCookingSounds");
2182 }
2183 }
2184
2186 {
2188
2190 }
2191
2193 {
2194 super.EEDelete(parent);
2195
2197
2200 }
2201
2203 {
2204 super.EEItemLocationChanged(oldLoc, newLoc);
2205
2208 {
2209 switch (oldLoc.GetParent().GetType())
2210 {
2211 case "FryingPan":
2212 case "Pot":
2213 case "Cauldron":
2214 case "SharpWoodenStick":
2216 break;
2217 }
2218
2221 {
2223 }
2224 }
2225
2226 if (oldLoc.IsValid())
2228
2231 }
2232
2234 {
2237 }
2238
2240 {
2243
2244 return true;
2245 }
2246
2248 {
2250 {
2252 }
2253 }
2254
2257 {
2258 int foodStageType;
2259
2261 if (foodStage)
2262 foodStageType = foodStage.GetFoodStageType();
2263
2268
2269 return agentsIn;
2270 }
2271
2272
2274 {
2275 return false;
2276 }
2277
2279 {
2280 return false;
2281 }
2282
2284 {
2286 {
2288 {
2291
2294
2295 default:
2296 return super.GetTemperatureFreezeTime();
2297 }
2298 }
2299
2300 return super.GetTemperatureFreezeTime();
2301 }
2302
2304 {
2306 {
2308 {
2311
2314
2315 default:
2316 return super.GetTemperatureThawTime();
2317 }
2318 }
2319
2320 return super.GetTemperatureThawTime();
2321 }
2322
2324 {
2326 }
2327
2328
2329
2330
2332 {
2333 SetSynchDirty();
2334 }
2335
2337 {
2338 super.OnVariablesSynchronized();
2339
2340
2341
2342
2344 {
2346 }
2347 else
2348 {
2350 }
2351
2354 }
2355
2356
2357
2358
2360 {
2363
2365 }
2366
2368 {
2369 string soundName = "";
2370
2373
2375 {
2377 }
2378 else
2379 {
2381 {
2383 {
2388 else
2389 soundName = "";
2390 break;
2391 }
2392
2394 {
2399 else
2400 soundName = "";
2401 break;
2402 }
2403
2405 {
2410 else
2411 soundName = "";
2412 break;
2413 }
2414
2415 default:
2416 soundName = "";
2417 break;
2418 }
2419
2421 {
2422 if (soundName == "")
2423 {
2425 }
2426 else
2427 {
2429 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2430 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2432 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2433 {
2435 }
2436 }
2437 }
2438 }
2439
2441 }
2442
2444 {
2447 }
2448
2449
2450
2451
2453 {
2454 super.OnStoreSave(ctx);
2455
2457 {
2459 }
2460
2461
2464 }
2465
2467 {
2468 if (!super.OnStoreLoad(ctx, version))
2469 return false;
2470
2472 {
2474 return false;
2475 }
2476
2477 if (version >= 115)
2478 {
2480 {
2482 return false;
2483 }
2485 {
2487 return false;
2488 }
2489 }
2490
2493
2494 return true;
2495 }
2496
2498 {
2499 super.AfterStoreLoad();
2500
2502 }
2503
2504
2506 {
2508 }
2509
2510
2512 {
2513 return false;
2514 }
2515
2517 {
2518 return false;
2519 }
2520
2522 {
2523 return false;
2524 }
2525
2527 {
2528 return false;
2529 }
2530
2531
2532
2533
2534
2536 {
2539 {
2540 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2541 }
2542 else if (classname != "" && food_stage)
2543 {
2544 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2545 }
2546 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2548
2549 }
2550
2552 {
2555 {
2557 }
2558 else if (classname != "" && food_stage)
2559 {
2560 return FoodStage.GetEnergy(null, food_stage, classname);
2561 }
2562 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2564 }
2565
2567 {
2570 {
2572 }
2573 else if (classname != "" && food_stage)
2574 {
2575 return FoodStage.GetWater(null, food_stage, classname);
2576 }
2577 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2579 }
2580
2582 {
2585 {
2586 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2587 }
2588 else if (classname != "" && food_stage)
2589 {
2590 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2591 }
2592 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2594
2595 }
2596
2598 {
2601 {
2602 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2603 }
2604 else if (classname != "" && food_stage)
2605 {
2606 return FoodStage.GetToxicity(null, food_stage, classname);
2607 }
2608 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2610 }
2611
2613 {
2616 {
2618 }
2619 else if (classname != "" && food_stage)
2620 {
2621 return FoodStage.GetAgents(null, food_stage, classname);
2622 }
2623 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2625 }
2626
2628 {
2631 {
2632 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2633 }
2634 else if (classname != "" && food_stage)
2635 {
2636 return FoodStage.GetDigestibility(null, food_stage, classname);
2637 }
2638 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2640 }
2641
2643 {
2646 {
2647 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2648 }
2649 else if (className != "" && foodStage)
2650 {
2651 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2652 }
2653 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2655 }
2656
2658 {
2668
2669 return profile;
2670 }
2671
2672
2673
2674
2676 {
2678 }
2679
2680
2682 {
2684 {
2686 }
2687
2688 return false;
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
2741
2743 {
2745 }
2746
2748 {
2749 return GetFoodStage().GetNextFoodStageType( cooking_method );
2750 }
2751
2753 {
2754 return GetFoodStage().GetFoodStageName( food_stage_type );
2755 }
2756
2758 {
2759 return GetFoodStage().CanChangeToNewStage( cooking_method );
2760 }
2761
2762
2764 {
2765 if ( !source.GetFoodStage())
2766 return;
2771 }
2772
2775 {
2778 }
2779
2782 {
2783 switch (stageNew)
2784 {
2789 break;
2790
2793 break;
2794 }
2795 }
2796
2797
2798
2799
2800
2802 {
2804 }
2805
2807 {
2809
2810
2812 }
2813
2815 {
2817 {
2820 }
2821 }
2822
2823
2825 {
2827 if (player)
2828 {
2830 player.ServerReplaceItemInHandsWithNew(lambda);
2831 }
2832 else
2833 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2834 }
2835
2837 {
2839 }
2840
2842 {
2843 super.SetActions();
2844
2847 }
2848
2850 {
2851 #ifndef SERVER
2853 {
2855
2858 }
2859 #endif
2860 }
2861
2863 {
2864 #ifndef SERVER
2866 {
2870 }
2871 #endif
2872 }
2873
2875 {
2876 return false;
2877 }
2878
2880 {
2882 }
2883
2884 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2885 {
2887
2888 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2890 if ( hasRootAsPlayer )
2892
2893
2894
2895
2896
2897
2898
2900 {
2901
2903 {
2905 {
2909 break;
2910
2914 break;
2915
2919 break;
2920
2924 default:
2927 return;
2928 }
2929
2930
2931 }
2932
2934
2936 {
2938 {
2939
2941 {
2943 }
2945 {
2948 {
2950 }
2951 else
2952 {
2954 {
2956 }
2957 else
2958 {
2960 }
2961 }
2962 }
2963 }
2964 }
2965
2966 }
2968 {
2969
2971 {
2973 {
2977 break;
2978
2982 break;
2983
2987 break;
2988
2992 break;
2993
2996 default:
2999 return;
3000 }
3001 }
3002
3004
3006 {
3008 {
3009
3011 {
3013 }
3014 }
3015 }
3016 }
3018 {
3019
3021 {
3023 {
3027 break;
3028
3031 default:
3034 return;
3035 }
3036 }
3037
3039
3041 {
3043 {
3044
3046 {
3048 }
3049 }
3050 }
3051 }
3052 else
3053 {
3054
3056
3058 {
3061
3062 }
3063 else
3064 {
3066 {
3069 }
3070 }
3071 }
3072 }
3073
3075 {
3076 if (
GetGame().IsDedicatedServer())
3077 return;
3078
3080 {
3082 GetInventory().GetCurrentInventoryLocation(invLoc);
3084 {
3086 if (ptcMgr)
3087 {
3092 }
3093 }
3094 }
3096 {
3098 {
3101 return;
3102 }
3103
3105 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
3107 {
3110 }
3111 }
3112 }
3113
3114 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
3115 {
3116 super.GetDebugActions(outputList);
3117
3119 {
3123 }
3124 }
3125
3127 {
3128 super.OnAction(action_id, player, ctx);
3129
3131 {
3132 if ( action_id ==
EActions.FOOD_STAGE_PREV )
3133 {
3135 if (food_stage_prev <= 0)
3136 {
3138 }
3140 return true;
3141 }
3142 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
3143 {
3146 {
3148 }
3150 return true;
3151 }
3152
3153 }
3154
3155 #ifdef DIAG_DEVELOPER
3156 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
3157 {
3158 PrintNutritionsData();
3159 return true;
3160 }
3161 #endif
3162
3163 return false;
3164 }
3165
3167 {
3168 string debug_output;
3169
3170 debug_output = super.GetDebugText();
3171
3174
3175 return debug_output;
3176 }
3177
3178
3179
3180
3181
3183 {
3184 float ret = super.GetBaitEffectivity();
3185
3187 {
3188 ret *= 0.5;
3189 }
3190
3191 return ret;
3192 }
3193
3195 {
3197 }
3198
3200 {
3202 }
3203
3205 {
3207 }
3208
3209 #ifdef DIAG_DEVELOPER
3210 private void PrintNutritionsData()
3211 {
3212 string nutritionsData = "";
3213
3216
3218 if (profile)
3219 {
3220 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
3222 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
3226 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
3228
3231
3232 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
3234 }
3235
3236 nutritionsData += "-----\n";
3237
3239 }
3240 #endif
3241
3243
3246 {
3248 }
3249}
3250
3252{
3254};
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
AttachActionData ActionData ActionAttach()
void AddAction(typename actionName)
DamageType
exposed from C++ (do not change)
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.