1639{
1641
1649
1659
1661
1663 {
1665 {
1667
1669 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1670
1674 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1675 }
1676 }
1677
1679 {
1681
1683 }
1684
1686 {
1687 super.EEDelete(parent);
1688
1690
1693 }
1694
1696 {
1697 super.EEItemLocationChanged(oldLoc, newLoc);
1698
1701 {
1702 switch (oldLoc.GetParent().GetType())
1703 {
1704 case "FryingPan":
1705 case "Pot":
1706 case "Cauldron":
1707 case "SharpWoodenStick":
1709 break;
1710 }
1711
1714 {
1716 }
1717 }
1718
1719 if (oldLoc.IsValid())
1721
1724 }
1725
1727 {
1730 }
1731
1733 {
1736
1737 return true;
1738 }
1739
1741 {
1743 {
1745 }
1746 }
1747
1750 {
1751 int foodStageType;
1752
1754 if (foodStage)
1755 foodStageType = foodStage.GetFoodStageType();
1756
1761
1762 return agentsIn;
1763 }
1764
1765
1767 {
1768 return false;
1769 }
1770
1772 {
1773 return false;
1774 }
1775
1777 {
1779 {
1781 {
1784
1787
1788 default:
1789 return super.GetTemperatureFreezeTime();
1790 }
1791 }
1792
1793 return super.GetTemperatureFreezeTime();
1794 }
1795
1797 {
1799 {
1801 {
1804
1807
1808 default:
1809 return super.GetTemperatureThawTime();
1810 }
1811 }
1812
1813 return super.GetTemperatureThawTime();
1814 }
1815
1817 {
1819 }
1820
1821
1822
1823
1825 {
1826 SetSynchDirty();
1827 }
1828
1830 {
1831 super.OnVariablesSynchronized();
1832
1833
1834
1835
1837 {
1839 }
1840 else
1841 {
1843 }
1844
1847 }
1848
1849
1850
1851
1853 {
1856
1858 }
1859
1861 {
1862 string soundName = "";
1863
1866
1868 {
1870 }
1871 else
1872 {
1874 {
1876 {
1881 else
1882 soundName = "";
1883 break;
1884 }
1885
1887 {
1892 else
1893 soundName = "";
1894 break;
1895 }
1896
1898 {
1903 else
1904 soundName = "";
1905 break;
1906 }
1907
1908 default:
1909 soundName = "";
1910 break;
1911 }
1912
1914 {
1915 if (soundName == "")
1916 {
1918 }
1919 else
1920 {
1922 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1923 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1925 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1926 {
1928 }
1929 }
1930 }
1931 }
1932
1934 }
1935
1937 {
1940 }
1941
1942
1943
1944
1946 {
1947 super.OnStoreSave(ctx);
1948
1950 {
1952 }
1953
1954
1957 }
1958
1960 {
1961 if (!super.OnStoreLoad(ctx, version))
1962 return false;
1963
1965 {
1967 return false;
1968 }
1969
1970 if (version >= 115)
1971 {
1973 {
1975 return false;
1976 }
1978 {
1980 return false;
1981 }
1982 }
1983
1986
1987 return true;
1988 }
1989
1991 {
1992 super.AfterStoreLoad();
1993
1995 }
1996
1997
1999 {
2001 }
2002
2003
2005 {
2006 return false;
2007 }
2008
2010 {
2011 return false;
2012 }
2013
2015 {
2016 return false;
2017 }
2018
2020 {
2021 return false;
2022 }
2023
2024
2025
2026
2027
2029 {
2032 {
2033 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2034 }
2035 else if (classname != "" && food_stage)
2036 {
2037 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2038 }
2039 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2041
2042 }
2043
2045 {
2048 {
2050 }
2051 else if (classname != "" && food_stage)
2052 {
2053 return FoodStage.GetEnergy(null, food_stage, classname);
2054 }
2055 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2057 }
2058
2060 {
2063 {
2065 }
2066 else if (classname != "" && food_stage)
2067 {
2068 return FoodStage.GetWater(null, food_stage, classname);
2069 }
2070 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2072 }
2073
2075 {
2078 {
2079 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2080 }
2081 else if (classname != "" && food_stage)
2082 {
2083 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2084 }
2085 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2087
2088 }
2089
2091 {
2094 {
2095 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2096 }
2097 else if (classname != "" && food_stage)
2098 {
2099 return FoodStage.GetToxicity(null, food_stage, classname);
2100 }
2101 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2103 }
2104
2106 {
2109 {
2111 }
2112 else if (classname != "" && food_stage)
2113 {
2114 return FoodStage.GetAgents(null, food_stage, classname);
2115 }
2116 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2118 }
2119
2121 {
2124 {
2125 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2126 }
2127 else if (classname != "" && food_stage)
2128 {
2129 return FoodStage.GetDigestibility(null, food_stage, classname);
2130 }
2131 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2133 }
2134
2136 {
2139 {
2140 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2141 }
2142 else if (className != "" && foodStage)
2143 {
2144 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2145 }
2146 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2148 }
2149
2151 {
2161
2162 return profile;
2163 }
2164
2165
2166
2167
2169 {
2171 }
2172
2173
2175 {
2177 {
2179 }
2180
2181 return false;
2182 }
2183
2185 {
2187 {
2189 }
2190
2191 return false;
2192 }
2193
2195 {
2197 {
2199 }
2200
2201 return false;
2202 }
2203
2205 {
2207 {
2209 }
2210
2211 return false;
2212 }
2213
2215 {
2217 {
2219 }
2220
2221 return false;
2222 }
2223
2225 {
2227 {
2229 }
2230
2231 return false;
2232 }
2233
2234
2236 {
2238 }
2239
2241 {
2242 return GetFoodStage().GetNextFoodStageType( cooking_method );
2243 }
2244
2246 {
2247 return GetFoodStage().GetFoodStageName( food_stage_type );
2248 }
2249
2251 {
2252 return GetFoodStage().CanChangeToNewStage( cooking_method );
2253 }
2254
2255
2257 {
2258 if ( !source.GetFoodStage())
2259 return;
2264 }
2265
2268 {
2271 }
2272
2275 {
2276 switch (stageNew)
2277 {
2282 break;
2283
2286 break;
2287 }
2288 }
2289
2290
2291
2292
2293
2295 {
2297 }
2298
2300 {
2302
2303
2305 }
2306
2308 {
2310 {
2313 }
2314 }
2315
2316
2318 {
2320 if (player)
2321 {
2323 player.ServerReplaceItemInHandsWithNew(lambda);
2324 }
2325 else
2326 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2327 }
2328
2330 {
2332 }
2333
2335 {
2336 super.SetActions();
2337
2340 }
2341
2343 {
2344 #ifndef SERVER
2346 {
2348
2351 }
2352 #endif
2353 }
2354
2356 {
2357 #ifndef SERVER
2359 {
2363 }
2364 #endif
2365 }
2366
2368 {
2369 return false;
2370 }
2371
2373 {
2375 }
2376
2377 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2378 {
2380
2381 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2383 if ( hasRootAsPlayer )
2385
2386
2387
2388
2389
2390
2391
2393 {
2394
2396 {
2398 {
2402 break;
2403
2407 break;
2408
2412 break;
2413
2417 default:
2420 return;
2421 }
2422
2423
2424 }
2425
2427
2429 {
2431 {
2432
2434 {
2436 }
2438 {
2441 {
2443 }
2444 else
2445 {
2447 {
2449 }
2450 else
2451 {
2453 }
2454 }
2455 }
2456 }
2457 }
2458
2459 }
2461 {
2462
2464 {
2466 {
2470 break;
2471
2475 break;
2476
2480 break;
2481
2485 break;
2486
2489 default:
2492 return;
2493 }
2494 }
2495
2497
2499 {
2501 {
2502
2504 {
2506 }
2507 }
2508 }
2509 }
2511 {
2512
2514 {
2516 {
2520 break;
2521
2524 default:
2527 return;
2528 }
2529 }
2530
2532
2534 {
2536 {
2537
2539 {
2541 }
2542 }
2543 }
2544 }
2545 else
2546 {
2547
2549
2551 {
2554
2555 }
2556 else
2557 {
2559 {
2562 }
2563 }
2564 }
2565 }
2566
2568 {
2569 if (
GetGame().IsDedicatedServer())
2570 return;
2571
2573 {
2575 GetInventory().GetCurrentInventoryLocation(invLoc);
2577 {
2579 if (ptcMgr)
2580 {
2585 }
2586 }
2587 }
2589 {
2591 {
2594 return;
2595 }
2596
2598 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2600 {
2603 }
2604 }
2605 }
2606
2607 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2608 {
2609 super.GetDebugActions(outputList);
2610
2612 {
2616 }
2617 }
2618
2620 {
2621 super.OnAction(action_id, player, ctx);
2622
2624 {
2625 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2626 {
2628 if (food_stage_prev <= 0)
2629 {
2631 }
2633 return true;
2634 }
2635 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2636 {
2639 {
2641 }
2643 return true;
2644 }
2645
2646 }
2647
2648 #ifdef DIAG_DEVELOPER
2649 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2650 {
2651 PrintNutritionsData();
2652 return true;
2653 }
2654 #endif
2655
2656 return false;
2657 }
2658
2660 {
2661 string debug_output;
2662
2663 debug_output = super.GetDebugText();
2664
2667
2668 return debug_output;
2669 }
2670
2671
2672
2673
2674
2676 {
2677 float ret = super.GetBaitEffectivity();
2678
2680 {
2681 ret *= 0.5;
2682 }
2683
2684 return ret;
2685 }
2686
2688 {
2690 }
2691
2693 {
2695 }
2696
2698 {
2700 }
2701
2702 #ifdef DIAG_DEVELOPER
2703 private void PrintNutritionsData()
2704 {
2705 string nutritionsData = "";
2706
2709
2711 if (profile)
2712 {
2713 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2715 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2719 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2721
2724
2725 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2727 }
2728
2729 nutritionsData += "-----\n";
2730
2732 }
2733 #endif
2734
2736
2739 {
2741 }
2742}
2743
2745{
2747};
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.