1296{
1298
1306
1316
1318
1320 {
1322 {
1324
1326 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1327
1331 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1332 }
1333 }
1334
1336 {
1338
1340 }
1341
1343 {
1344 super.EEDelete(parent);
1345
1347
1350 }
1351
1353 {
1354 super.EEItemLocationChanged(oldLoc, newLoc);
1355
1358 {
1359 switch (oldLoc.GetParent().GetType())
1360 {
1361 case "FryingPan":
1362 case "Pot":
1363 case "Cauldron":
1364 case "SharpWoodenStick":
1366 break;
1367 }
1368
1371 {
1373 }
1374 }
1375
1376 if (oldLoc.IsValid())
1378
1381 }
1382
1384 {
1387 }
1388
1390 {
1393
1394 return true;
1395 }
1396
1398 {
1400 {
1402 }
1403 }
1404
1407 {
1408 int foodStageType;
1409
1411 if (foodStage)
1412 foodStageType = foodStage.GetFoodStageType();
1413
1418
1419 return agentsIn;
1420 }
1421
1422
1424 {
1425 return false;
1426 }
1427
1429 {
1430 return false;
1431 }
1432
1434 {
1436 {
1438 {
1441
1444
1445 default:
1446 return super.GetTemperatureFreezeTime();
1447 }
1448 }
1449
1450 return super.GetTemperatureFreezeTime();
1451 }
1452
1454 {
1456 {
1458 {
1461
1464
1465 default:
1466 return super.GetTemperatureThawTime();
1467 }
1468 }
1469
1470 return super.GetTemperatureThawTime();
1471 }
1472
1474 {
1476 }
1477
1478
1479
1480
1482 {
1483 SetSynchDirty();
1484 }
1485
1487 {
1488 super.OnVariablesSynchronized();
1489
1490
1491
1492
1494 {
1496 }
1497 else
1498 {
1500 }
1501
1504 }
1505
1506
1507
1508
1510 {
1513
1515 }
1516
1518 {
1519 string soundName = "";
1520
1523
1525 {
1527 }
1528 else
1529 {
1531 {
1533 {
1538 else
1539 soundName = "";
1540 break;
1541 }
1542
1544 {
1549 else
1550 soundName = "";
1551 break;
1552 }
1553
1555 {
1560 else
1561 soundName = "";
1562 break;
1563 }
1564
1565 default:
1566 soundName = "";
1567 break;
1568 }
1569
1571 {
1572 if (soundName == "")
1573 {
1575 }
1576 else
1577 {
1579 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1580 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1582 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1583 {
1585 }
1586 }
1587 }
1588 }
1589
1591 }
1592
1594 {
1597 }
1598
1599
1600
1601
1603 {
1604 super.OnStoreSave(ctx);
1605
1607 {
1609 }
1610
1611
1614 }
1615
1617 {
1618 if (!super.OnStoreLoad(ctx, version))
1619 return false;
1620
1622 {
1624 return false;
1625 }
1626
1627 if (version >= 115)
1628 {
1630 {
1632 return false;
1633 }
1635 {
1637 return false;
1638 }
1639 }
1640
1643
1644 return true;
1645 }
1646
1648 {
1649 super.AfterStoreLoad();
1650
1652 }
1653
1654
1656 {
1658 }
1659
1660
1662 {
1663 return false;
1664 }
1665
1667 {
1668 return false;
1669 }
1670
1672 {
1673 return false;
1674 }
1675
1677 {
1678 return false;
1679 }
1680
1681
1682
1683
1684
1686 {
1689 {
1690 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1691 }
1692 else if (classname != "" && food_stage)
1693 {
1694 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1695 }
1696 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1698
1699 }
1700
1702 {
1705 {
1707 }
1708 else if (classname != "" && food_stage)
1709 {
1710 return FoodStage.GetEnergy(null, food_stage, classname);
1711 }
1712 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1714 }
1715
1717 {
1720 {
1722 }
1723 else if (classname != "" && food_stage)
1724 {
1725 return FoodStage.GetWater(null, food_stage, classname);
1726 }
1727 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1729 }
1730
1732 {
1735 {
1736 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1737 }
1738 else if (classname != "" && food_stage)
1739 {
1740 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1741 }
1742 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1744
1745 }
1746
1748 {
1751 {
1752 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1753 }
1754 else if (classname != "" && food_stage)
1755 {
1756 return FoodStage.GetToxicity(null, food_stage, classname);
1757 }
1758 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1760 }
1761
1763 {
1766 {
1768 }
1769 else if (classname != "" && food_stage)
1770 {
1771 return FoodStage.GetAgents(null, food_stage, classname);
1772 }
1773 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1775 }
1776
1778 {
1781 {
1782 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1783 }
1784 else if (classname != "" && food_stage)
1785 {
1786 return FoodStage.GetDigestibility(null, food_stage, classname);
1787 }
1788 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1790 }
1791
1793 {
1796 {
1797 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1798 }
1799 else if (className != "" && foodStage)
1800 {
1801 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1802 }
1803 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1805 }
1806
1808 {
1818
1819 return profile;
1820 }
1821
1822
1823
1824
1826 {
1828 }
1829
1830
1832 {
1834 {
1836 }
1837
1838 return false;
1839 }
1840
1842 {
1844 {
1846 }
1847
1848 return false;
1849 }
1850
1852 {
1854 {
1856 }
1857
1858 return false;
1859 }
1860
1862 {
1864 {
1866 }
1867
1868 return false;
1869 }
1870
1872 {
1874 {
1876 }
1877
1878 return false;
1879 }
1880
1882 {
1884 {
1886 }
1887
1888 return false;
1889 }
1890
1891
1893 {
1895 }
1896
1898 {
1899 return GetFoodStage().GetNextFoodStageType( cooking_method );
1900 }
1901
1903 {
1904 return GetFoodStage().GetFoodStageName( food_stage_type );
1905 }
1906
1908 {
1909 return GetFoodStage().CanChangeToNewStage( cooking_method );
1910 }
1911
1912
1914 {
1915 if ( !source.GetFoodStage())
1916 return;
1921 }
1922
1925 {
1928 }
1929
1932 {
1933 switch (stageNew)
1934 {
1939 break;
1940
1943 break;
1944 }
1945 }
1946
1947
1948
1949
1950
1952 {
1954 }
1955
1957 {
1959
1960
1962 }
1963
1965 {
1967 {
1970 }
1971 }
1972
1973
1975 {
1977 if (player)
1978 {
1980 player.ServerReplaceItemInHandsWithNew(lambda);
1981 }
1982 else
1983 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1984 }
1985
1987 {
1989 }
1990
1992 {
1993 super.SetActions();
1994
1997 }
1998
2000 {
2001 #ifndef SERVER
2003 {
2005
2008 }
2009 #endif
2010 }
2011
2013 {
2014 #ifndef SERVER
2016 {
2020 }
2021 #endif
2022 }
2023
2025 {
2026 return false;
2027 }
2028
2030 {
2032 }
2033
2034 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2035 {
2037
2038 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2040 if ( hasRootAsPlayer )
2042
2043
2044
2045
2046
2047
2048
2050 {
2051
2053 {
2055 {
2059 break;
2060
2064 break;
2065
2069 break;
2070
2074 default:
2077 return;
2078 }
2079
2080
2081 }
2082
2084
2086 {
2088 {
2089
2091 {
2093 }
2095 {
2098 {
2100 }
2101 else
2102 {
2104 {
2106 }
2107 else
2108 {
2110 }
2111 }
2112 }
2113 }
2114 }
2115
2116 }
2118 {
2119
2121 {
2123 {
2127 break;
2128
2132 break;
2133
2137 break;
2138
2142 break;
2143
2146 default:
2149 return;
2150 }
2151 }
2152
2154
2156 {
2158 {
2159
2161 {
2163 }
2164 }
2165 }
2166 }
2168 {
2169
2171 {
2173 {
2177 break;
2178
2181 default:
2184 return;
2185 }
2186 }
2187
2189
2191 {
2193 {
2194
2196 {
2198 }
2199 }
2200 }
2201 }
2202 else
2203 {
2204
2206
2208 {
2211
2212 }
2213 else
2214 {
2216 {
2219 }
2220 }
2221 }
2222 }
2223
2225 {
2226 if (
GetGame().IsDedicatedServer())
2227 return;
2228
2230 {
2232 GetInventory().GetCurrentInventoryLocation(invLoc);
2234 {
2236 if (ptcMgr)
2237 {
2242 }
2243 }
2244 }
2246 {
2248 {
2251 return;
2252 }
2253
2255 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2257 {
2260 }
2261 }
2262 }
2263
2264 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2265 {
2267 {
2272 }
2273
2274 super.GetDebugActions(outputList);
2275 }
2276
2278 {
2279 super.OnAction(action_id, player, ctx);
2280
2282 {
2283 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2284 {
2286 if (food_stage_prev <= 0)
2287 {
2289 }
2291 return true;
2292 }
2293 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2294 {
2297 {
2299 }
2301 return true;
2302 }
2303
2304 }
2305
2306 #ifdef DIAG_DEVELOPER
2307 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2308 {
2309 PrintNutritionsData();
2310 return true;
2311 }
2312 #endif
2313
2314 return false;
2315 }
2316
2318 {
2319 string debug_output;
2320
2321 debug_output = super.GetDebugText();
2322
2325
2326 return debug_output;
2327 }
2328
2329
2330
2331
2332
2334 {
2335 float ret = super.GetBaitEffectivity();
2336
2338 {
2339 ret *= 0.5;
2340 }
2341
2342 return ret;
2343 }
2344
2346 {
2348 }
2349
2351 {
2353 }
2354
2356 {
2358 }
2359
2360 #ifdef DIAG_DEVELOPER
2361 private void PrintNutritionsData()
2362 {
2363 string nutritionsData = "";
2364
2367
2369 if (profile)
2370 {
2371 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2373 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2377 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2379
2382
2383 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2385 }
2386
2387 nutritionsData += "-----\n";
2388
2390 }
2391 #endif
2392
2394
2397 {
2399 }
2400}
2401
2403{
2405};
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 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.