1323{
1325
1333
1343
1345
1347 {
1349 {
1351
1353 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1354
1358 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1359 }
1360 }
1361
1363 {
1365
1367 }
1368
1370 {
1371 super.EEDelete(parent);
1372
1374
1377 }
1378
1380 {
1381 super.EEItemLocationChanged(oldLoc, newLoc);
1382
1385 {
1386 switch (oldLoc.GetParent().GetType())
1387 {
1388 case "FryingPan":
1389 case "Pot":
1390 case "Cauldron":
1391 case "SharpWoodenStick":
1393 break;
1394 }
1395
1398 {
1400 }
1401 }
1402
1403 if (oldLoc.IsValid())
1405
1408 }
1409
1411 {
1414 }
1415
1417 {
1420
1421 return true;
1422 }
1423
1425 {
1427 {
1429 }
1430 }
1431
1434 {
1435 int foodStageType;
1436
1438 if (foodStage)
1439 foodStageType = foodStage.GetFoodStageType();
1440
1445
1446 return agentsIn;
1447 }
1448
1449
1451 {
1452 return false;
1453 }
1454
1456 {
1457 return false;
1458 }
1459
1461 {
1463 {
1465 {
1468
1471
1472 default:
1473 return super.GetTemperatureFreezeTime();
1474 }
1475 }
1476
1477 return super.GetTemperatureFreezeTime();
1478 }
1479
1481 {
1483 {
1485 {
1488
1491
1492 default:
1493 return super.GetTemperatureThawTime();
1494 }
1495 }
1496
1497 return super.GetTemperatureThawTime();
1498 }
1499
1501 {
1503 }
1504
1505
1506
1507
1509 {
1510 SetSynchDirty();
1511 }
1512
1514 {
1515 super.OnVariablesSynchronized();
1516
1517
1518
1519
1521 {
1523 }
1524 else
1525 {
1527 }
1528
1531 }
1532
1533
1534
1535
1537 {
1540
1542 }
1543
1545 {
1546 string soundName = "";
1547
1550
1552 {
1554 }
1555 else
1556 {
1558 {
1560 {
1565 else
1566 soundName = "";
1567 break;
1568 }
1569
1571 {
1576 else
1577 soundName = "";
1578 break;
1579 }
1580
1582 {
1587 else
1588 soundName = "";
1589 break;
1590 }
1591
1592 default:
1593 soundName = "";
1594 break;
1595 }
1596
1598 {
1599 if (soundName == "")
1600 {
1602 }
1603 else
1604 {
1606 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1607 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1609 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1610 {
1612 }
1613 }
1614 }
1615 }
1616
1618 }
1619
1621 {
1624 }
1625
1626
1627
1628
1630 {
1631 super.OnStoreSave(ctx);
1632
1634 {
1636 }
1637
1638
1641 }
1642
1644 {
1645 if (!super.OnStoreLoad(ctx, version))
1646 return false;
1647
1649 {
1651 return false;
1652 }
1653
1654 if (version >= 115)
1655 {
1657 {
1659 return false;
1660 }
1662 {
1664 return false;
1665 }
1666 }
1667
1670
1671 return true;
1672 }
1673
1675 {
1676 super.AfterStoreLoad();
1677
1679 }
1680
1681
1683 {
1685 }
1686
1687
1689 {
1690 return false;
1691 }
1692
1694 {
1695 return false;
1696 }
1697
1699 {
1700 return false;
1701 }
1702
1704 {
1705 return false;
1706 }
1707
1708
1709
1710
1711
1713 {
1716 {
1717 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1718 }
1719 else if (classname != "" && food_stage)
1720 {
1721 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1722 }
1723 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1725
1726 }
1727
1729 {
1732 {
1734 }
1735 else if (classname != "" && food_stage)
1736 {
1737 return FoodStage.GetEnergy(null, food_stage, classname);
1738 }
1739 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1741 }
1742
1744 {
1747 {
1749 }
1750 else if (classname != "" && food_stage)
1751 {
1752 return FoodStage.GetWater(null, food_stage, classname);
1753 }
1754 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1756 }
1757
1759 {
1762 {
1763 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1764 }
1765 else if (classname != "" && food_stage)
1766 {
1767 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1768 }
1769 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1771
1772 }
1773
1775 {
1778 {
1779 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1780 }
1781 else if (classname != "" && food_stage)
1782 {
1783 return FoodStage.GetToxicity(null, food_stage, classname);
1784 }
1785 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1787 }
1788
1790 {
1793 {
1795 }
1796 else if (classname != "" && food_stage)
1797 {
1798 return FoodStage.GetAgents(null, food_stage, classname);
1799 }
1800 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1802 }
1803
1805 {
1808 {
1809 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1810 }
1811 else if (classname != "" && food_stage)
1812 {
1813 return FoodStage.GetDigestibility(null, food_stage, classname);
1814 }
1815 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1817 }
1818
1820 {
1823 {
1824 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1825 }
1826 else if (className != "" && foodStage)
1827 {
1828 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1829 }
1830 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1832 }
1833
1835 {
1845
1846 return profile;
1847 }
1848
1849
1850
1851
1853 {
1855 }
1856
1857
1859 {
1861 {
1863 }
1864
1865 return false;
1866 }
1867
1869 {
1871 {
1873 }
1874
1875 return false;
1876 }
1877
1879 {
1881 {
1883 }
1884
1885 return false;
1886 }
1887
1889 {
1891 {
1893 }
1894
1895 return false;
1896 }
1897
1899 {
1901 {
1903 }
1904
1905 return false;
1906 }
1907
1909 {
1911 {
1913 }
1914
1915 return false;
1916 }
1917
1918
1920 {
1922 }
1923
1925 {
1926 return GetFoodStage().GetNextFoodStageType( cooking_method );
1927 }
1928
1930 {
1931 return GetFoodStage().GetFoodStageName( food_stage_type );
1932 }
1933
1935 {
1936 return GetFoodStage().CanChangeToNewStage( cooking_method );
1937 }
1938
1939
1941 {
1942 if ( !source.GetFoodStage())
1943 return;
1948 }
1949
1952 {
1955 }
1956
1959 {
1960 switch (stageNew)
1961 {
1966 break;
1967
1970 break;
1971 }
1972 }
1973
1974
1975
1976
1977
1979 {
1981 }
1982
1984 {
1986
1987
1989 }
1990
1992 {
1994 {
1997 }
1998 }
1999
2000
2002 {
2004 if (player)
2005 {
2007 player.ServerReplaceItemInHandsWithNew(lambda);
2008 }
2009 else
2010 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2011 }
2012
2014 {
2016 }
2017
2019 {
2020 super.SetActions();
2021
2024 }
2025
2027 {
2028 #ifndef SERVER
2030 {
2032
2035 }
2036 #endif
2037 }
2038
2040 {
2041 #ifndef SERVER
2043 {
2047 }
2048 #endif
2049 }
2050
2052 {
2053 return false;
2054 }
2055
2057 {
2059 }
2060
2061 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2062 {
2064
2065 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2067 if ( hasRootAsPlayer )
2069
2070
2071
2072
2073
2074
2075
2077 {
2078
2080 {
2082 {
2086 break;
2087
2091 break;
2092
2096 break;
2097
2101 default:
2104 return;
2105 }
2106
2107
2108 }
2109
2111
2113 {
2115 {
2116
2118 {
2120 }
2122 {
2125 {
2127 }
2128 else
2129 {
2131 {
2133 }
2134 else
2135 {
2137 }
2138 }
2139 }
2140 }
2141 }
2142
2143 }
2145 {
2146
2148 {
2150 {
2154 break;
2155
2159 break;
2160
2164 break;
2165
2169 break;
2170
2173 default:
2176 return;
2177 }
2178 }
2179
2181
2183 {
2185 {
2186
2188 {
2190 }
2191 }
2192 }
2193 }
2195 {
2196
2198 {
2200 {
2204 break;
2205
2208 default:
2211 return;
2212 }
2213 }
2214
2216
2218 {
2220 {
2221
2223 {
2225 }
2226 }
2227 }
2228 }
2229 else
2230 {
2231
2233
2235 {
2238
2239 }
2240 else
2241 {
2243 {
2246 }
2247 }
2248 }
2249 }
2250
2252 {
2253 if (
GetGame().IsDedicatedServer())
2254 return;
2255
2257 {
2259 GetInventory().GetCurrentInventoryLocation(invLoc);
2261 {
2263 if (ptcMgr)
2264 {
2269 }
2270 }
2271 }
2273 {
2275 {
2278 return;
2279 }
2280
2282 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2284 {
2287 }
2288 }
2289 }
2290
2291 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2292 {
2293 super.GetDebugActions(outputList);
2294
2296 {
2300 }
2301 }
2302
2304 {
2305 super.OnAction(action_id, player, ctx);
2306
2308 {
2309 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2310 {
2312 if (food_stage_prev <= 0)
2313 {
2315 }
2317 return true;
2318 }
2319 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2320 {
2323 {
2325 }
2327 return true;
2328 }
2329
2330 }
2331
2332 #ifdef DIAG_DEVELOPER
2333 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2334 {
2335 PrintNutritionsData();
2336 return true;
2337 }
2338 #endif
2339
2340 return false;
2341 }
2342
2344 {
2345 string debug_output;
2346
2347 debug_output = super.GetDebugText();
2348
2351
2352 return debug_output;
2353 }
2354
2355
2356
2357
2358
2360 {
2361 float ret = super.GetBaitEffectivity();
2362
2364 {
2365 ret *= 0.5;
2366 }
2367
2368 return ret;
2369 }
2370
2372 {
2374 }
2375
2377 {
2379 }
2380
2382 {
2384 }
2385
2386 #ifdef DIAG_DEVELOPER
2387 private void PrintNutritionsData()
2388 {
2389 string nutritionsData = "";
2390
2393
2395 if (profile)
2396 {
2397 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2399 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2403 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2405
2408
2409 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2411 }
2412
2413 nutritionsData += "-----\n";
2414
2416 }
2417 #endif
2418
2420
2423 {
2425 }
2426}
2427
2429{
2431};
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.