1474{
1476
1484
1494
1496
1498 {
1500 {
1502
1504 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1505
1509 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1510 }
1511 }
1512
1514 {
1516
1518 }
1519
1521 {
1522 super.EEDelete(parent);
1523
1525
1528 }
1529
1531 {
1532 super.EEItemLocationChanged(oldLoc, newLoc);
1533
1536 {
1537 switch (oldLoc.GetParent().GetType())
1538 {
1539 case "FryingPan":
1540 case "Pot":
1541 case "Cauldron":
1542 case "SharpWoodenStick":
1544 break;
1545 }
1546
1549 {
1551 }
1552 }
1553
1554 if (oldLoc.IsValid())
1556
1559 }
1560
1562 {
1565 }
1566
1568 {
1571
1572 return true;
1573 }
1574
1576 {
1578 {
1580 }
1581 }
1582
1585 {
1586 int foodStageType;
1587
1589 if (foodStage)
1590 foodStageType = foodStage.GetFoodStageType();
1591
1596
1597 return agentsIn;
1598 }
1599
1600
1602 {
1603 return false;
1604 }
1605
1607 {
1608 return false;
1609 }
1610
1612 {
1614 {
1616 {
1619
1622
1623 default:
1624 return super.GetTemperatureFreezeTime();
1625 }
1626 }
1627
1628 return super.GetTemperatureFreezeTime();
1629 }
1630
1632 {
1634 {
1636 {
1639
1642
1643 default:
1644 return super.GetTemperatureThawTime();
1645 }
1646 }
1647
1648 return super.GetTemperatureThawTime();
1649 }
1650
1652 {
1654 }
1655
1656
1657
1658
1660 {
1661 SetSynchDirty();
1662 }
1663
1665 {
1666 super.OnVariablesSynchronized();
1667
1668
1669
1670
1672 {
1674 }
1675 else
1676 {
1678 }
1679
1682 }
1683
1684
1685
1686
1688 {
1691
1693 }
1694
1696 {
1697 string soundName = "";
1698
1701
1703 {
1705 }
1706 else
1707 {
1709 {
1711 {
1716 else
1717 soundName = "";
1718 break;
1719 }
1720
1722 {
1727 else
1728 soundName = "";
1729 break;
1730 }
1731
1733 {
1738 else
1739 soundName = "";
1740 break;
1741 }
1742
1743 default:
1744 soundName = "";
1745 break;
1746 }
1747
1749 {
1750 if (soundName == "")
1751 {
1753 }
1754 else
1755 {
1757 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1758 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1760 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1761 {
1763 }
1764 }
1765 }
1766 }
1767
1769 }
1770
1772 {
1775 }
1776
1777
1778
1779
1781 {
1782 super.OnStoreSave(ctx);
1783
1785 {
1787 }
1788
1789
1792 }
1793
1795 {
1796 if (!super.OnStoreLoad(ctx, version))
1797 return false;
1798
1800 {
1802 return false;
1803 }
1804
1805 if (version >= 115)
1806 {
1808 {
1810 return false;
1811 }
1813 {
1815 return false;
1816 }
1817 }
1818
1821
1822 return true;
1823 }
1824
1826 {
1827 super.AfterStoreLoad();
1828
1830 }
1831
1832
1834 {
1836 }
1837
1838
1840 {
1841 return false;
1842 }
1843
1845 {
1846 return false;
1847 }
1848
1850 {
1851 return false;
1852 }
1853
1855 {
1856 return false;
1857 }
1858
1859
1860
1861
1862
1864 {
1867 {
1868 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1869 }
1870 else if (classname != "" && food_stage)
1871 {
1872 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1873 }
1874 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1875 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1876
1877 }
1878
1880 {
1883 {
1885 }
1886 else if (classname != "" && food_stage)
1887 {
1888 return FoodStage.GetEnergy(null, food_stage, classname);
1889 }
1890 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1891 return g_Game.ConfigGetFloat( class_path +
" energy" );
1892 }
1893
1895 {
1898 {
1900 }
1901 else if (classname != "" && food_stage)
1902 {
1903 return FoodStage.GetWater(null, food_stage, classname);
1904 }
1905 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1906 return g_Game.ConfigGetFloat( class_path +
" water" );
1907 }
1908
1910 {
1913 {
1914 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1915 }
1916 else if (classname != "" && food_stage)
1917 {
1918 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1919 }
1920 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1921 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1922
1923 }
1924
1926 {
1929 {
1930 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1931 }
1932 else if (classname != "" && food_stage)
1933 {
1934 return FoodStage.GetToxicity(null, food_stage, classname);
1935 }
1936 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1937 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1938 }
1939
1941 {
1944 {
1946 }
1947 else if (classname != "" && food_stage)
1948 {
1949 return FoodStage.GetAgents(null, food_stage, classname);
1950 }
1951 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1952 return g_Game.ConfigGetInt( class_path +
" agents" );
1953 }
1954
1956 {
1959 {
1960 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1961 }
1962 else if (classname != "" && food_stage)
1963 {
1964 return FoodStage.GetDigestibility(null, food_stage, classname);
1965 }
1966 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1967 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1968 }
1969
1971 {
1974 {
1975 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1976 }
1977 else if (className != "" && foodStage)
1978 {
1979 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1980 }
1981 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1982 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1983 }
1984
1986 {
1996
1997 return profile;
1998 }
1999
2000
2001
2002
2004 {
2006 }
2007
2008
2010 {
2012 {
2014 }
2015
2016 return false;
2017 }
2018
2020 {
2022 {
2024 }
2025
2026 return false;
2027 }
2028
2030 {
2032 {
2034 }
2035
2036 return false;
2037 }
2038
2040 {
2042 {
2044 }
2045
2046 return false;
2047 }
2048
2050 {
2052 {
2054 }
2055
2056 return false;
2057 }
2058
2060 {
2062 {
2064 }
2065
2066 return false;
2067 }
2068
2069
2071 {
2073 }
2074
2076 {
2077 return GetFoodStage().GetNextFoodStageType( cooking_method );
2078 }
2079
2081 {
2082 return GetFoodStage().GetFoodStageName( food_stage_type );
2083 }
2084
2086 {
2087 return GetFoodStage().CanChangeToNewStage( cooking_method );
2088 }
2089
2090
2092 {
2093 if ( !source.GetFoodStage())
2094 return;
2099 }
2100
2103 {
2106 }
2107
2110 {
2111 switch (stageNew)
2112 {
2117 break;
2118
2121 break;
2122 }
2123 }
2124
2125
2126
2127
2128
2130 {
2132 }
2133
2135 {
2137
2138
2140 }
2141
2143 {
2145 {
2148 }
2149 }
2150
2151
2153 {
2155 if (player)
2156 {
2158 player.ServerReplaceItemInHandsWithNew(lambda);
2159 }
2160 else
2161 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2162 }
2163
2165 {
2167 }
2168
2170 {
2171 super.SetActions();
2172
2175 }
2176
2178 {
2179 #ifndef SERVER
2180 #ifndef NO_GUI
2182 {
2184
2187 }
2188 #endif
2189 #endif
2190 }
2191
2193 {
2194 #ifndef SERVER
2195 #ifndef NO_GUI
2197 {
2201 }
2202 #endif
2203 #endif
2204 }
2205
2207 {
2208 return false;
2209 }
2210
2212 {
2214 }
2215
2216 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2217 {
2219
2220 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2222 if ( hasRootAsPlayer )
2224
2225
2226
2227
2228
2229
2230
2232 {
2233
2235 {
2237 {
2241 break;
2242
2246 break;
2247
2251 break;
2252
2256 default:
2259 return;
2260 }
2261
2262
2263 }
2264
2266
2268 {
2270 {
2271
2273 {
2275 }
2277 {
2280 {
2282 }
2283 else
2284 {
2286 {
2288 }
2289 else
2290 {
2292 }
2293 }
2294 }
2295 }
2296 }
2297
2298 }
2300 {
2301
2303 {
2305 {
2309 break;
2310
2314 break;
2315
2319 break;
2320
2324 break;
2325
2328 default:
2331 return;
2332 }
2333 }
2334
2336
2338 {
2340 {
2341
2343 {
2345 }
2346 }
2347 }
2348 }
2350 {
2351
2353 {
2355 {
2359 break;
2360
2363 default:
2366 return;
2367 }
2368 }
2369
2371
2373 {
2375 {
2376
2378 {
2380 }
2381 }
2382 }
2383 }
2384 else
2385 {
2386
2388
2390 {
2393
2394 }
2395 else
2396 {
2398 {
2401 }
2402 }
2403 }
2404 }
2405
2407 {
2408 if (
g_Game.IsHeadlessOrDedicatedServer())
2409 return;
2410
2412 {
2414 GetInventory().GetCurrentInventoryLocation(invLoc);
2416 {
2418 if (ptcMgr)
2419 {
2424 }
2425 }
2426 }
2428 {
2430 {
2433 return;
2434 }
2435
2437 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2439 {
2442 }
2443 }
2444 }
2445
2446 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2447 {
2449 {
2454 }
2455
2456 super.GetDebugActions(outputList);
2457 }
2458
2460 {
2461 super.OnAction(action_id, player, ctx);
2462
2464 {
2465 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2466 {
2468 if (food_stage_prev <= 0)
2469 {
2471 }
2473 return true;
2474 }
2475 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2476 {
2479 {
2481 }
2483 return true;
2484 }
2485
2486 }
2487
2488 #ifdef DIAG_DEVELOPER
2489 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2490 {
2491 PrintNutritionsData();
2492 return true;
2493 }
2494 #endif
2495
2496 return false;
2497 }
2498
2500 {
2501 string debug_output;
2502
2503 debug_output = super.GetDebugText();
2504
2507
2508 return debug_output;
2509 }
2510
2511
2512
2513
2514
2516 {
2517 float ret = super.GetBaitEffectivity();
2518
2520 {
2521 ret *= 0.5;
2522 }
2523
2524 return ret;
2525 }
2526
2528 {
2530 }
2531
2533 {
2535 }
2536
2538 {
2540 }
2541
2542 #ifdef DIAG_DEVELOPER
2543 private void PrintNutritionsData()
2544 {
2545 string nutritionsData = "";
2546
2549
2551 if (profile)
2552 {
2553 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2555 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2559 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2561
2564
2565 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2567 }
2568
2569 nutritionsData += "-----\n";
2570
2572 }
2573 #endif
2574
2576
2579 {
2581 }
2582}
2583
2585{
2587};
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.