1520{
1522
1530
1540
1542
1544 {
1546 {
1548
1550 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1551
1555 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1556 }
1557 }
1558
1560 {
1562
1564 }
1565
1567 {
1568 super.EEDelete(parent);
1569
1571
1574 }
1575
1577 {
1578 super.EEItemLocationChanged(oldLoc, newLoc);
1579
1582 {
1583 switch (oldLoc.GetParent().GetType())
1584 {
1585 case "FryingPan":
1586 case "Pot":
1587 case "Cauldron":
1588 case "SharpWoodenStick":
1590 break;
1591 }
1592
1595 {
1597 }
1598 }
1599
1600 if (oldLoc.IsValid())
1602
1605 }
1606
1608 {
1611 }
1612
1614 {
1617
1618 return true;
1619 }
1620
1622 {
1624 {
1626 }
1627 }
1628
1631 {
1632 int foodStageType;
1633
1635 if (foodStage)
1636 foodStageType = foodStage.GetFoodStageType();
1637
1642
1643 return agentsIn;
1644 }
1645
1646
1648 {
1649 return false;
1650 }
1651
1653 {
1654 return false;
1655 }
1656
1658 {
1660 {
1662 {
1665
1668
1669 default:
1670 return super.GetTemperatureFreezeTime();
1671 }
1672 }
1673
1674 return super.GetTemperatureFreezeTime();
1675 }
1676
1678 {
1680 {
1682 {
1685
1688
1689 default:
1690 return super.GetTemperatureThawTime();
1691 }
1692 }
1693
1694 return super.GetTemperatureThawTime();
1695 }
1696
1698 {
1700 }
1701
1702
1703
1704
1706 {
1707 SetSynchDirty();
1708 }
1709
1711 {
1712 super.OnVariablesSynchronized();
1713
1714
1715
1716
1718 {
1720 }
1721 else
1722 {
1724 }
1725
1728 }
1729
1730
1731
1732
1734 {
1737
1739 }
1740
1742 {
1743 string soundName = "";
1744
1747
1749 {
1751 }
1752 else
1753 {
1755 {
1757 {
1762 else
1763 soundName = "";
1764 break;
1765 }
1766
1768 {
1773 else
1774 soundName = "";
1775 break;
1776 }
1777
1779 {
1784 else
1785 soundName = "";
1786 break;
1787 }
1788
1789 default:
1790 soundName = "";
1791 break;
1792 }
1793
1795 {
1796 if (soundName == "")
1797 {
1799 }
1800 else
1801 {
1803 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1804 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1806 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1807 {
1809 }
1810 }
1811 }
1812 }
1813
1815 }
1816
1818 {
1821 }
1822
1823
1824
1825
1827 {
1828 super.OnStoreSave(ctx);
1829
1831 {
1833 }
1834
1835
1838 }
1839
1841 {
1842 if (!super.OnStoreLoad(ctx, version))
1843 return false;
1844
1846 {
1848 return false;
1849 }
1850
1851 if (version >= 115)
1852 {
1854 {
1856 return false;
1857 }
1859 {
1861 return false;
1862 }
1863 }
1864
1867
1868 return true;
1869 }
1870
1872 {
1873 super.AfterStoreLoad();
1874
1876 }
1877
1878
1880 {
1882 }
1883
1884
1886 {
1887 return false;
1888 }
1889
1891 {
1892 return false;
1893 }
1894
1896 {
1897 return false;
1898 }
1899
1901 {
1902 return false;
1903 }
1904
1905
1906
1907
1908
1910 {
1913 {
1914 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1915 }
1916 else if (classname != "" && food_stage)
1917 {
1918 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1919 }
1920 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1921 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1922
1923 }
1924
1926 {
1929 {
1931 }
1932 else if (classname != "" && food_stage)
1933 {
1934 return FoodStage.GetEnergy(null, food_stage, classname);
1935 }
1936 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1937 return g_Game.ConfigGetFloat( class_path +
" energy" );
1938 }
1939
1941 {
1944 {
1946 }
1947 else if (classname != "" && food_stage)
1948 {
1949 return FoodStage.GetWater(null, food_stage, classname);
1950 }
1951 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1952 return g_Game.ConfigGetFloat( class_path +
" water" );
1953 }
1954
1956 {
1959 {
1960 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1961 }
1962 else if (classname != "" && food_stage)
1963 {
1964 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1965 }
1966 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1967 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1968
1969 }
1970
1972 {
1975 {
1976 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1977 }
1978 else if (classname != "" && food_stage)
1979 {
1980 return FoodStage.GetToxicity(null, food_stage, classname);
1981 }
1982 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1983 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1984 }
1985
1987 {
1990 {
1992 }
1993 else if (classname != "" && food_stage)
1994 {
1995 return FoodStage.GetAgents(null, food_stage, classname);
1996 }
1997 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1998 return g_Game.ConfigGetInt( class_path +
" agents" );
1999 }
2000
2002 {
2005 {
2006 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2007 }
2008 else if (classname != "" && food_stage)
2009 {
2010 return FoodStage.GetDigestibility(null, food_stage, classname);
2011 }
2012 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2013 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2014 }
2015
2017 {
2020 {
2021 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2022 }
2023 else if (className != "" && foodStage)
2024 {
2025 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2026 }
2027 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2028 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2029 }
2030
2032 {
2042
2043 return profile;
2044 }
2045
2046
2047
2048
2050 {
2052 }
2053
2054
2056 {
2058 {
2060 }
2061
2062 return false;
2063 }
2064
2066 {
2068 {
2070 }
2071
2072 return false;
2073 }
2074
2076 {
2078 {
2080 }
2081
2082 return false;
2083 }
2084
2086 {
2088 {
2090 }
2091
2092 return false;
2093 }
2094
2096 {
2098 {
2100 }
2101
2102 return false;
2103 }
2104
2106 {
2108 {
2110 }
2111
2112 return false;
2113 }
2114
2115
2117 {
2119 }
2120
2122 {
2123 return GetFoodStage().GetNextFoodStageType( cooking_method );
2124 }
2125
2127 {
2128 return GetFoodStage().GetFoodStageName( food_stage_type );
2129 }
2130
2132 {
2133 return GetFoodStage().CanChangeToNewStage( cooking_method );
2134 }
2135
2136
2138 {
2139 if ( !source.GetFoodStage())
2140 return;
2145 }
2146
2149 {
2152 }
2153
2156 {
2157 switch (stageNew)
2158 {
2163 break;
2164
2167 break;
2168 }
2169 }
2170
2171
2172
2173
2174
2176 {
2178 }
2179
2181 {
2183
2184
2186 }
2187
2189 {
2191 {
2194 }
2195 }
2196
2197
2199 {
2201 if (player)
2202 {
2204 player.ServerReplaceItemInHandsWithNew(lambda);
2205 }
2206 else
2207 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2208 }
2209
2211 {
2213 }
2214
2216 {
2217 super.SetActions();
2218
2221 }
2222
2224 {
2225 #ifndef SERVER
2226 #ifndef NO_GUI
2228 {
2230
2233 }
2234 #endif
2235 #endif
2236 }
2237
2239 {
2240 #ifndef SERVER
2241 #ifndef NO_GUI
2243 {
2247 }
2248 #endif
2249 #endif
2250 }
2251
2253 {
2254 return false;
2255 }
2256
2258 {
2260 }
2261
2262 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2263 {
2265
2266 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2268 if ( hasRootAsPlayer )
2270
2271
2272
2273
2274
2275
2276
2278 {
2279
2281 {
2283 {
2287 break;
2288
2292 break;
2293
2297 break;
2298
2302 default:
2305 return;
2306 }
2307
2308
2309 }
2310
2312
2314 {
2316 {
2317
2319 {
2321 }
2323 {
2326 {
2328 }
2329 else
2330 {
2332 {
2334 }
2335 else
2336 {
2338 }
2339 }
2340 }
2341 }
2342 }
2343
2344 }
2346 {
2347
2349 {
2351 {
2355 break;
2356
2360 break;
2361
2365 break;
2366
2370 break;
2371
2374 default:
2377 return;
2378 }
2379 }
2380
2382
2384 {
2386 {
2387
2389 {
2391 }
2392 }
2393 }
2394 }
2396 {
2397
2399 {
2401 {
2405 break;
2406
2409 default:
2412 return;
2413 }
2414 }
2415
2417
2419 {
2421 {
2422
2424 {
2426 }
2427 }
2428 }
2429 }
2430 else
2431 {
2432
2434
2436 {
2439
2440 }
2441 else
2442 {
2444 {
2447 }
2448 }
2449 }
2450 }
2451
2453 {
2454 if (
g_Game.IsHeadlessOrDedicatedServer())
2455 return;
2456
2458 {
2460 GetInventory().GetCurrentInventoryLocation(invLoc);
2462 {
2464 if (ptcMgr)
2465 {
2470 }
2471 }
2472 }
2474 {
2476 {
2479 return;
2480 }
2481
2483 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2485 {
2488 }
2489 }
2490 }
2491
2492 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2493 {
2495 {
2500 }
2501
2502 super.GetDebugActions(outputList);
2503 }
2504
2506 {
2507 super.OnAction(action_id, player, ctx);
2508
2510 {
2511 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2512 {
2514 if (food_stage_prev <= 0)
2515 {
2517 }
2519 return true;
2520 }
2521 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2522 {
2525 {
2527 }
2529 return true;
2530 }
2531
2532 }
2533
2534 #ifdef DIAG_DEVELOPER
2535 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2536 {
2537 PrintNutritionsData();
2538 return true;
2539 }
2540 #endif
2541
2542 return false;
2543 }
2544
2546 {
2547 string debug_output;
2548
2549 debug_output = super.GetDebugText();
2550
2553
2554 return debug_output;
2555 }
2556
2557
2558
2559
2560
2562 {
2563 float ret = super.GetBaitEffectivity();
2564
2566 {
2567 ret *= 0.5;
2568 }
2569
2570 return ret;
2571 }
2572
2574 {
2576 }
2577
2579 {
2581 }
2582
2584 {
2586 }
2587
2588 #ifdef DIAG_DEVELOPER
2589 private void PrintNutritionsData()
2590 {
2591 string nutritionsData = "";
2592
2595
2597 if (profile)
2598 {
2599 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2601 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2605 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2607
2610
2611 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2613 }
2614
2615 nutritionsData += "-----\n";
2616
2618 }
2619 #endif
2620
2622
2625 {
2627 }
2628}
2629
2631{
2633};
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.