1252{
1254
1262
1272
1274
1276 {
1278 {
1280
1282 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1283
1287 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1288 }
1289 }
1290
1292 {
1294
1296 }
1297
1299 {
1300 super.EEDelete(parent);
1301
1303
1306 }
1307
1309 {
1310 super.EEItemLocationChanged(oldLoc, newLoc);
1311
1314 {
1315 switch (oldLoc.GetParent().GetType())
1316 {
1317 case "FryingPan":
1318 case "Pot":
1319 case "Cauldron":
1320 case "SharpWoodenStick":
1322 break;
1323 }
1324
1327 {
1329 }
1330 }
1331
1332 if (oldLoc.IsValid())
1334
1337 }
1338
1340 {
1343 }
1344
1346 {
1349
1350 return true;
1351 }
1352
1354 {
1356 {
1358 }
1359 }
1360
1363 {
1364 int foodStageType;
1365
1367 if (foodStage)
1368 foodStageType = foodStage.GetFoodStageType();
1369
1374
1375 return agentsIn;
1376 }
1377
1378
1380 {
1381 return false;
1382 }
1383
1385 {
1386 return false;
1387 }
1388
1390 {
1392 {
1394 {
1397
1400
1401 default:
1402 return super.GetTemperatureFreezeTime();
1403 }
1404 }
1405
1406 return super.GetTemperatureFreezeTime();
1407 }
1408
1410 {
1412 {
1414 {
1417
1420
1421 default:
1422 return super.GetTemperatureThawTime();
1423 }
1424 }
1425
1426 return super.GetTemperatureThawTime();
1427 }
1428
1430 {
1432 }
1433
1434
1435
1436
1438 {
1439 SetSynchDirty();
1440 }
1441
1443 {
1444 super.OnVariablesSynchronized();
1445
1446
1447
1448
1450 {
1452 }
1453 else
1454 {
1456 }
1457
1460 }
1461
1462
1463
1464
1466 {
1469
1471 }
1472
1474 {
1475 string soundName = "";
1476
1479
1481 {
1483 }
1484 else
1485 {
1487 {
1489 {
1494 else
1495 soundName = "";
1496 break;
1497 }
1498
1500 {
1505 else
1506 soundName = "";
1507 break;
1508 }
1509
1511 {
1516 else
1517 soundName = "";
1518 break;
1519 }
1520
1521 default:
1522 soundName = "";
1523 break;
1524 }
1525
1527 {
1528 if (soundName == "")
1529 {
1531 }
1532 else
1533 {
1535 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1536 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1538 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1539 {
1541 }
1542 }
1543 }
1544 }
1545
1547 }
1548
1550 {
1553 }
1554
1555
1556
1557
1559 {
1560 super.OnStoreSave(ctx);
1561
1563 {
1565 }
1566
1567
1570 }
1571
1573 {
1574 if (!super.OnStoreLoad(ctx, version))
1575 return false;
1576
1578 {
1580 return false;
1581 }
1582
1583 if (version >= 115)
1584 {
1586 {
1588 return false;
1589 }
1591 {
1593 return false;
1594 }
1595 }
1596
1599
1600 return true;
1601 }
1602
1604 {
1605 super.AfterStoreLoad();
1606
1608 }
1609
1610
1612 {
1614 }
1615
1616
1618 {
1619 return false;
1620 }
1621
1623 {
1624 return false;
1625 }
1626
1628 {
1629 return false;
1630 }
1631
1633 {
1634 return false;
1635 }
1636
1637
1638
1639
1640
1642 {
1645 {
1646 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1647 }
1648 else if (classname != "" && food_stage)
1649 {
1650 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1651 }
1652 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1653 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1654
1655 }
1656
1658 {
1661 {
1663 }
1664 else if (classname != "" && food_stage)
1665 {
1666 return FoodStage.GetEnergy(null, food_stage, classname);
1667 }
1668 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1669 return g_Game.ConfigGetFloat( class_path +
" energy" );
1670 }
1671
1673 {
1676 {
1678 }
1679 else if (classname != "" && food_stage)
1680 {
1681 return FoodStage.GetWater(null, food_stage, classname);
1682 }
1683 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1684 return g_Game.ConfigGetFloat( class_path +
" water" );
1685 }
1686
1688 {
1691 {
1692 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1693 }
1694 else if (classname != "" && food_stage)
1695 {
1696 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1697 }
1698 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1699 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1700
1701 }
1702
1704 {
1707 {
1708 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1709 }
1710 else if (classname != "" && food_stage)
1711 {
1712 return FoodStage.GetToxicity(null, food_stage, classname);
1713 }
1714 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1715 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1716 }
1717
1719 {
1722 {
1724 }
1725 else if (classname != "" && food_stage)
1726 {
1727 return FoodStage.GetAgents(null, food_stage, classname);
1728 }
1729 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1730 return g_Game.ConfigGetInt( class_path +
" agents" );
1731 }
1732
1734 {
1737 {
1738 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1739 }
1740 else if (classname != "" && food_stage)
1741 {
1742 return FoodStage.GetDigestibility(null, food_stage, classname);
1743 }
1744 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1745 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1746 }
1747
1749 {
1752 {
1753 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1754 }
1755 else if (className != "" && foodStage)
1756 {
1757 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1758 }
1759 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1760 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1761 }
1762
1764 {
1774
1775 return profile;
1776 }
1777
1778
1779
1780
1782 {
1784 }
1785
1786
1788 {
1790 {
1792 }
1793
1794 return false;
1795 }
1796
1798 {
1800 {
1802 }
1803
1804 return false;
1805 }
1806
1808 {
1810 {
1812 }
1813
1814 return false;
1815 }
1816
1818 {
1820 {
1822 }
1823
1824 return false;
1825 }
1826
1828 {
1830 {
1832 }
1833
1834 return false;
1835 }
1836
1838 {
1840 {
1842 }
1843
1844 return false;
1845 }
1846
1847
1849 {
1851 }
1852
1854 {
1855 return GetFoodStage().GetNextFoodStageType( cooking_method );
1856 }
1857
1859 {
1860 return GetFoodStage().GetFoodStageName( food_stage_type );
1861 }
1862
1864 {
1865 return GetFoodStage().CanChangeToNewStage( cooking_method );
1866 }
1867
1868
1870 {
1871 if ( !source.GetFoodStage())
1872 return;
1877 }
1878
1881 {
1884 }
1885
1888 {
1889 switch (stageNew)
1890 {
1895 break;
1896
1899 break;
1900 }
1901 }
1902
1903
1904
1905
1906
1908 {
1910 }
1911
1913 {
1915
1916
1918 }
1919
1921 {
1923 {
1926 }
1927 }
1928
1929
1931 {
1933 if (player)
1934 {
1936 player.ServerReplaceItemInHandsWithNew(lambda);
1937 }
1938 else
1939 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1940 }
1941
1943 {
1945 }
1946
1948 {
1949 super.SetActions();
1950
1953 }
1954
1956 {
1957 #ifndef SERVER
1958 #ifndef NO_GUI
1960 {
1962
1965 }
1966 #endif
1967 #endif
1968 }
1969
1971 {
1972 #ifndef SERVER
1973 #ifndef NO_GUI
1975 {
1979 }
1980 #endif
1981 #endif
1982 }
1983
1985 {
1986 return false;
1987 }
1988
1990 {
1992 }
1993
1994 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1995 {
1997
1998 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2000 if ( hasRootAsPlayer )
2002
2003
2004
2005
2006
2007
2008
2010 {
2011
2013 {
2015 {
2019 break;
2020
2024 break;
2025
2029 break;
2030
2034 default:
2037 return;
2038 }
2039
2040
2041 }
2042
2044
2046 {
2048 {
2049
2051 {
2053 }
2055 {
2058 {
2060 }
2061 else
2062 {
2064 {
2066 }
2067 else
2068 {
2070 }
2071 }
2072 }
2073 }
2074 }
2075
2076 }
2078 {
2079
2081 {
2083 {
2087 break;
2088
2092 break;
2093
2097 break;
2098
2102 break;
2103
2106 default:
2109 return;
2110 }
2111 }
2112
2114
2116 {
2118 {
2119
2121 {
2123 }
2124 }
2125 }
2126 }
2128 {
2129
2131 {
2133 {
2137 break;
2138
2141 default:
2144 return;
2145 }
2146 }
2147
2149
2151 {
2153 {
2154
2156 {
2158 }
2159 }
2160 }
2161 }
2162 else
2163 {
2164
2166
2168 {
2171
2172 }
2173 else
2174 {
2176 {
2179 }
2180 }
2181 }
2182 }
2183
2185 {
2186 if (
g_Game.IsHeadlessOrDedicatedServer())
2187 return;
2188
2190 {
2192 GetInventory().GetCurrentInventoryLocation(invLoc);
2194 {
2196 if (ptcMgr)
2197 {
2202 }
2203 }
2204 }
2206 {
2208 {
2211 return;
2212 }
2213
2215 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2217 {
2220 }
2221 }
2222 }
2223
2224 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2225 {
2227 {
2232 }
2233
2234 super.GetDebugActions(outputList);
2235 }
2236
2238 {
2239 super.OnAction(action_id, player, ctx);
2240
2242 {
2243 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2244 {
2246 if (food_stage_prev <= 0)
2247 {
2249 }
2251 return true;
2252 }
2253 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2254 {
2257 {
2259 }
2261 return true;
2262 }
2263
2264 }
2265
2266 #ifdef DIAG_DEVELOPER
2267 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2268 {
2269 PrintNutritionsData();
2270 return true;
2271 }
2272 #endif
2273
2274 return false;
2275 }
2276
2278 {
2279 string debug_output;
2280
2281 debug_output = super.GetDebugText();
2282
2285
2286 return debug_output;
2287 }
2288
2289
2290
2291
2292
2294 {
2295 float ret = super.GetBaitEffectivity();
2296
2298 {
2299 ret *= 0.5;
2300 }
2301
2302 return ret;
2303 }
2304
2306 {
2308 }
2309
2311 {
2313 }
2314
2316 {
2318 }
2319
2320 #ifdef DIAG_DEVELOPER
2321 private void PrintNutritionsData()
2322 {
2323 string nutritionsData = "";
2324
2327
2329 if (profile)
2330 {
2331 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2333 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2337 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2339
2342
2343 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2345 }
2346
2347 nutritionsData += "-----\n";
2348
2350 }
2351 #endif
2352
2354
2357 {
2359 }
2360}
2361
2363{
2365};
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.