1813{
1815
1823
1833
1835
1837 {
1839 {
1841
1843 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1844
1848 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1849 }
1850 }
1851
1853 {
1855
1857 }
1858
1860 {
1861 super.EEDelete(parent);
1862
1864
1867 }
1868
1870 {
1871 super.EEItemLocationChanged(oldLoc, newLoc);
1872
1875 {
1876 switch (oldLoc.GetParent().GetType())
1877 {
1878 case "FryingPan":
1879 case "Pot":
1880 case "Cauldron":
1881 case "SharpWoodenStick":
1883 break;
1884 }
1885
1888 {
1890 }
1891 }
1892
1893 if (oldLoc.IsValid())
1895
1898 }
1899
1901 {
1904 }
1905
1907 {
1910
1911 return true;
1912 }
1913
1915 {
1917 {
1919 }
1920 }
1921
1924 {
1925 int foodStageType;
1926
1928 if (foodStage)
1929 foodStageType = foodStage.GetFoodStageType();
1930
1935
1936 return agentsIn;
1937 }
1938
1939
1941 {
1942 return false;
1943 }
1944
1946 {
1947 return false;
1948 }
1949
1951 {
1953 {
1955 {
1958
1961
1962 default:
1963 return super.GetTemperatureFreezeTime();
1964 }
1965 }
1966
1967 return super.GetTemperatureFreezeTime();
1968 }
1969
1971 {
1973 {
1975 {
1978
1981
1982 default:
1983 return super.GetTemperatureThawTime();
1984 }
1985 }
1986
1987 return super.GetTemperatureThawTime();
1988 }
1989
1991 {
1993 }
1994
1995
1996
1997
1999 {
2000 SetSynchDirty();
2001 }
2002
2004 {
2005 super.OnVariablesSynchronized();
2006
2007
2008
2009
2011 {
2013 }
2014 else
2015 {
2017 }
2018
2021 }
2022
2023
2024
2025
2027 {
2030
2032 }
2033
2035 {
2036 string soundName = "";
2037
2040
2042 {
2044 }
2045 else
2046 {
2048 {
2050 {
2055 else
2056 soundName = "";
2057 break;
2058 }
2059
2061 {
2066 else
2067 soundName = "";
2068 break;
2069 }
2070
2072 {
2077 else
2078 soundName = "";
2079 break;
2080 }
2081
2082 default:
2083 soundName = "";
2084 break;
2085 }
2086
2088 {
2089 if (soundName == "")
2090 {
2092 }
2093 else
2094 {
2096 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2097 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2099 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2100 {
2102 }
2103 }
2104 }
2105 }
2106
2108 }
2109
2111 {
2114 }
2115
2116
2117
2118
2120 {
2121 super.OnStoreSave(ctx);
2122
2124 {
2126 }
2127
2128
2131 }
2132
2134 {
2135 if (!super.OnStoreLoad(ctx, version))
2136 return false;
2137
2139 {
2141 return false;
2142 }
2143
2144 if (version >= 115)
2145 {
2147 {
2149 return false;
2150 }
2152 {
2154 return false;
2155 }
2156 }
2157
2160
2161 return true;
2162 }
2163
2165 {
2166 super.AfterStoreLoad();
2167
2169 }
2170
2171
2173 {
2175 }
2176
2177
2179 {
2180 return false;
2181 }
2182
2184 {
2185 return false;
2186 }
2187
2189 {
2190 return false;
2191 }
2192
2194 {
2195 return false;
2196 }
2197
2198
2199
2200
2201
2203 {
2206 {
2207 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2208 }
2209 else if (classname != "" && food_stage)
2210 {
2211 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2212 }
2213 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2215
2216 }
2217
2219 {
2222 {
2224 }
2225 else if (classname != "" && food_stage)
2226 {
2227 return FoodStage.GetEnergy(null, food_stage, classname);
2228 }
2229 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2231 }
2232
2234 {
2237 {
2239 }
2240 else if (classname != "" && food_stage)
2241 {
2242 return FoodStage.GetWater(null, food_stage, classname);
2243 }
2244 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2246 }
2247
2249 {
2252 {
2253 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2254 }
2255 else if (classname != "" && food_stage)
2256 {
2257 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2258 }
2259 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2261
2262 }
2263
2265 {
2268 {
2269 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2270 }
2271 else if (classname != "" && food_stage)
2272 {
2273 return FoodStage.GetToxicity(null, food_stage, classname);
2274 }
2275 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2277 }
2278
2280 {
2283 {
2285 }
2286 else if (classname != "" && food_stage)
2287 {
2288 return FoodStage.GetAgents(null, food_stage, classname);
2289 }
2290 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2292 }
2293
2295 {
2298 {
2299 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2300 }
2301 else if (classname != "" && food_stage)
2302 {
2303 return FoodStage.GetDigestibility(null, food_stage, classname);
2304 }
2305 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2307 }
2308
2310 {
2313 {
2314 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2315 }
2316 else if (className != "" && foodStage)
2317 {
2318 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2319 }
2320 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2322 }
2323
2325 {
2335
2336 return profile;
2337 }
2338
2339
2340
2341
2343 {
2345 }
2346
2347
2349 {
2351 {
2353 }
2354
2355 return false;
2356 }
2357
2359 {
2361 {
2363 }
2364
2365 return false;
2366 }
2367
2369 {
2371 {
2373 }
2374
2375 return false;
2376 }
2377
2379 {
2381 {
2383 }
2384
2385 return false;
2386 }
2387
2389 {
2391 {
2393 }
2394
2395 return false;
2396 }
2397
2399 {
2401 {
2403 }
2404
2405 return false;
2406 }
2407
2408
2410 {
2412 }
2413
2415 {
2416 return GetFoodStage().GetNextFoodStageType( cooking_method );
2417 }
2418
2420 {
2421 return GetFoodStage().GetFoodStageName( food_stage_type );
2422 }
2423
2425 {
2426 return GetFoodStage().CanChangeToNewStage( cooking_method );
2427 }
2428
2429
2431 {
2432 if ( !source.GetFoodStage())
2433 return;
2438 }
2439
2442 {
2445 }
2446
2449 {
2450 switch (stageNew)
2451 {
2456 break;
2457
2460 break;
2461 }
2462 }
2463
2464
2465
2466
2467
2469 {
2471 }
2472
2474 {
2476
2477
2479 }
2480
2482 {
2484 {
2487 }
2488 }
2489
2490
2492 {
2494 if (player)
2495 {
2497 player.ServerReplaceItemInHandsWithNew(lambda);
2498 }
2499 else
2500 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2501 }
2502
2504 {
2506 }
2507
2509 {
2510 super.SetActions();
2511
2514 }
2515
2517 {
2518 #ifndef SERVER
2520 {
2522
2525 }
2526 #endif
2527 }
2528
2530 {
2531 #ifndef SERVER
2533 {
2537 }
2538 #endif
2539 }
2540
2542 {
2543 return false;
2544 }
2545
2547 {
2549 }
2550
2551 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2552 {
2554
2555 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2557 if ( hasRootAsPlayer )
2559
2560
2561
2562
2563
2564
2565
2567 {
2568
2570 {
2572 {
2576 break;
2577
2581 break;
2582
2586 break;
2587
2591 default:
2594 return;
2595 }
2596
2597
2598 }
2599
2601
2603 {
2605 {
2606
2608 {
2610 }
2612 {
2615 {
2617 }
2618 else
2619 {
2621 {
2623 }
2624 else
2625 {
2627 }
2628 }
2629 }
2630 }
2631 }
2632
2633 }
2635 {
2636
2638 {
2640 {
2644 break;
2645
2649 break;
2650
2654 break;
2655
2659 break;
2660
2663 default:
2666 return;
2667 }
2668 }
2669
2671
2673 {
2675 {
2676
2678 {
2680 }
2681 }
2682 }
2683 }
2685 {
2686
2688 {
2690 {
2694 break;
2695
2698 default:
2701 return;
2702 }
2703 }
2704
2706
2708 {
2710 {
2711
2713 {
2715 }
2716 }
2717 }
2718 }
2719 else
2720 {
2721
2723
2725 {
2728
2729 }
2730 else
2731 {
2733 {
2736 }
2737 }
2738 }
2739 }
2740
2742 {
2743 if (
GetGame().IsDedicatedServer())
2744 return;
2745
2747 {
2749 GetInventory().GetCurrentInventoryLocation(invLoc);
2751 {
2753 if (ptcMgr)
2754 {
2759 }
2760 }
2761 }
2763 {
2765 {
2768 return;
2769 }
2770
2772 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2774 {
2777 }
2778 }
2779 }
2780
2781 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2782 {
2783 super.GetDebugActions(outputList);
2784
2786 {
2790 }
2791 }
2792
2794 {
2795 super.OnAction(action_id, player, ctx);
2796
2798 {
2799 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2800 {
2802 if (food_stage_prev <= 0)
2803 {
2805 }
2807 return true;
2808 }
2809 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2810 {
2813 {
2815 }
2817 return true;
2818 }
2819
2820 }
2821
2822 #ifdef DIAG_DEVELOPER
2823 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2824 {
2825 PrintNutritionsData();
2826 return true;
2827 }
2828 #endif
2829
2830 return false;
2831 }
2832
2834 {
2835 string debug_output;
2836
2837 debug_output = super.GetDebugText();
2838
2841
2842 return debug_output;
2843 }
2844
2845
2846
2847
2848
2850 {
2851 float ret = super.GetBaitEffectivity();
2852
2854 {
2855 ret *= 0.5;
2856 }
2857
2858 return ret;
2859 }
2860
2862 {
2864 }
2865
2867 {
2869 }
2870
2872 {
2874 }
2875
2876 #ifdef DIAG_DEVELOPER
2877 private void PrintNutritionsData()
2878 {
2879 string nutritionsData = "";
2880
2883
2885 if (profile)
2886 {
2887 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2889 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2893 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2895
2898
2899 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2901 }
2902
2903 nutritionsData += "-----\n";
2904
2906 }
2907 #endif
2908
2910
2913 {
2915 }
2916}
2917
2919{
2921};
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.