1577{
1579
1587
1597
1599
1601 {
1603 {
1605
1607 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1608
1612 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1613 }
1614 }
1615
1617 {
1619
1621 }
1622
1624 {
1625 super.EEDelete(parent);
1626
1628
1631 }
1632
1634 {
1635 super.EEItemLocationChanged(oldLoc, newLoc);
1636
1639 {
1640 switch (oldLoc.GetParent().GetType())
1641 {
1642 case "FryingPan":
1643 case "Pot":
1644 case "Cauldron":
1645 case "SharpWoodenStick":
1647 break;
1648 }
1649
1652 {
1654 }
1655 }
1656
1657 if (oldLoc.IsValid())
1659
1662 }
1663
1665 {
1668 }
1669
1671 {
1674
1675 return true;
1676 }
1677
1679 {
1681 {
1683 }
1684 }
1685
1688 {
1689 int foodStageType;
1690
1692 if (foodStage)
1693 foodStageType = foodStage.GetFoodStageType();
1694
1699
1700 return agentsIn;
1701 }
1702
1703
1705 {
1706 return false;
1707 }
1708
1710 {
1711 return false;
1712 }
1713
1715 {
1717 {
1719 {
1722
1725
1726 default:
1727 return super.GetTemperatureFreezeTime();
1728 }
1729 }
1730
1731 return super.GetTemperatureFreezeTime();
1732 }
1733
1735 {
1737 {
1739 {
1742
1745
1746 default:
1747 return super.GetTemperatureThawTime();
1748 }
1749 }
1750
1751 return super.GetTemperatureThawTime();
1752 }
1753
1755 {
1757 }
1758
1759
1760
1761
1763 {
1764 SetSynchDirty();
1765 }
1766
1768 {
1769 super.OnVariablesSynchronized();
1770
1771
1772
1773
1775 {
1777 }
1778 else
1779 {
1781 }
1782
1785 }
1786
1787
1788
1789
1791 {
1794
1796 }
1797
1799 {
1800 string soundName = "";
1801
1804
1806 {
1808 }
1809 else
1810 {
1812 {
1814 {
1819 else
1820 soundName = "";
1821 break;
1822 }
1823
1825 {
1830 else
1831 soundName = "";
1832 break;
1833 }
1834
1836 {
1841 else
1842 soundName = "";
1843 break;
1844 }
1845
1846 default:
1847 soundName = "";
1848 break;
1849 }
1850
1852 {
1853 if (soundName == "")
1854 {
1856 }
1857 else
1858 {
1860 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1861 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1863 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1864 {
1866 }
1867 }
1868 }
1869 }
1870
1872 }
1873
1875 {
1878 }
1879
1880
1881
1882
1884 {
1885 super.OnStoreSave(ctx);
1886
1888 {
1890 }
1891
1892
1895 }
1896
1898 {
1899 if (!super.OnStoreLoad(ctx, version))
1900 return false;
1901
1903 {
1905 return false;
1906 }
1907
1908 if (version >= 115)
1909 {
1911 {
1913 return false;
1914 }
1916 {
1918 return false;
1919 }
1920 }
1921
1924
1925 return true;
1926 }
1927
1929 {
1930 super.AfterStoreLoad();
1931
1933 }
1934
1935
1937 {
1939 }
1940
1941
1943 {
1944 return false;
1945 }
1946
1948 {
1949 return false;
1950 }
1951
1953 {
1954 return false;
1955 }
1956
1958 {
1959 return false;
1960 }
1961
1962
1963
1964
1965
1967 {
1970 {
1971 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1972 }
1973 else if (classname != "" && food_stage)
1974 {
1975 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1976 }
1977 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1979
1980 }
1981
1983 {
1986 {
1988 }
1989 else if (classname != "" && food_stage)
1990 {
1991 return FoodStage.GetEnergy(null, food_stage, classname);
1992 }
1993 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1995 }
1996
1998 {
2001 {
2003 }
2004 else if (classname != "" && food_stage)
2005 {
2006 return FoodStage.GetWater(null, food_stage, classname);
2007 }
2008 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2010 }
2011
2013 {
2016 {
2017 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2018 }
2019 else if (classname != "" && food_stage)
2020 {
2021 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2022 }
2023 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2025
2026 }
2027
2029 {
2032 {
2033 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2034 }
2035 else if (classname != "" && food_stage)
2036 {
2037 return FoodStage.GetToxicity(null, food_stage, classname);
2038 }
2039 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2041 }
2042
2044 {
2047 {
2049 }
2050 else if (classname != "" && food_stage)
2051 {
2052 return FoodStage.GetAgents(null, food_stage, classname);
2053 }
2054 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2056 }
2057
2059 {
2062 {
2063 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2064 }
2065 else if (classname != "" && food_stage)
2066 {
2067 return FoodStage.GetDigestibility(null, food_stage, classname);
2068 }
2069 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2071 }
2072
2074 {
2077 {
2078 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2079 }
2080 else if (className != "" && foodStage)
2081 {
2082 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2083 }
2084 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2086 }
2087
2089 {
2099
2100 return profile;
2101 }
2102
2103
2104
2105
2107 {
2109 }
2110
2111
2113 {
2115 {
2117 }
2118
2119 return false;
2120 }
2121
2123 {
2125 {
2127 }
2128
2129 return false;
2130 }
2131
2133 {
2135 {
2137 }
2138
2139 return false;
2140 }
2141
2143 {
2145 {
2147 }
2148
2149 return false;
2150 }
2151
2153 {
2155 {
2157 }
2158
2159 return false;
2160 }
2161
2163 {
2165 {
2167 }
2168
2169 return false;
2170 }
2171
2172
2174 {
2176 }
2177
2179 {
2180 return GetFoodStage().GetNextFoodStageType( cooking_method );
2181 }
2182
2184 {
2185 return GetFoodStage().GetFoodStageName( food_stage_type );
2186 }
2187
2189 {
2190 return GetFoodStage().CanChangeToNewStage( cooking_method );
2191 }
2192
2193
2195 {
2196 if ( !source.GetFoodStage())
2197 return;
2202 }
2203
2206 {
2209 }
2210
2213 {
2214 switch (stageNew)
2215 {
2220 break;
2221
2224 break;
2225 }
2226 }
2227
2228
2229
2230
2231
2233 {
2235 }
2236
2238 {
2240
2241
2243 }
2244
2246 {
2248 {
2251 }
2252 }
2253
2254
2256 {
2258 if (player)
2259 {
2261 player.ServerReplaceItemInHandsWithNew(lambda);
2262 }
2263 else
2264 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2265 }
2266
2268 {
2270 }
2271
2273 {
2274 super.SetActions();
2275
2278 }
2279
2281 {
2282 #ifndef SERVER
2284 {
2286
2289 }
2290 #endif
2291 }
2292
2294 {
2295 #ifndef SERVER
2297 {
2301 }
2302 #endif
2303 }
2304
2306 {
2307 return false;
2308 }
2309
2311 {
2313 }
2314
2315 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2316 {
2318
2319 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2321 if ( hasRootAsPlayer )
2323
2324
2325
2326
2327
2328
2329
2331 {
2332
2334 {
2336 {
2340 break;
2341
2345 break;
2346
2350 break;
2351
2355 default:
2358 return;
2359 }
2360
2361
2362 }
2363
2365
2367 {
2369 {
2370
2372 {
2374 }
2376 {
2379 {
2381 }
2382 else
2383 {
2385 {
2387 }
2388 else
2389 {
2391 }
2392 }
2393 }
2394 }
2395 }
2396
2397 }
2399 {
2400
2402 {
2404 {
2408 break;
2409
2413 break;
2414
2418 break;
2419
2423 break;
2424
2427 default:
2430 return;
2431 }
2432 }
2433
2435
2437 {
2439 {
2440
2442 {
2444 }
2445 }
2446 }
2447 }
2449 {
2450
2452 {
2454 {
2458 break;
2459
2462 default:
2465 return;
2466 }
2467 }
2468
2470
2472 {
2474 {
2475
2477 {
2479 }
2480 }
2481 }
2482 }
2483 else
2484 {
2485
2487
2489 {
2492
2493 }
2494 else
2495 {
2497 {
2500 }
2501 }
2502 }
2503 }
2504
2506 {
2507 if (
GetGame().IsDedicatedServer())
2508 return;
2509
2511 {
2513 GetInventory().GetCurrentInventoryLocation(invLoc);
2515 {
2517 if (ptcMgr)
2518 {
2523 }
2524 }
2525 }
2527 {
2529 {
2532 return;
2533 }
2534
2536 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2538 {
2541 }
2542 }
2543 }
2544
2545 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2546 {
2548 {
2553 }
2554
2555 super.GetDebugActions(outputList);
2556 }
2557
2559 {
2560 super.OnAction(action_id, player, ctx);
2561
2563 {
2564 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2565 {
2567 if (food_stage_prev <= 0)
2568 {
2570 }
2572 return true;
2573 }
2574 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2575 {
2578 {
2580 }
2582 return true;
2583 }
2584
2585 }
2586
2587 #ifdef DIAG_DEVELOPER
2588 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2589 {
2590 PrintNutritionsData();
2591 return true;
2592 }
2593 #endif
2594
2595 return false;
2596 }
2597
2599 {
2600 string debug_output;
2601
2602 debug_output = super.GetDebugText();
2603
2606
2607 return debug_output;
2608 }
2609
2610
2611
2612
2613
2615 {
2616 float ret = super.GetBaitEffectivity();
2617
2619 {
2620 ret *= 0.5;
2621 }
2622
2623 return ret;
2624 }
2625
2627 {
2629 }
2630
2632 {
2634 }
2635
2637 {
2639 }
2640
2641 #ifdef DIAG_DEVELOPER
2642 private void PrintNutritionsData()
2643 {
2644 string nutritionsData = "";
2645
2648
2650 if (profile)
2651 {
2652 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2654 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2658 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2660
2663
2664 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2666 }
2667
2668 nutritionsData += "-----\n";
2669
2671 }
2672 #endif
2673
2675
2678 {
2680 }
2681}
2682
2684{
2686};
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.