1495{
1497
1505
1515
1517
1519 {
1521 {
1523
1525 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1526
1530 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1531 }
1532 }
1533
1535 {
1537
1539 }
1540
1542 {
1543 super.EEDelete(parent);
1544
1546
1549 }
1550
1552 {
1553 super.EEItemLocationChanged(oldLoc, newLoc);
1554
1557 {
1558 switch (oldLoc.GetParent().GetType())
1559 {
1560 case "FryingPan":
1561 case "Pot":
1562 case "Cauldron":
1563 case "SharpWoodenStick":
1565 break;
1566 }
1567
1570 {
1572 }
1573 }
1574
1575 if (oldLoc.IsValid())
1577
1580 }
1581
1583 {
1586 }
1587
1589 {
1592
1593 return true;
1594 }
1595
1597 {
1599 {
1601 }
1602 }
1603
1606 {
1607 int foodStageType;
1608
1610 if (foodStage)
1611 foodStageType = foodStage.GetFoodStageType();
1612
1617
1618 return agentsIn;
1619 }
1620
1621
1623 {
1624 return false;
1625 }
1626
1628 {
1629 return false;
1630 }
1631
1633 {
1635 {
1637 {
1640
1643
1644 default:
1645 return super.GetTemperatureFreezeTime();
1646 }
1647 }
1648
1649 return super.GetTemperatureFreezeTime();
1650 }
1651
1653 {
1655 {
1657 {
1660
1663
1664 default:
1665 return super.GetTemperatureThawTime();
1666 }
1667 }
1668
1669 return super.GetTemperatureThawTime();
1670 }
1671
1673 {
1675 }
1676
1677
1678
1679
1681 {
1682 SetSynchDirty();
1683 }
1684
1686 {
1687 super.OnVariablesSynchronized();
1688
1689
1690
1691
1693 {
1695 }
1696 else
1697 {
1699 }
1700
1703 }
1704
1705
1706
1707
1709 {
1712
1714 }
1715
1717 {
1718 string soundName = "";
1719
1722
1724 {
1726 }
1727 else
1728 {
1730 {
1732 {
1737 else
1738 soundName = "";
1739 break;
1740 }
1741
1743 {
1748 else
1749 soundName = "";
1750 break;
1751 }
1752
1754 {
1759 else
1760 soundName = "";
1761 break;
1762 }
1763
1764 default:
1765 soundName = "";
1766 break;
1767 }
1768
1770 {
1771 if (soundName == "")
1772 {
1774 }
1775 else
1776 {
1778 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1779 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1781 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1782 {
1784 }
1785 }
1786 }
1787 }
1788
1790 }
1791
1793 {
1796 }
1797
1798
1799
1800
1802 {
1803 super.OnStoreSave(ctx);
1804
1806 {
1808 }
1809
1810
1813 }
1814
1816 {
1817 if (!super.OnStoreLoad(ctx, version))
1818 return false;
1819
1821 {
1823 return false;
1824 }
1825
1826 if (version >= 115)
1827 {
1829 {
1831 return false;
1832 }
1834 {
1836 return false;
1837 }
1838 }
1839
1842
1843 return true;
1844 }
1845
1847 {
1848 super.AfterStoreLoad();
1849
1851 }
1852
1853
1855 {
1857 }
1858
1859
1861 {
1862 return false;
1863 }
1864
1866 {
1867 return false;
1868 }
1869
1871 {
1872 return false;
1873 }
1874
1876 {
1877 return false;
1878 }
1879
1880
1881
1882
1883
1885 {
1888 {
1889 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1890 }
1891 else if (classname != "" && food_stage)
1892 {
1893 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1894 }
1895 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1896 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1897
1898 }
1899
1901 {
1904 {
1906 }
1907 else if (classname != "" && food_stage)
1908 {
1909 return FoodStage.GetEnergy(null, food_stage, classname);
1910 }
1911 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1912 return g_Game.ConfigGetFloat( class_path +
" energy" );
1913 }
1914
1916 {
1919 {
1921 }
1922 else if (classname != "" && food_stage)
1923 {
1924 return FoodStage.GetWater(null, food_stage, classname);
1925 }
1926 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1927 return g_Game.ConfigGetFloat( class_path +
" water" );
1928 }
1929
1931 {
1934 {
1935 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1936 }
1937 else if (classname != "" && food_stage)
1938 {
1939 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1940 }
1941 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1942 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1943
1944 }
1945
1947 {
1950 {
1951 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1952 }
1953 else if (classname != "" && food_stage)
1954 {
1955 return FoodStage.GetToxicity(null, food_stage, classname);
1956 }
1957 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1958 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1959 }
1960
1962 {
1965 {
1967 }
1968 else if (classname != "" && food_stage)
1969 {
1970 return FoodStage.GetAgents(null, food_stage, classname);
1971 }
1972 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1973 return g_Game.ConfigGetInt( class_path +
" agents" );
1974 }
1975
1977 {
1980 {
1981 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1982 }
1983 else if (classname != "" && food_stage)
1984 {
1985 return FoodStage.GetDigestibility(null, food_stage, classname);
1986 }
1987 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1988 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1989 }
1990
1992 {
1995 {
1996 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1997 }
1998 else if (className != "" && foodStage)
1999 {
2000 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2001 }
2002 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2003 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2004 }
2005
2007 {
2017
2018 return profile;
2019 }
2020
2021
2022
2023
2025 {
2027 }
2028
2029
2031 {
2033 {
2035 }
2036
2037 return false;
2038 }
2039
2041 {
2043 {
2045 }
2046
2047 return false;
2048 }
2049
2051 {
2053 {
2055 }
2056
2057 return false;
2058 }
2059
2061 {
2063 {
2065 }
2066
2067 return false;
2068 }
2069
2071 {
2073 {
2075 }
2076
2077 return false;
2078 }
2079
2081 {
2083 {
2085 }
2086
2087 return false;
2088 }
2089
2090
2092 {
2094 }
2095
2097 {
2098 return GetFoodStage().GetNextFoodStageType( cooking_method );
2099 }
2100
2102 {
2103 return GetFoodStage().GetFoodStageName( food_stage_type );
2104 }
2105
2107 {
2108 return GetFoodStage().CanChangeToNewStage( cooking_method );
2109 }
2110
2111
2113 {
2114 if ( !source.GetFoodStage())
2115 return;
2120 }
2121
2124 {
2127 }
2128
2131 {
2132 switch (stageNew)
2133 {
2138 break;
2139
2142 break;
2143 }
2144 }
2145
2146
2147
2148
2149
2151 {
2153 }
2154
2156 {
2158
2159
2161 }
2162
2164 {
2166 {
2169 }
2170 }
2171
2172
2174 {
2176 if (player)
2177 {
2179 player.ServerReplaceItemInHandsWithNew(lambda);
2180 }
2181 else
2182 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2183 }
2184
2186 {
2188 }
2189
2191 {
2192 super.SetActions();
2193
2196 }
2197
2199 {
2200 #ifndef SERVER
2201 #ifndef NO_GUI
2203 {
2205
2208 }
2209 #endif
2210 #endif
2211 }
2212
2214 {
2215 #ifndef SERVER
2216 #ifndef NO_GUI
2218 {
2222 }
2223 #endif
2224 #endif
2225 }
2226
2228 {
2229 return false;
2230 }
2231
2233 {
2235 }
2236
2237 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2238 {
2240
2241 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2243 if ( hasRootAsPlayer )
2245
2246
2247
2248
2249
2250
2251
2253 {
2254
2256 {
2258 {
2262 break;
2263
2267 break;
2268
2272 break;
2273
2277 default:
2280 return;
2281 }
2282
2283
2284 }
2285
2287
2289 {
2291 {
2292
2294 {
2296 }
2298 {
2301 {
2303 }
2304 else
2305 {
2307 {
2309 }
2310 else
2311 {
2313 }
2314 }
2315 }
2316 }
2317 }
2318
2319 }
2321 {
2322
2324 {
2326 {
2330 break;
2331
2335 break;
2336
2340 break;
2341
2345 break;
2346
2349 default:
2352 return;
2353 }
2354 }
2355
2357
2359 {
2361 {
2362
2364 {
2366 }
2367 }
2368 }
2369 }
2371 {
2372
2374 {
2376 {
2380 break;
2381
2384 default:
2387 return;
2388 }
2389 }
2390
2392
2394 {
2396 {
2397
2399 {
2401 }
2402 }
2403 }
2404 }
2405 else
2406 {
2407
2409
2411 {
2414
2415 }
2416 else
2417 {
2419 {
2422 }
2423 }
2424 }
2425 }
2426
2428 {
2429 if (
g_Game.IsHeadlessOrDedicatedServer())
2430 return;
2431
2433 {
2435 GetInventory().GetCurrentInventoryLocation(invLoc);
2437 {
2439 if (ptcMgr)
2440 {
2445 }
2446 }
2447 }
2449 {
2451 {
2454 return;
2455 }
2456
2458 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2460 {
2463 }
2464 }
2465 }
2466
2467 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2468 {
2470 {
2475 }
2476
2477 super.GetDebugActions(outputList);
2478 }
2479
2481 {
2482 super.OnAction(action_id, player, ctx);
2483
2485 {
2486 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2487 {
2489 if (food_stage_prev <= 0)
2490 {
2492 }
2494 return true;
2495 }
2496 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2497 {
2500 {
2502 }
2504 return true;
2505 }
2506
2507 }
2508
2509 #ifdef DIAG_DEVELOPER
2510 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2511 {
2512 PrintNutritionsData();
2513 return true;
2514 }
2515 #endif
2516
2517 return false;
2518 }
2519
2521 {
2522 string debug_output;
2523
2524 debug_output = super.GetDebugText();
2525
2528
2529 return debug_output;
2530 }
2531
2532
2533
2534
2535
2537 {
2538 float ret = super.GetBaitEffectivity();
2539
2541 {
2542 ret *= 0.5;
2543 }
2544
2545 return ret;
2546 }
2547
2549 {
2551 }
2552
2554 {
2556 }
2557
2559 {
2561 }
2562
2563 #ifdef DIAG_DEVELOPER
2564 private void PrintNutritionsData()
2565 {
2566 string nutritionsData = "";
2567
2570
2572 if (profile)
2573 {
2574 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2576 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2580 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2582
2585
2586 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2588 }
2589
2590 nutritionsData += "-----\n";
2591
2593 }
2594 #endif
2595
2597
2600 {
2602 }
2603}
2604
2606{
2608};
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.