1435{
1437
1445
1455
1457
1459 {
1461 {
1463
1465 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1466
1470 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1471 }
1472 }
1473
1475 {
1477
1479 }
1480
1482 {
1483 super.EEDelete(parent);
1484
1486
1489 }
1490
1492 {
1493 super.EEItemLocationChanged(oldLoc, newLoc);
1494
1497 {
1498 switch (oldLoc.GetParent().GetType())
1499 {
1500 case "FryingPan":
1501 case "Pot":
1502 case "Cauldron":
1503 case "SharpWoodenStick":
1505 break;
1506 }
1507
1510 {
1512 }
1513 }
1514
1515 if (oldLoc.IsValid())
1517
1520 }
1521
1523 {
1526 }
1527
1529 {
1532
1533 return true;
1534 }
1535
1537 {
1539 {
1541 }
1542 }
1543
1546 {
1547 int foodStageType;
1548
1550 if (foodStage)
1551 foodStageType = foodStage.GetFoodStageType();
1552
1557
1558 return agentsIn;
1559 }
1560
1561
1563 {
1564 return false;
1565 }
1566
1568 {
1569 return false;
1570 }
1571
1573 {
1575 {
1577 {
1580
1583
1584 default:
1585 return super.GetTemperatureFreezeTime();
1586 }
1587 }
1588
1589 return super.GetTemperatureFreezeTime();
1590 }
1591
1593 {
1595 {
1597 {
1600
1603
1604 default:
1605 return super.GetTemperatureThawTime();
1606 }
1607 }
1608
1609 return super.GetTemperatureThawTime();
1610 }
1611
1613 {
1615 }
1616
1617
1618
1619
1621 {
1622 SetSynchDirty();
1623 }
1624
1626 {
1627 super.OnVariablesSynchronized();
1628
1629
1630
1631
1633 {
1635 }
1636 else
1637 {
1639 }
1640
1643 }
1644
1645
1646
1647
1649 {
1652
1654 }
1655
1657 {
1658 string soundName = "";
1659
1662
1664 {
1666 }
1667 else
1668 {
1670 {
1672 {
1677 else
1678 soundName = "";
1679 break;
1680 }
1681
1683 {
1688 else
1689 soundName = "";
1690 break;
1691 }
1692
1694 {
1699 else
1700 soundName = "";
1701 break;
1702 }
1703
1704 default:
1705 soundName = "";
1706 break;
1707 }
1708
1710 {
1711 if (soundName == "")
1712 {
1714 }
1715 else
1716 {
1718 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1719 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1721 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1722 {
1724 }
1725 }
1726 }
1727 }
1728
1730 }
1731
1733 {
1736 }
1737
1738
1739
1740
1742 {
1743 super.OnStoreSave(ctx);
1744
1746 {
1748 }
1749
1750
1753 }
1754
1756 {
1757 if (!super.OnStoreLoad(ctx, version))
1758 return false;
1759
1761 {
1763 return false;
1764 }
1765
1766 if (version >= 115)
1767 {
1769 {
1771 return false;
1772 }
1774 {
1776 return false;
1777 }
1778 }
1779
1782
1783 return true;
1784 }
1785
1787 {
1788 super.AfterStoreLoad();
1789
1791 }
1792
1793
1795 {
1797 }
1798
1799
1801 {
1802 return false;
1803 }
1804
1806 {
1807 return false;
1808 }
1809
1811 {
1812 return false;
1813 }
1814
1816 {
1817 return false;
1818 }
1819
1820
1821
1822
1823
1825 {
1828 {
1829 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1830 }
1831 else if (classname != "" && food_stage)
1832 {
1833 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1834 }
1835 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1836 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1837
1838 }
1839
1841 {
1844 {
1846 }
1847 else if (classname != "" && food_stage)
1848 {
1849 return FoodStage.GetEnergy(null, food_stage, classname);
1850 }
1851 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1852 return g_Game.ConfigGetFloat( class_path +
" energy" );
1853 }
1854
1856 {
1859 {
1861 }
1862 else if (classname != "" && food_stage)
1863 {
1864 return FoodStage.GetWater(null, food_stage, classname);
1865 }
1866 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1867 return g_Game.ConfigGetFloat( class_path +
" water" );
1868 }
1869
1871 {
1874 {
1875 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1876 }
1877 else if (classname != "" && food_stage)
1878 {
1879 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1880 }
1881 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1882 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1883
1884 }
1885
1887 {
1890 {
1891 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1892 }
1893 else if (classname != "" && food_stage)
1894 {
1895 return FoodStage.GetToxicity(null, food_stage, classname);
1896 }
1897 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1898 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1899 }
1900
1902 {
1905 {
1907 }
1908 else if (classname != "" && food_stage)
1909 {
1910 return FoodStage.GetAgents(null, food_stage, classname);
1911 }
1912 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1913 return g_Game.ConfigGetInt( class_path +
" agents" );
1914 }
1915
1917 {
1920 {
1921 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1922 }
1923 else if (classname != "" && food_stage)
1924 {
1925 return FoodStage.GetDigestibility(null, food_stage, classname);
1926 }
1927 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1928 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1929 }
1930
1932 {
1935 {
1936 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1937 }
1938 else if (className != "" && foodStage)
1939 {
1940 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1941 }
1942 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1943 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1944 }
1945
1947 {
1957
1958 return profile;
1959 }
1960
1961
1962
1963
1965 {
1967 }
1968
1969
1971 {
1973 {
1975 }
1976
1977 return false;
1978 }
1979
1981 {
1983 {
1985 }
1986
1987 return false;
1988 }
1989
1991 {
1993 {
1995 }
1996
1997 return false;
1998 }
1999
2001 {
2003 {
2005 }
2006
2007 return false;
2008 }
2009
2011 {
2013 {
2015 }
2016
2017 return false;
2018 }
2019
2021 {
2023 {
2025 }
2026
2027 return false;
2028 }
2029
2030
2032 {
2034 }
2035
2037 {
2038 return GetFoodStage().GetNextFoodStageType( cooking_method );
2039 }
2040
2042 {
2043 return GetFoodStage().GetFoodStageName( food_stage_type );
2044 }
2045
2047 {
2048 return GetFoodStage().CanChangeToNewStage( cooking_method );
2049 }
2050
2051
2053 {
2054 if ( !source.GetFoodStage())
2055 return;
2060 }
2061
2064 {
2067 }
2068
2071 {
2072 switch (stageNew)
2073 {
2078 break;
2079
2082 break;
2083 }
2084 }
2085
2086
2087
2088
2089
2091 {
2093 }
2094
2096 {
2098
2099
2101 }
2102
2104 {
2106 {
2109 }
2110 }
2111
2112
2114 {
2116 if (player)
2117 {
2119 player.ServerReplaceItemInHandsWithNew(lambda);
2120 }
2121 else
2122 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2123 }
2124
2126 {
2128 }
2129
2131 {
2132 super.SetActions();
2133
2136 }
2137
2139 {
2140 #ifndef SERVER
2141 #ifndef NO_GUI
2143 {
2145
2148 }
2149 #endif
2150 #endif
2151 }
2152
2154 {
2155 #ifndef SERVER
2156 #ifndef NO_GUI
2158 {
2162 }
2163 #endif
2164 #endif
2165 }
2166
2168 {
2169 return false;
2170 }
2171
2173 {
2175 }
2176
2177 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2178 {
2180
2181 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2183 if ( hasRootAsPlayer )
2185
2186
2187
2188
2189
2190
2191
2193 {
2194
2196 {
2198 {
2202 break;
2203
2207 break;
2208
2212 break;
2213
2217 default:
2220 return;
2221 }
2222
2223
2224 }
2225
2227
2229 {
2231 {
2232
2234 {
2236 }
2238 {
2241 {
2243 }
2244 else
2245 {
2247 {
2249 }
2250 else
2251 {
2253 }
2254 }
2255 }
2256 }
2257 }
2258
2259 }
2261 {
2262
2264 {
2266 {
2270 break;
2271
2275 break;
2276
2280 break;
2281
2285 break;
2286
2289 default:
2292 return;
2293 }
2294 }
2295
2297
2299 {
2301 {
2302
2304 {
2306 }
2307 }
2308 }
2309 }
2311 {
2312
2314 {
2316 {
2320 break;
2321
2324 default:
2327 return;
2328 }
2329 }
2330
2332
2334 {
2336 {
2337
2339 {
2341 }
2342 }
2343 }
2344 }
2345 else
2346 {
2347
2349
2351 {
2354
2355 }
2356 else
2357 {
2359 {
2362 }
2363 }
2364 }
2365 }
2366
2368 {
2369 if (
g_Game.IsHeadlessOrDedicatedServer())
2370 return;
2371
2373 {
2375 GetInventory().GetCurrentInventoryLocation(invLoc);
2377 {
2379 if (ptcMgr)
2380 {
2385 }
2386 }
2387 }
2389 {
2391 {
2394 return;
2395 }
2396
2398 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2400 {
2403 }
2404 }
2405 }
2406
2407 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2408 {
2410 {
2415 }
2416
2417 super.GetDebugActions(outputList);
2418 }
2419
2421 {
2422 super.OnAction(action_id, player, ctx);
2423
2425 {
2426 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2427 {
2429 if (food_stage_prev <= 0)
2430 {
2432 }
2434 return true;
2435 }
2436 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2437 {
2440 {
2442 }
2444 return true;
2445 }
2446
2447 }
2448
2449 #ifdef DIAG_DEVELOPER
2450 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2451 {
2452 PrintNutritionsData();
2453 return true;
2454 }
2455 #endif
2456
2457 return false;
2458 }
2459
2461 {
2462 string debug_output;
2463
2464 debug_output = super.GetDebugText();
2465
2468
2469 return debug_output;
2470 }
2471
2472
2473
2474
2475
2477 {
2478 float ret = super.GetBaitEffectivity();
2479
2481 {
2482 ret *= 0.5;
2483 }
2484
2485 return ret;
2486 }
2487
2489 {
2491 }
2492
2494 {
2496 }
2497
2499 {
2501 }
2502
2503 #ifdef DIAG_DEVELOPER
2504 private void PrintNutritionsData()
2505 {
2506 string nutritionsData = "";
2507
2510
2512 if (profile)
2513 {
2514 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2516 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2520 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2522
2525
2526 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2528 }
2529
2530 nutritionsData += "-----\n";
2531
2533 }
2534 #endif
2535
2537
2540 {
2542 }
2543}
2544
2546{
2548};
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.