1745{
1747
1755
1765
1767
1769 {
1771 {
1773
1775 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1776
1780 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1781 }
1782 }
1783
1785 {
1787
1789 }
1790
1792 {
1793 super.EEDelete(parent);
1794
1796
1799 }
1800
1802 {
1803 super.EEItemLocationChanged(oldLoc, newLoc);
1804
1807 {
1808 switch (oldLoc.GetParent().GetType())
1809 {
1810 case "FryingPan":
1811 case "Pot":
1812 case "Cauldron":
1813 case "SharpWoodenStick":
1815 break;
1816 }
1817
1820 {
1822 }
1823 }
1824
1825 if (oldLoc.IsValid())
1827
1830 }
1831
1833 {
1836 }
1837
1839 {
1842
1843 return true;
1844 }
1845
1847 {
1849 {
1851 }
1852 }
1853
1856 {
1857 int foodStageType;
1858
1860 if (foodStage)
1861 foodStageType = foodStage.GetFoodStageType();
1862
1867
1868 return agentsIn;
1869 }
1870
1871
1873 {
1874 return false;
1875 }
1876
1878 {
1879 return false;
1880 }
1881
1883 {
1885 {
1887 {
1890
1893
1894 default:
1895 return super.GetTemperatureFreezeTime();
1896 }
1897 }
1898
1899 return super.GetTemperatureFreezeTime();
1900 }
1901
1903 {
1905 {
1907 {
1910
1913
1914 default:
1915 return super.GetTemperatureThawTime();
1916 }
1917 }
1918
1919 return super.GetTemperatureThawTime();
1920 }
1921
1923 {
1925 }
1926
1927
1928
1929
1931 {
1932 SetSynchDirty();
1933 }
1934
1936 {
1937 super.OnVariablesSynchronized();
1938
1939
1940
1941
1943 {
1945 }
1946 else
1947 {
1949 }
1950
1953 }
1954
1955
1956
1957
1959 {
1962
1964 }
1965
1967 {
1968 string soundName = "";
1969
1972
1974 {
1976 }
1977 else
1978 {
1980 {
1982 {
1987 else
1988 soundName = "";
1989 break;
1990 }
1991
1993 {
1998 else
1999 soundName = "";
2000 break;
2001 }
2002
2004 {
2009 else
2010 soundName = "";
2011 break;
2012 }
2013
2014 default:
2015 soundName = "";
2016 break;
2017 }
2018
2020 {
2021 if (soundName == "")
2022 {
2024 }
2025 else
2026 {
2028 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2029 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2031 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2032 {
2034 }
2035 }
2036 }
2037 }
2038
2040 }
2041
2043 {
2046 }
2047
2048
2049
2050
2052 {
2053 super.OnStoreSave(ctx);
2054
2056 {
2058 }
2059
2060
2063 }
2064
2066 {
2067 if (!super.OnStoreLoad(ctx, version))
2068 return false;
2069
2071 {
2073 return false;
2074 }
2075
2076 if (version >= 115)
2077 {
2079 {
2081 return false;
2082 }
2084 {
2086 return false;
2087 }
2088 }
2089
2092
2093 return true;
2094 }
2095
2097 {
2098 super.AfterStoreLoad();
2099
2101 }
2102
2103
2105 {
2107 }
2108
2109
2111 {
2112 return false;
2113 }
2114
2116 {
2117 return false;
2118 }
2119
2121 {
2122 return false;
2123 }
2124
2126 {
2127 return false;
2128 }
2129
2130
2131
2132
2133
2135 {
2138 {
2139 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2140 }
2141 else if (classname != "" && food_stage)
2142 {
2143 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2144 }
2145 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2147
2148 }
2149
2151 {
2154 {
2156 }
2157 else if (classname != "" && food_stage)
2158 {
2159 return FoodStage.GetEnergy(null, food_stage, classname);
2160 }
2161 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2163 }
2164
2166 {
2169 {
2171 }
2172 else if (classname != "" && food_stage)
2173 {
2174 return FoodStage.GetWater(null, food_stage, classname);
2175 }
2176 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2178 }
2179
2181 {
2184 {
2185 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2186 }
2187 else if (classname != "" && food_stage)
2188 {
2189 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2190 }
2191 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2193
2194 }
2195
2197 {
2200 {
2201 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2202 }
2203 else if (classname != "" && food_stage)
2204 {
2205 return FoodStage.GetToxicity(null, food_stage, classname);
2206 }
2207 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2209 }
2210
2212 {
2215 {
2217 }
2218 else if (classname != "" && food_stage)
2219 {
2220 return FoodStage.GetAgents(null, food_stage, classname);
2221 }
2222 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2224 }
2225
2227 {
2230 {
2231 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2232 }
2233 else if (classname != "" && food_stage)
2234 {
2235 return FoodStage.GetDigestibility(null, food_stage, classname);
2236 }
2237 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2239 }
2240
2242 {
2245 {
2246 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2247 }
2248 else if (className != "" && foodStage)
2249 {
2250 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2251 }
2252 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2254 }
2255
2257 {
2267
2268 return profile;
2269 }
2270
2271
2272
2273
2275 {
2277 }
2278
2279
2281 {
2283 {
2285 }
2286
2287 return false;
2288 }
2289
2291 {
2293 {
2295 }
2296
2297 return false;
2298 }
2299
2301 {
2303 {
2305 }
2306
2307 return false;
2308 }
2309
2311 {
2313 {
2315 }
2316
2317 return false;
2318 }
2319
2321 {
2323 {
2325 }
2326
2327 return false;
2328 }
2329
2331 {
2333 {
2335 }
2336
2337 return false;
2338 }
2339
2340
2342 {
2344 }
2345
2347 {
2348 return GetFoodStage().GetNextFoodStageType( cooking_method );
2349 }
2350
2352 {
2353 return GetFoodStage().GetFoodStageName( food_stage_type );
2354 }
2355
2357 {
2358 return GetFoodStage().CanChangeToNewStage( cooking_method );
2359 }
2360
2361
2363 {
2364 if ( !source.GetFoodStage())
2365 return;
2370 }
2371
2374 {
2377 }
2378
2381 {
2382 switch (stageNew)
2383 {
2388 break;
2389
2392 break;
2393 }
2394 }
2395
2396
2397
2398
2399
2401 {
2403 }
2404
2406 {
2408
2409
2411 }
2412
2414 {
2416 {
2419 }
2420 }
2421
2422
2424 {
2426 if (player)
2427 {
2429 player.ServerReplaceItemInHandsWithNew(lambda);
2430 }
2431 else
2432 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2433 }
2434
2436 {
2438 }
2439
2441 {
2442 super.SetActions();
2443
2446 }
2447
2449 {
2450 #ifndef SERVER
2452 {
2454
2457 }
2458 #endif
2459 }
2460
2462 {
2463 #ifndef SERVER
2465 {
2469 }
2470 #endif
2471 }
2472
2474 {
2475 return false;
2476 }
2477
2479 {
2481 }
2482
2483 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2484 {
2486
2487 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2489 if ( hasRootAsPlayer )
2491
2492
2493
2494
2495
2496
2497
2499 {
2500
2502 {
2504 {
2508 break;
2509
2513 break;
2514
2518 break;
2519
2523 default:
2526 return;
2527 }
2528
2529
2530 }
2531
2533
2535 {
2537 {
2538
2540 {
2542 }
2544 {
2547 {
2549 }
2550 else
2551 {
2553 {
2555 }
2556 else
2557 {
2559 }
2560 }
2561 }
2562 }
2563 }
2564
2565 }
2567 {
2568
2570 {
2572 {
2576 break;
2577
2581 break;
2582
2586 break;
2587
2591 break;
2592
2595 default:
2598 return;
2599 }
2600 }
2601
2603
2605 {
2607 {
2608
2610 {
2612 }
2613 }
2614 }
2615 }
2617 {
2618
2620 {
2622 {
2626 break;
2627
2630 default:
2633 return;
2634 }
2635 }
2636
2638
2640 {
2642 {
2643
2645 {
2647 }
2648 }
2649 }
2650 }
2651 else
2652 {
2653
2655
2657 {
2660
2661 }
2662 else
2663 {
2665 {
2668 }
2669 }
2670 }
2671 }
2672
2674 {
2675 if (
GetGame().IsDedicatedServer())
2676 return;
2677
2679 {
2681 GetInventory().GetCurrentInventoryLocation(invLoc);
2683 {
2685 if (ptcMgr)
2686 {
2691 }
2692 }
2693 }
2695 {
2697 {
2700 return;
2701 }
2702
2704 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2706 {
2709 }
2710 }
2711 }
2712
2713 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2714 {
2715 super.GetDebugActions(outputList);
2716
2718 {
2722 }
2723 }
2724
2726 {
2727 super.OnAction(action_id, player, ctx);
2728
2730 {
2731 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2732 {
2734 if (food_stage_prev <= 0)
2735 {
2737 }
2739 return true;
2740 }
2741 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2742 {
2745 {
2747 }
2749 return true;
2750 }
2751
2752 }
2753
2754 #ifdef DIAG_DEVELOPER
2755 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2756 {
2757 PrintNutritionsData();
2758 return true;
2759 }
2760 #endif
2761
2762 return false;
2763 }
2764
2766 {
2767 string debug_output;
2768
2769 debug_output = super.GetDebugText();
2770
2773
2774 return debug_output;
2775 }
2776
2777
2778
2779
2780
2782 {
2783 float ret = super.GetBaitEffectivity();
2784
2786 {
2787 ret *= 0.5;
2788 }
2789
2790 return ret;
2791 }
2792
2794 {
2796 }
2797
2799 {
2801 }
2802
2804 {
2806 }
2807
2808 #ifdef DIAG_DEVELOPER
2809 private void PrintNutritionsData()
2810 {
2811 string nutritionsData = "";
2812
2815
2817 if (profile)
2818 {
2819 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2821 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2825 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2827
2830
2831 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2833 }
2834
2835 nutritionsData += "-----\n";
2836
2838 }
2839 #endif
2840
2842
2845 {
2847 }
2848}
2849
2851{
2853};
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.