1656{
1658
1666
1676
1678
1680 {
1682 {
1684
1686 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1687
1691 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1692 }
1693 }
1694
1696 {
1698
1700 }
1701
1703 {
1704 super.EEDelete(parent);
1705
1707
1710 }
1711
1713 {
1714 super.EEItemLocationChanged(oldLoc, newLoc);
1715
1718 {
1719 switch (oldLoc.GetParent().GetType())
1720 {
1721 case "FryingPan":
1722 case "Pot":
1723 case "Cauldron":
1724 case "SharpWoodenStick":
1726 break;
1727 }
1728
1731 {
1733 }
1734 }
1735
1736 if (oldLoc.IsValid())
1738
1741 }
1742
1744 {
1747 }
1748
1750 {
1753
1754 return true;
1755 }
1756
1758 {
1760 {
1762 }
1763 }
1764
1767 {
1768 int foodStageType;
1769
1771 if (foodStage)
1772 foodStageType = foodStage.GetFoodStageType();
1773
1778
1779 return agentsIn;
1780 }
1781
1782
1784 {
1785 return false;
1786 }
1787
1789 {
1790 return false;
1791 }
1792
1794 {
1796 {
1798 {
1801
1804
1805 default:
1806 return super.GetTemperatureFreezeTime();
1807 }
1808 }
1809
1810 return super.GetTemperatureFreezeTime();
1811 }
1812
1814 {
1816 {
1818 {
1821
1824
1825 default:
1826 return super.GetTemperatureThawTime();
1827 }
1828 }
1829
1830 return super.GetTemperatureThawTime();
1831 }
1832
1834 {
1836 }
1837
1838
1839
1840
1842 {
1843 SetSynchDirty();
1844 }
1845
1847 {
1848 super.OnVariablesSynchronized();
1849
1850
1851
1852
1854 {
1856 }
1857 else
1858 {
1860 }
1861
1864 }
1865
1866
1867
1868
1870 {
1873
1875 }
1876
1878 {
1879 string soundName = "";
1880
1883
1885 {
1887 }
1888 else
1889 {
1891 {
1893 {
1898 else
1899 soundName = "";
1900 break;
1901 }
1902
1904 {
1909 else
1910 soundName = "";
1911 break;
1912 }
1913
1915 {
1920 else
1921 soundName = "";
1922 break;
1923 }
1924
1925 default:
1926 soundName = "";
1927 break;
1928 }
1929
1931 {
1932 if (soundName == "")
1933 {
1935 }
1936 else
1937 {
1939 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1940 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1942 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1943 {
1945 }
1946 }
1947 }
1948 }
1949
1951 }
1952
1954 {
1957 }
1958
1959
1960
1961
1963 {
1964 super.OnStoreSave(ctx);
1965
1967 {
1969 }
1970
1971
1974 }
1975
1977 {
1978 if (!super.OnStoreLoad(ctx, version))
1979 return false;
1980
1982 {
1984 return false;
1985 }
1986
1987 if (version >= 115)
1988 {
1990 {
1992 return false;
1993 }
1995 {
1997 return false;
1998 }
1999 }
2000
2003
2004 return true;
2005 }
2006
2008 {
2009 super.AfterStoreLoad();
2010
2012 }
2013
2014
2016 {
2018 }
2019
2020
2022 {
2023 return false;
2024 }
2025
2027 {
2028 return false;
2029 }
2030
2032 {
2033 return false;
2034 }
2035
2037 {
2038 return false;
2039 }
2040
2041
2042
2043
2044
2046 {
2049 {
2050 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2051 }
2052 else if (classname != "" && food_stage)
2053 {
2054 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2055 }
2056 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2058
2059 }
2060
2062 {
2065 {
2067 }
2068 else if (classname != "" && food_stage)
2069 {
2070 return FoodStage.GetEnergy(null, food_stage, classname);
2071 }
2072 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2074 }
2075
2077 {
2080 {
2082 }
2083 else if (classname != "" && food_stage)
2084 {
2085 return FoodStage.GetWater(null, food_stage, classname);
2086 }
2087 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2089 }
2090
2092 {
2095 {
2096 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2097 }
2098 else if (classname != "" && food_stage)
2099 {
2100 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2101 }
2102 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2104
2105 }
2106
2108 {
2111 {
2112 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2113 }
2114 else if (classname != "" && food_stage)
2115 {
2116 return FoodStage.GetToxicity(null, food_stage, classname);
2117 }
2118 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2120 }
2121
2123 {
2126 {
2128 }
2129 else if (classname != "" && food_stage)
2130 {
2131 return FoodStage.GetAgents(null, food_stage, classname);
2132 }
2133 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2135 }
2136
2138 {
2141 {
2142 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2143 }
2144 else if (classname != "" && food_stage)
2145 {
2146 return FoodStage.GetDigestibility(null, food_stage, classname);
2147 }
2148 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2150 }
2151
2153 {
2156 {
2157 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2158 }
2159 else if (className != "" && foodStage)
2160 {
2161 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2162 }
2163 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2165 }
2166
2168 {
2178
2179 return profile;
2180 }
2181
2182
2183
2184
2186 {
2188 }
2189
2190
2192 {
2194 {
2196 }
2197
2198 return false;
2199 }
2200
2202 {
2204 {
2206 }
2207
2208 return false;
2209 }
2210
2212 {
2214 {
2216 }
2217
2218 return false;
2219 }
2220
2222 {
2224 {
2226 }
2227
2228 return false;
2229 }
2230
2232 {
2234 {
2236 }
2237
2238 return false;
2239 }
2240
2242 {
2244 {
2246 }
2247
2248 return false;
2249 }
2250
2251
2253 {
2255 }
2256
2258 {
2259 return GetFoodStage().GetNextFoodStageType( cooking_method );
2260 }
2261
2263 {
2264 return GetFoodStage().GetFoodStageName( food_stage_type );
2265 }
2266
2268 {
2269 return GetFoodStage().CanChangeToNewStage( cooking_method );
2270 }
2271
2272
2274 {
2275 if ( !source.GetFoodStage())
2276 return;
2281 }
2282
2285 {
2288 }
2289
2292 {
2293 switch (stageNew)
2294 {
2299 break;
2300
2303 break;
2304 }
2305 }
2306
2307
2308
2309
2310
2312 {
2314 }
2315
2317 {
2319
2320
2322 }
2323
2325 {
2327 {
2330 }
2331 }
2332
2333
2335 {
2337 if (player)
2338 {
2340 player.ServerReplaceItemInHandsWithNew(lambda);
2341 }
2342 else
2343 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2344 }
2345
2347 {
2349 }
2350
2352 {
2353 super.SetActions();
2354
2357 }
2358
2360 {
2361 #ifndef SERVER
2363 {
2365
2368 }
2369 #endif
2370 }
2371
2373 {
2374 #ifndef SERVER
2376 {
2380 }
2381 #endif
2382 }
2383
2385 {
2386 return false;
2387 }
2388
2390 {
2392 }
2393
2394 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2395 {
2397
2398 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2400 if ( hasRootAsPlayer )
2402
2403
2404
2405
2406
2407
2408
2410 {
2411
2413 {
2415 {
2419 break;
2420
2424 break;
2425
2429 break;
2430
2434 default:
2437 return;
2438 }
2439
2440
2441 }
2442
2444
2446 {
2448 {
2449
2451 {
2453 }
2455 {
2458 {
2460 }
2461 else
2462 {
2464 {
2466 }
2467 else
2468 {
2470 }
2471 }
2472 }
2473 }
2474 }
2475
2476 }
2478 {
2479
2481 {
2483 {
2487 break;
2488
2492 break;
2493
2497 break;
2498
2502 break;
2503
2506 default:
2509 return;
2510 }
2511 }
2512
2514
2516 {
2518 {
2519
2521 {
2523 }
2524 }
2525 }
2526 }
2528 {
2529
2531 {
2533 {
2537 break;
2538
2541 default:
2544 return;
2545 }
2546 }
2547
2549
2551 {
2553 {
2554
2556 {
2558 }
2559 }
2560 }
2561 }
2562 else
2563 {
2564
2566
2568 {
2571
2572 }
2573 else
2574 {
2576 {
2579 }
2580 }
2581 }
2582 }
2583
2585 {
2586 if (
GetGame().IsDedicatedServer())
2587 return;
2588
2590 {
2592 GetInventory().GetCurrentInventoryLocation(invLoc);
2594 {
2596 if (ptcMgr)
2597 {
2602 }
2603 }
2604 }
2606 {
2608 {
2611 return;
2612 }
2613
2615 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2617 {
2620 }
2621 }
2622 }
2623
2624 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2625 {
2627 {
2632 }
2633
2634 super.GetDebugActions(outputList);
2635 }
2636
2638 {
2639 super.OnAction(action_id, player, ctx);
2640
2642 {
2643 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2644 {
2646 if (food_stage_prev <= 0)
2647 {
2649 }
2651 return true;
2652 }
2653 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2654 {
2657 {
2659 }
2661 return true;
2662 }
2663
2664 }
2665
2666 #ifdef DIAG_DEVELOPER
2667 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2668 {
2669 PrintNutritionsData();
2670 return true;
2671 }
2672 #endif
2673
2674 return false;
2675 }
2676
2678 {
2679 string debug_output;
2680
2681 debug_output = super.GetDebugText();
2682
2685
2686 return debug_output;
2687 }
2688
2689
2690
2691
2692
2694 {
2695 float ret = super.GetBaitEffectivity();
2696
2698 {
2699 ret *= 0.5;
2700 }
2701
2702 return ret;
2703 }
2704
2706 {
2708 }
2709
2711 {
2713 }
2714
2716 {
2718 }
2719
2720 #ifdef DIAG_DEVELOPER
2721 private void PrintNutritionsData()
2722 {
2723 string nutritionsData = "";
2724
2727
2729 if (profile)
2730 {
2731 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2733 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2737 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2739
2742
2743 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2745 }
2746
2747 nutritionsData += "-----\n";
2748
2750 }
2751 #endif
2752
2754
2757 {
2759 }
2760}
2761
2763{
2765};
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.