1535{
1537
1545
1555
1557
1559 {
1561 {
1563
1565 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1566
1570 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1571 }
1572 }
1573
1575 {
1577
1579 }
1580
1582 {
1583 super.EEDelete(parent);
1584
1586
1589 }
1590
1592 {
1593 super.EEItemLocationChanged(oldLoc, newLoc);
1594
1597 {
1598 switch (oldLoc.GetParent().GetType())
1599 {
1600 case "FryingPan":
1601 case "Pot":
1602 case "Cauldron":
1603 case "SharpWoodenStick":
1605 break;
1606 }
1607
1610 {
1612 }
1613 }
1614
1615 if (oldLoc.IsValid())
1617
1620 }
1621
1623 {
1626 }
1627
1629 {
1632
1633 return true;
1634 }
1635
1637 {
1639 {
1641 }
1642 }
1643
1646 {
1647 int foodStageType;
1648
1650 if (foodStage)
1651 foodStageType = foodStage.GetFoodStageType();
1652
1657
1658 return agentsIn;
1659 }
1660
1661
1663 {
1664 return false;
1665 }
1666
1668 {
1669 return false;
1670 }
1671
1673 {
1675 {
1677 {
1680
1683
1684 default:
1685 return super.GetTemperatureFreezeTime();
1686 }
1687 }
1688
1689 return super.GetTemperatureFreezeTime();
1690 }
1691
1693 {
1695 {
1697 {
1700
1703
1704 default:
1705 return super.GetTemperatureThawTime();
1706 }
1707 }
1708
1709 return super.GetTemperatureThawTime();
1710 }
1711
1713 {
1715 }
1716
1717
1718
1719
1721 {
1722 SetSynchDirty();
1723 }
1724
1726 {
1727 super.OnVariablesSynchronized();
1728
1729
1730
1731
1733 {
1735 }
1736 else
1737 {
1739 }
1740
1743 }
1744
1745
1746
1747
1749 {
1752
1754 }
1755
1757 {
1758 string soundName = "";
1759
1762
1764 {
1766 }
1767 else
1768 {
1770 {
1772 {
1777 else
1778 soundName = "";
1779 break;
1780 }
1781
1783 {
1788 else
1789 soundName = "";
1790 break;
1791 }
1792
1794 {
1799 else
1800 soundName = "";
1801 break;
1802 }
1803
1804 default:
1805 soundName = "";
1806 break;
1807 }
1808
1810 {
1811 if (soundName == "")
1812 {
1814 }
1815 else
1816 {
1818 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1819 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1821 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1822 {
1824 }
1825 }
1826 }
1827 }
1828
1830 }
1831
1833 {
1836 }
1837
1838
1839
1840
1842 {
1843 super.OnStoreSave(ctx);
1844
1846 {
1848 }
1849
1850
1853 }
1854
1856 {
1857 if (!super.OnStoreLoad(ctx, version))
1858 return false;
1859
1861 {
1863 return false;
1864 }
1865
1866 if (version >= 115)
1867 {
1869 {
1871 return false;
1872 }
1874 {
1876 return false;
1877 }
1878 }
1879
1882
1883 return true;
1884 }
1885
1887 {
1888 super.AfterStoreLoad();
1889
1891 }
1892
1893
1895 {
1897 }
1898
1899
1901 {
1902 return false;
1903 }
1904
1906 {
1907 return false;
1908 }
1909
1911 {
1912 return false;
1913 }
1914
1916 {
1917 return false;
1918 }
1919
1920
1921
1922
1923
1925 {
1928 {
1929 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1930 }
1931 else if (classname != "" && food_stage)
1932 {
1933 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1934 }
1935 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1936 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1937
1938 }
1939
1941 {
1944 {
1946 }
1947 else if (classname != "" && food_stage)
1948 {
1949 return FoodStage.GetEnergy(null, food_stage, classname);
1950 }
1951 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1952 return g_Game.ConfigGetFloat( class_path +
" energy" );
1953 }
1954
1956 {
1959 {
1961 }
1962 else if (classname != "" && food_stage)
1963 {
1964 return FoodStage.GetWater(null, food_stage, classname);
1965 }
1966 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1967 return g_Game.ConfigGetFloat( class_path +
" water" );
1968 }
1969
1971 {
1974 {
1975 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1976 }
1977 else if (classname != "" && food_stage)
1978 {
1979 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1980 }
1981 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1982 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1983
1984 }
1985
1987 {
1990 {
1991 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1992 }
1993 else if (classname != "" && food_stage)
1994 {
1995 return FoodStage.GetToxicity(null, food_stage, classname);
1996 }
1997 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1998 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1999 }
2000
2002 {
2005 {
2007 }
2008 else if (classname != "" && food_stage)
2009 {
2010 return FoodStage.GetAgents(null, food_stage, classname);
2011 }
2012 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2013 return g_Game.ConfigGetInt( class_path +
" agents" );
2014 }
2015
2017 {
2020 {
2021 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2022 }
2023 else if (classname != "" && food_stage)
2024 {
2025 return FoodStage.GetDigestibility(null, food_stage, classname);
2026 }
2027 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2028 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2029 }
2030
2032 {
2035 {
2036 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2037 }
2038 else if (className != "" && foodStage)
2039 {
2040 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2041 }
2042 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2043 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2044 }
2045
2047 {
2057
2058 return profile;
2059 }
2060
2061
2062
2063
2065 {
2067 }
2068
2069
2071 {
2073 {
2075 }
2076
2077 return false;
2078 }
2079
2081 {
2083 {
2085 }
2086
2087 return false;
2088 }
2089
2091 {
2093 {
2095 }
2096
2097 return false;
2098 }
2099
2101 {
2103 {
2105 }
2106
2107 return false;
2108 }
2109
2111 {
2113 {
2115 }
2116
2117 return false;
2118 }
2119
2121 {
2123 {
2125 }
2126
2127 return false;
2128 }
2129
2130
2132 {
2134 }
2135
2137 {
2138 return GetFoodStage().GetNextFoodStageType( cooking_method );
2139 }
2140
2142 {
2143 return GetFoodStage().GetFoodStageName( food_stage_type );
2144 }
2145
2147 {
2148 return GetFoodStage().CanChangeToNewStage( cooking_method );
2149 }
2150
2151
2153 {
2154 if ( !source.GetFoodStage())
2155 return;
2160 }
2161
2164 {
2167 }
2168
2171 {
2172 switch (stageNew)
2173 {
2178 break;
2179
2182 break;
2183 }
2184 }
2185
2186
2187
2188
2189
2191 {
2193 }
2194
2196 {
2198
2199
2201 }
2202
2204 {
2206 {
2209 }
2210 }
2211
2212
2214 {
2216 if (player)
2217 {
2219 player.ServerReplaceItemInHandsWithNew(lambda);
2220 }
2221 else
2222 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2223 }
2224
2226 {
2228 }
2229
2231 {
2232 super.SetActions();
2233
2236 }
2237
2239 {
2240 #ifndef SERVER
2241 #ifndef NO_GUI
2243 {
2245
2248 }
2249 #endif
2250 #endif
2251 }
2252
2254 {
2255 #ifndef SERVER
2256 #ifndef NO_GUI
2258 {
2262 }
2263 #endif
2264 #endif
2265 }
2266
2268 {
2269 return false;
2270 }
2271
2273 {
2275 }
2276
2277 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2278 {
2280
2281 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2283 if ( hasRootAsPlayer )
2285
2286
2287
2288
2289
2290
2291
2293 {
2294
2296 {
2298 {
2302 break;
2303
2307 break;
2308
2312 break;
2313
2317 default:
2320 return;
2321 }
2322
2323
2324 }
2325
2327
2329 {
2331 {
2332
2334 {
2336 }
2338 {
2341 {
2343 }
2344 else
2345 {
2347 {
2349 }
2350 else
2351 {
2353 }
2354 }
2355 }
2356 }
2357 }
2358
2359 }
2361 {
2362
2364 {
2366 {
2370 break;
2371
2375 break;
2376
2380 break;
2381
2385 break;
2386
2389 default:
2392 return;
2393 }
2394 }
2395
2397
2399 {
2401 {
2402
2404 {
2406 }
2407 }
2408 }
2409 }
2411 {
2412
2414 {
2416 {
2420 break;
2421
2424 default:
2427 return;
2428 }
2429 }
2430
2432
2434 {
2436 {
2437
2439 {
2441 }
2442 }
2443 }
2444 }
2445 else
2446 {
2447
2449
2451 {
2454
2455 }
2456 else
2457 {
2459 {
2462 }
2463 }
2464 }
2465 }
2466
2468 {
2469 if (
g_Game.IsHeadlessOrDedicatedServer())
2470 return;
2471
2473 {
2475 GetInventory().GetCurrentInventoryLocation(invLoc);
2477 {
2479 if (ptcMgr)
2480 {
2485 }
2486 }
2487 }
2489 {
2491 {
2494 return;
2495 }
2496
2498 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2500 {
2503 }
2504 }
2505 }
2506
2507 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2508 {
2510 {
2515 }
2516
2517 super.GetDebugActions(outputList);
2518 }
2519
2521 {
2522 super.OnAction(action_id, player, ctx);
2523
2525 {
2526 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2527 {
2529 if (food_stage_prev <= 0)
2530 {
2532 }
2534 return true;
2535 }
2536 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2537 {
2540 {
2542 }
2544 return true;
2545 }
2546
2547 }
2548
2549 #ifdef DIAG_DEVELOPER
2550 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2551 {
2552 PrintNutritionsData();
2553 return true;
2554 }
2555 #endif
2556
2557 return false;
2558 }
2559
2561 {
2562 string debug_output;
2563
2564 debug_output = super.GetDebugText();
2565
2568
2569 return debug_output;
2570 }
2571
2572
2573
2574
2575
2577 {
2578 float ret = super.GetBaitEffectivity();
2579
2581 {
2582 ret *= 0.5;
2583 }
2584
2585 return ret;
2586 }
2587
2589 {
2591 }
2592
2594 {
2596 }
2597
2599 {
2601 }
2602
2603 #ifdef DIAG_DEVELOPER
2604 private void PrintNutritionsData()
2605 {
2606 string nutritionsData = "";
2607
2610
2612 if (profile)
2613 {
2614 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2616 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2620 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2622
2625
2626 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2628 }
2629
2630 nutritionsData += "-----\n";
2631
2633 }
2634 #endif
2635
2637
2640 {
2642 }
2643}
2644
2646{
2648};
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 RemoveAllAgentsExcept(int agent_to_keep)
override void InsertAgent(int agent, float count=1)
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.
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
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
vector GetPosition()
Get the world position of the Effect.
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.