1550{
1552
1560
1570
1572
1574 {
1576 {
1578
1580 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1581
1585 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1586 }
1587 }
1588
1590 {
1592
1594 }
1595
1597 {
1598 super.EEDelete(parent);
1599
1601
1604 }
1605
1607 {
1608 super.EEItemLocationChanged(oldLoc, newLoc);
1609
1612 {
1613 switch (oldLoc.GetParent().GetType())
1614 {
1615 case "FryingPan":
1616 case "Pot":
1617 case "Cauldron":
1618 case "SharpWoodenStick":
1620 break;
1621 }
1622
1625 {
1627 }
1628 }
1629
1630 if (oldLoc.IsValid())
1632
1635 }
1636
1638 {
1641 }
1642
1644 {
1647
1648 return true;
1649 }
1650
1652 {
1654 {
1656 }
1657 }
1658
1661 {
1662 int foodStageType;
1663
1665 if (foodStage)
1666 foodStageType = foodStage.GetFoodStageType();
1667
1672
1673 return agentsIn;
1674 }
1675
1676
1678 {
1679 return false;
1680 }
1681
1683 {
1684 return false;
1685 }
1686
1688 {
1690 {
1692 {
1695
1698
1699 default:
1700 return super.GetTemperatureFreezeTime();
1701 }
1702 }
1703
1704 return super.GetTemperatureFreezeTime();
1705 }
1706
1708 {
1710 {
1712 {
1715
1718
1719 default:
1720 return super.GetTemperatureThawTime();
1721 }
1722 }
1723
1724 return super.GetTemperatureThawTime();
1725 }
1726
1728 {
1730 }
1731
1732
1733
1734
1736 {
1737 SetSynchDirty();
1738 }
1739
1741 {
1742 super.OnVariablesSynchronized();
1743
1744
1745
1746
1748 {
1750 }
1751 else
1752 {
1754 }
1755
1758 }
1759
1760
1761
1762
1764 {
1767
1769 }
1770
1772 {
1773 string soundName = "";
1774
1777
1779 {
1781 }
1782 else
1783 {
1785 {
1787 {
1792 else
1793 soundName = "";
1794 break;
1795 }
1796
1798 {
1803 else
1804 soundName = "";
1805 break;
1806 }
1807
1809 {
1814 else
1815 soundName = "";
1816 break;
1817 }
1818
1819 default:
1820 soundName = "";
1821 break;
1822 }
1823
1825 {
1826 if (soundName == "")
1827 {
1829 }
1830 else
1831 {
1833 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1834 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1836 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1837 {
1839 }
1840 }
1841 }
1842 }
1843
1845 }
1846
1848 {
1851 }
1852
1853
1854
1855
1857 {
1858 super.OnStoreSave(ctx);
1859
1861 {
1863 }
1864
1865
1868 }
1869
1871 {
1872 if (!super.OnStoreLoad(ctx, version))
1873 return false;
1874
1876 {
1878 return false;
1879 }
1880
1881 if (version >= 115)
1882 {
1884 {
1886 return false;
1887 }
1889 {
1891 return false;
1892 }
1893 }
1894
1897
1898 return true;
1899 }
1900
1902 {
1903 super.AfterStoreLoad();
1904
1906 }
1907
1908
1910 {
1912 }
1913
1914
1916 {
1917 return false;
1918 }
1919
1921 {
1922 return false;
1923 }
1924
1926 {
1927 return false;
1928 }
1929
1931 {
1932 return false;
1933 }
1934
1935
1936
1937
1938
1940 {
1943 {
1944 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1945 }
1946 else if (classname != "" && food_stage)
1947 {
1948 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1949 }
1950 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1951 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1952
1953 }
1954
1956 {
1959 {
1961 }
1962 else if (classname != "" && food_stage)
1963 {
1964 return FoodStage.GetEnergy(null, food_stage, classname);
1965 }
1966 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1967 return g_Game.ConfigGetFloat( class_path +
" energy" );
1968 }
1969
1971 {
1974 {
1976 }
1977 else if (classname != "" && food_stage)
1978 {
1979 return FoodStage.GetWater(null, food_stage, classname);
1980 }
1981 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1982 return g_Game.ConfigGetFloat( class_path +
" water" );
1983 }
1984
1986 {
1989 {
1990 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1991 }
1992 else if (classname != "" && food_stage)
1993 {
1994 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1995 }
1996 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1997 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1998
1999 }
2000
2002 {
2005 {
2006 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2007 }
2008 else if (classname != "" && food_stage)
2009 {
2010 return FoodStage.GetToxicity(null, food_stage, classname);
2011 }
2012 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2013 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2014 }
2015
2017 {
2020 {
2022 }
2023 else if (classname != "" && food_stage)
2024 {
2025 return FoodStage.GetAgents(null, food_stage, classname);
2026 }
2027 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2028 return g_Game.ConfigGetInt( class_path +
" agents" );
2029 }
2030
2032 {
2035 {
2036 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2037 }
2038 else if (classname != "" && food_stage)
2039 {
2040 return FoodStage.GetDigestibility(null, food_stage, classname);
2041 }
2042 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2043 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2044 }
2045
2047 {
2050 {
2051 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2052 }
2053 else if (className != "" && foodStage)
2054 {
2055 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2056 }
2057 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2058 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2059 }
2060
2062 {
2072
2073 return profile;
2074 }
2075
2076
2077
2078
2080 {
2082 }
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
2116 {
2118 {
2120 }
2121
2122 return false;
2123 }
2124
2126 {
2128 {
2130 }
2131
2132 return false;
2133 }
2134
2136 {
2138 {
2140 }
2141
2142 return false;
2143 }
2144
2145
2147 {
2149 }
2150
2152 {
2153 return GetFoodStage().GetNextFoodStageType( cooking_method );
2154 }
2155
2157 {
2158 return GetFoodStage().GetFoodStageName( food_stage_type );
2159 }
2160
2162 {
2163 return GetFoodStage().CanChangeToNewStage( cooking_method );
2164 }
2165
2166
2168 {
2169 if ( !source.GetFoodStage())
2170 return;
2175 }
2176
2179 {
2182 }
2183
2186 {
2187 switch (stageNew)
2188 {
2193 break;
2194
2197 break;
2198 }
2199 }
2200
2201
2202
2203
2204
2206 {
2208 }
2209
2211 {
2213
2214
2216 }
2217
2219 {
2221 {
2224 }
2225 }
2226
2227
2229 {
2231 if (player)
2232 {
2234 player.ServerReplaceItemInHandsWithNew(lambda);
2235 }
2236 else
2237 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2238 }
2239
2241 {
2243 }
2244
2246 {
2247 super.SetActions();
2248
2251 }
2252
2254 {
2255 #ifndef SERVER
2256 #ifndef NO_GUI
2258 {
2260
2263 }
2264 #endif
2265 #endif
2266 }
2267
2269 {
2270 #ifndef SERVER
2271 #ifndef NO_GUI
2273 {
2277 }
2278 #endif
2279 #endif
2280 }
2281
2283 {
2284 return false;
2285 }
2286
2288 {
2290 }
2291
2292 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2293 {
2295
2296 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2298 if ( hasRootAsPlayer )
2300
2301
2302
2303
2304
2305
2306
2308 {
2309
2311 {
2313 {
2317 break;
2318
2322 break;
2323
2327 break;
2328
2332 default:
2335 return;
2336 }
2337
2338
2339 }
2340
2342
2344 {
2346 {
2347
2349 {
2351 }
2353 {
2356 {
2358 }
2359 else
2360 {
2362 {
2364 }
2365 else
2366 {
2368 }
2369 }
2370 }
2371 }
2372 }
2373
2374 }
2376 {
2377
2379 {
2381 {
2385 break;
2386
2390 break;
2391
2395 break;
2396
2400 break;
2401
2404 default:
2407 return;
2408 }
2409 }
2410
2412
2414 {
2416 {
2417
2419 {
2421 }
2422 }
2423 }
2424 }
2426 {
2427
2429 {
2431 {
2435 break;
2436
2439 default:
2442 return;
2443 }
2444 }
2445
2447
2449 {
2451 {
2452
2454 {
2456 }
2457 }
2458 }
2459 }
2460 else
2461 {
2462
2464
2466 {
2469
2470 }
2471 else
2472 {
2474 {
2477 }
2478 }
2479 }
2480 }
2481
2483 {
2484 if (
g_Game.IsHeadlessOrDedicatedServer())
2485 return;
2486
2488 {
2490 GetInventory().GetCurrentInventoryLocation(invLoc);
2492 {
2494 if (ptcMgr)
2495 {
2500 }
2501 }
2502 }
2504 {
2506 {
2509 return;
2510 }
2511
2513 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2515 {
2518 }
2519 }
2520 }
2521
2522 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2523 {
2525 {
2530 }
2531
2532 super.GetDebugActions(outputList);
2533 }
2534
2536 {
2537 super.OnAction(action_id, player, ctx);
2538
2540 {
2541 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2542 {
2544 if (food_stage_prev <= 0)
2545 {
2547 }
2549 return true;
2550 }
2551 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2552 {
2555 {
2557 }
2559 return true;
2560 }
2561
2562 }
2563
2564 #ifdef DIAG_DEVELOPER
2565 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2566 {
2567 PrintNutritionsData();
2568 return true;
2569 }
2570 #endif
2571
2572 return false;
2573 }
2574
2576 {
2577 string debug_output;
2578
2579 debug_output = super.GetDebugText();
2580
2583
2584 return debug_output;
2585 }
2586
2587
2588
2589
2590
2592 {
2593 float ret = super.GetBaitEffectivity();
2594
2596 {
2597 ret *= 0.5;
2598 }
2599
2600 return ret;
2601 }
2602
2604 {
2606 }
2607
2609 {
2611 }
2612
2614 {
2616 }
2617
2618 #ifdef DIAG_DEVELOPER
2619 private void PrintNutritionsData()
2620 {
2621 string nutritionsData = "";
2622
2625
2627 if (profile)
2628 {
2629 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2631 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2635 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2637
2640
2641 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2643 }
2644
2645 nutritionsData += "-----\n";
2646
2648 }
2649 #endif
2650
2652
2655 {
2657 }
2658}
2659
2661{
2663};
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.