1331{
1333
1341
1351
1353
1355 {
1357 {
1359
1361 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1362
1366 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1367 }
1368 }
1369
1371 {
1373
1375 }
1376
1378 {
1379 super.EEDelete(parent);
1380
1382
1385 }
1386
1388 {
1389 super.EEItemLocationChanged(oldLoc, newLoc);
1390
1393 {
1394 switch (oldLoc.GetParent().GetType())
1395 {
1396 case "FryingPan":
1397 case "Pot":
1398 case "Cauldron":
1399 case "SharpWoodenStick":
1401 break;
1402 }
1403
1406 {
1408 }
1409 }
1410
1411 if (oldLoc.IsValid())
1413
1416 }
1417
1419 {
1422 }
1423
1425 {
1428
1429 return true;
1430 }
1431
1433 {
1435 {
1437 }
1438 }
1439
1442 {
1443 int foodStageType;
1444
1446 if (foodStage)
1447 foodStageType = foodStage.GetFoodStageType();
1448
1453
1454 return agentsIn;
1455 }
1456
1457
1459 {
1460 return false;
1461 }
1462
1464 {
1465 return false;
1466 }
1467
1469 {
1471 {
1473 {
1476
1479
1480 default:
1481 return super.GetTemperatureFreezeTime();
1482 }
1483 }
1484
1485 return super.GetTemperatureFreezeTime();
1486 }
1487
1489 {
1491 {
1493 {
1496
1499
1500 default:
1501 return super.GetTemperatureThawTime();
1502 }
1503 }
1504
1505 return super.GetTemperatureThawTime();
1506 }
1507
1509 {
1511 }
1512
1513
1514
1515
1517 {
1518 SetSynchDirty();
1519 }
1520
1522 {
1523 super.OnVariablesSynchronized();
1524
1525
1526
1527
1529 {
1531 }
1532 else
1533 {
1535 }
1536
1539 }
1540
1541
1542
1543
1545 {
1548
1550 }
1551
1553 {
1554 string soundName = "";
1555
1558
1560 {
1562 }
1563 else
1564 {
1566 {
1568 {
1573 else
1574 soundName = "";
1575 break;
1576 }
1577
1579 {
1584 else
1585 soundName = "";
1586 break;
1587 }
1588
1590 {
1595 else
1596 soundName = "";
1597 break;
1598 }
1599
1600 default:
1601 soundName = "";
1602 break;
1603 }
1604
1606 {
1607 if (soundName == "")
1608 {
1610 }
1611 else
1612 {
1614 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1615 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1617 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1618 {
1620 }
1621 }
1622 }
1623 }
1624
1626 }
1627
1629 {
1632 }
1633
1634
1635
1636
1638 {
1639 super.OnStoreSave(ctx);
1640
1642 {
1644 }
1645
1646
1649 }
1650
1652 {
1653 if (!super.OnStoreLoad(ctx, version))
1654 return false;
1655
1657 {
1659 return false;
1660 }
1661
1662 if (version >= 115)
1663 {
1665 {
1667 return false;
1668 }
1670 {
1672 return false;
1673 }
1674 }
1675
1678
1679 return true;
1680 }
1681
1683 {
1684 super.AfterStoreLoad();
1685
1687 }
1688
1689
1691 {
1693 }
1694
1695
1697 {
1698 return false;
1699 }
1700
1702 {
1703 return false;
1704 }
1705
1707 {
1708 return false;
1709 }
1710
1712 {
1713 return false;
1714 }
1715
1716
1717
1718
1719
1721 {
1724 {
1725 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1726 }
1727 else if (classname != "" && food_stage)
1728 {
1729 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1730 }
1731 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1733
1734 }
1735
1737 {
1740 {
1742 }
1743 else if (classname != "" && food_stage)
1744 {
1745 return FoodStage.GetEnergy(null, food_stage, classname);
1746 }
1747 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1749 }
1750
1752 {
1755 {
1757 }
1758 else if (classname != "" && food_stage)
1759 {
1760 return FoodStage.GetWater(null, food_stage, classname);
1761 }
1762 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1764 }
1765
1767 {
1770 {
1771 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1772 }
1773 else if (classname != "" && food_stage)
1774 {
1775 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1776 }
1777 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1779
1780 }
1781
1783 {
1786 {
1787 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1788 }
1789 else if (classname != "" && food_stage)
1790 {
1791 return FoodStage.GetToxicity(null, food_stage, classname);
1792 }
1793 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1795 }
1796
1798 {
1801 {
1803 }
1804 else if (classname != "" && food_stage)
1805 {
1806 return FoodStage.GetAgents(null, food_stage, classname);
1807 }
1808 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1810 }
1811
1813 {
1816 {
1817 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1818 }
1819 else if (classname != "" && food_stage)
1820 {
1821 return FoodStage.GetDigestibility(null, food_stage, classname);
1822 }
1823 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1825 }
1826
1828 {
1831 {
1832 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1833 }
1834 else if (className != "" && foodStage)
1835 {
1836 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1837 }
1838 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1840 }
1841
1843 {
1853
1854 return profile;
1855 }
1856
1857
1858
1859
1861 {
1863 }
1864
1865
1867 {
1869 {
1871 }
1872
1873 return false;
1874 }
1875
1877 {
1879 {
1881 }
1882
1883 return false;
1884 }
1885
1887 {
1889 {
1891 }
1892
1893 return false;
1894 }
1895
1897 {
1899 {
1901 }
1902
1903 return false;
1904 }
1905
1907 {
1909 {
1911 }
1912
1913 return false;
1914 }
1915
1917 {
1919 {
1921 }
1922
1923 return false;
1924 }
1925
1926
1928 {
1930 }
1931
1933 {
1934 return GetFoodStage().GetNextFoodStageType( cooking_method );
1935 }
1936
1938 {
1939 return GetFoodStage().GetFoodStageName( food_stage_type );
1940 }
1941
1943 {
1944 return GetFoodStage().CanChangeToNewStage( cooking_method );
1945 }
1946
1947
1949 {
1950 if ( !source.GetFoodStage())
1951 return;
1956 }
1957
1960 {
1963 }
1964
1967 {
1968 switch (stageNew)
1969 {
1974 break;
1975
1978 break;
1979 }
1980 }
1981
1982
1983
1984
1985
1987 {
1989 }
1990
1992 {
1994
1995
1997 }
1998
2000 {
2002 {
2005 }
2006 }
2007
2008
2010 {
2012 if (player)
2013 {
2015 player.ServerReplaceItemInHandsWithNew(lambda);
2016 }
2017 else
2018 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2019 }
2020
2022 {
2024 }
2025
2027 {
2028 super.SetActions();
2029
2032 }
2033
2035 {
2036 #ifndef SERVER
2038 {
2040
2043 }
2044 #endif
2045 }
2046
2048 {
2049 #ifndef SERVER
2051 {
2055 }
2056 #endif
2057 }
2058
2060 {
2061 return false;
2062 }
2063
2065 {
2067 }
2068
2069 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2070 {
2072
2073 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2075 if ( hasRootAsPlayer )
2077
2078
2079
2080
2081
2082
2083
2085 {
2086
2088 {
2090 {
2094 break;
2095
2099 break;
2100
2104 break;
2105
2109 default:
2112 return;
2113 }
2114
2115
2116 }
2117
2119
2121 {
2123 {
2124
2126 {
2128 }
2130 {
2133 {
2135 }
2136 else
2137 {
2139 {
2141 }
2142 else
2143 {
2145 }
2146 }
2147 }
2148 }
2149 }
2150
2151 }
2153 {
2154
2156 {
2158 {
2162 break;
2163
2167 break;
2168
2172 break;
2173
2177 break;
2178
2181 default:
2184 return;
2185 }
2186 }
2187
2189
2191 {
2193 {
2194
2196 {
2198 }
2199 }
2200 }
2201 }
2203 {
2204
2206 {
2208 {
2212 break;
2213
2216 default:
2219 return;
2220 }
2221 }
2222
2224
2226 {
2228 {
2229
2231 {
2233 }
2234 }
2235 }
2236 }
2237 else
2238 {
2239
2241
2243 {
2246
2247 }
2248 else
2249 {
2251 {
2254 }
2255 }
2256 }
2257 }
2258
2260 {
2261 if (
GetGame().IsDedicatedServer())
2262 return;
2263
2265 {
2267 GetInventory().GetCurrentInventoryLocation(invLoc);
2269 {
2271 if (ptcMgr)
2272 {
2277 }
2278 }
2279 }
2281 {
2283 {
2286 return;
2287 }
2288
2290 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2292 {
2295 }
2296 }
2297 }
2298
2299 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2300 {
2301 super.GetDebugActions(outputList);
2302
2304 {
2308 }
2309 }
2310
2312 {
2313 super.OnAction(action_id, player, ctx);
2314
2316 {
2317 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2318 {
2320 if (food_stage_prev <= 0)
2321 {
2323 }
2325 return true;
2326 }
2327 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2328 {
2331 {
2333 }
2335 return true;
2336 }
2337
2338 }
2339
2340 #ifdef DIAG_DEVELOPER
2341 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2342 {
2343 PrintNutritionsData();
2344 return true;
2345 }
2346 #endif
2347
2348 return false;
2349 }
2350
2352 {
2353 string debug_output;
2354
2355 debug_output = super.GetDebugText();
2356
2359
2360 return debug_output;
2361 }
2362
2363
2364
2365
2366
2368 {
2369 float ret = super.GetBaitEffectivity();
2370
2372 {
2373 ret *= 0.5;
2374 }
2375
2376 return ret;
2377 }
2378
2380 {
2382 }
2383
2385 {
2387 }
2388
2390 {
2392 }
2393
2394 #ifdef DIAG_DEVELOPER
2395 private void PrintNutritionsData()
2396 {
2397 string nutritionsData = "";
2398
2401
2403 if (profile)
2404 {
2405 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2407 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2411 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2413
2416
2417 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2419 }
2420
2421 nutritionsData += "-----\n";
2422
2424 }
2425 #endif
2426
2428
2431 {
2433 }
2434}
2435
2437{
2439};
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
AttachActionData ActionData ActionAttach()
void AddAction(typename actionName)
DamageType
exposed from C++ (do not change)
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 InsertAgent(int agent, float count=1)
override void RemoveAllAgentsExcept(int agent_to_keep)
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.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native int ConfigGetInt(string path)
Get int value from config on path.
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
proto native CGame GetGame()
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
class JsonUndergroundAreaTriggerData GetPosition
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.