1208{
1210
1218
1228
1230
1232 {
1234 {
1236
1238 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1239
1243 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1244 }
1245 }
1246
1248 {
1250
1252 }
1253
1255 {
1256 super.EEDelete(parent);
1257
1259
1262 }
1263
1265 {
1266 super.EEItemLocationChanged(oldLoc, newLoc);
1267
1270 {
1271 switch (oldLoc.GetParent().GetType())
1272 {
1273 case "FryingPan":
1274 case "Pot":
1275 case "Cauldron":
1276 case "SharpWoodenStick":
1278 break;
1279 }
1280
1283 {
1285 }
1286 }
1287
1288 if (oldLoc.IsValid())
1290
1293 }
1294
1296 {
1299 }
1300
1302 {
1305
1306 return true;
1307 }
1308
1310 {
1312 {
1314 }
1315 }
1316
1319 {
1320 int foodStageType;
1321
1323 if (foodStage)
1324 foodStageType = foodStage.GetFoodStageType();
1325
1330
1331 return agentsIn;
1332 }
1333
1334
1336 {
1337 return false;
1338 }
1339
1341 {
1342 return false;
1343 }
1344
1346 {
1348 {
1350 {
1353
1356
1357 default:
1358 return super.GetTemperatureFreezeTime();
1359 }
1360 }
1361
1362 return super.GetTemperatureFreezeTime();
1363 }
1364
1366 {
1368 {
1370 {
1373
1376
1377 default:
1378 return super.GetTemperatureThawTime();
1379 }
1380 }
1381
1382 return super.GetTemperatureThawTime();
1383 }
1384
1386 {
1388 }
1389
1390
1391
1392
1394 {
1395 SetSynchDirty();
1396 }
1397
1399 {
1400 super.OnVariablesSynchronized();
1401
1402
1403
1404
1406 {
1408 }
1409 else
1410 {
1412 }
1413
1416 }
1417
1418
1419
1420
1422 {
1425
1427 }
1428
1430 {
1431 string soundName = "";
1432
1435
1437 {
1439 }
1440 else
1441 {
1443 {
1445 {
1450 else
1451 soundName = "";
1452 break;
1453 }
1454
1456 {
1461 else
1462 soundName = "";
1463 break;
1464 }
1465
1467 {
1472 else
1473 soundName = "";
1474 break;
1475 }
1476
1477 default:
1478 soundName = "";
1479 break;
1480 }
1481
1483 {
1484 if (soundName == "")
1485 {
1487 }
1488 else
1489 {
1491 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1492 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1494 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1495 {
1497 }
1498 }
1499 }
1500 }
1501
1503 }
1504
1506 {
1509 }
1510
1511
1512
1513
1515 {
1516 super.OnStoreSave(ctx);
1517
1519 {
1521 }
1522
1523
1526 }
1527
1529 {
1530 if (!super.OnStoreLoad(ctx, version))
1531 return false;
1532
1534 {
1536 return false;
1537 }
1538
1539 if (version >= 115)
1540 {
1542 {
1544 return false;
1545 }
1547 {
1549 return false;
1550 }
1551 }
1552
1555
1556 return true;
1557 }
1558
1560 {
1561 super.AfterStoreLoad();
1562
1564 }
1565
1566
1568 {
1570 }
1571
1572
1574 {
1575 return false;
1576 }
1577
1579 {
1580 return false;
1581 }
1582
1584 {
1585 return false;
1586 }
1587
1589 {
1590 return false;
1591 }
1592
1593
1594
1595
1596
1598 {
1601 {
1602 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1603 }
1604 else if (classname != "" && food_stage)
1605 {
1606 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1607 }
1608 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1609 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1610
1611 }
1612
1614 {
1617 {
1619 }
1620 else if (classname != "" && food_stage)
1621 {
1622 return FoodStage.GetEnergy(null, food_stage, classname);
1623 }
1624 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1625 return g_Game.ConfigGetFloat( class_path +
" energy" );
1626 }
1627
1629 {
1632 {
1634 }
1635 else if (classname != "" && food_stage)
1636 {
1637 return FoodStage.GetWater(null, food_stage, classname);
1638 }
1639 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1640 return g_Game.ConfigGetFloat( class_path +
" water" );
1641 }
1642
1644 {
1647 {
1648 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1649 }
1650 else if (classname != "" && food_stage)
1651 {
1652 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1653 }
1654 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1655 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1656
1657 }
1658
1660 {
1663 {
1664 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1665 }
1666 else if (classname != "" && food_stage)
1667 {
1668 return FoodStage.GetToxicity(null, food_stage, classname);
1669 }
1670 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1671 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1672 }
1673
1675 {
1678 {
1680 }
1681 else if (classname != "" && food_stage)
1682 {
1683 return FoodStage.GetAgents(null, food_stage, classname);
1684 }
1685 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1686 return g_Game.ConfigGetInt( class_path +
" agents" );
1687 }
1688
1690 {
1693 {
1694 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1695 }
1696 else if (classname != "" && food_stage)
1697 {
1698 return FoodStage.GetDigestibility(null, food_stage, classname);
1699 }
1700 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1701 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1702 }
1703
1705 {
1708 {
1709 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1710 }
1711 else if (className != "" && foodStage)
1712 {
1713 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1714 }
1715 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1716 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1717 }
1718
1720 {
1730
1731 return profile;
1732 }
1733
1734
1735
1736
1738 {
1740 }
1741
1742
1744 {
1746 {
1748 }
1749
1750 return false;
1751 }
1752
1754 {
1756 {
1758 }
1759
1760 return false;
1761 }
1762
1764 {
1766 {
1768 }
1769
1770 return false;
1771 }
1772
1774 {
1776 {
1778 }
1779
1780 return false;
1781 }
1782
1784 {
1786 {
1788 }
1789
1790 return false;
1791 }
1792
1794 {
1796 {
1798 }
1799
1800 return false;
1801 }
1802
1803
1805 {
1807 }
1808
1810 {
1811 return GetFoodStage().GetNextFoodStageType( cooking_method );
1812 }
1813
1815 {
1816 return GetFoodStage().GetFoodStageName( food_stage_type );
1817 }
1818
1820 {
1821 return GetFoodStage().CanChangeToNewStage( cooking_method );
1822 }
1823
1824
1826 {
1827 if ( !source.GetFoodStage())
1828 return;
1833 }
1834
1837 {
1840 }
1841
1844 {
1845 switch (stageNew)
1846 {
1851 break;
1852
1855 break;
1856 }
1857 }
1858
1859
1860
1861
1862
1864 {
1866 }
1867
1869 {
1871
1872
1874 }
1875
1877 {
1879 {
1882 }
1883 }
1884
1885
1887 {
1889 if (player)
1890 {
1892 player.ServerReplaceItemInHandsWithNew(lambda);
1893 }
1894 else
1895 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1896 }
1897
1899 {
1901 }
1902
1904 {
1905 super.SetActions();
1906
1909 }
1910
1912 {
1913 #ifndef SERVER
1914 #ifndef NO_GUI
1916 {
1918
1921 }
1922 #endif
1923 #endif
1924 }
1925
1927 {
1928 #ifndef SERVER
1929 #ifndef NO_GUI
1931 {
1935 }
1936 #endif
1937 #endif
1938 }
1939
1941 {
1942 return false;
1943 }
1944
1946 {
1948 }
1949
1950 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
1951 {
1953
1954 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
1956 if ( hasRootAsPlayer )
1958
1959
1960
1961
1962
1963
1964
1966 {
1967
1969 {
1971 {
1975 break;
1976
1980 break;
1981
1985 break;
1986
1990 default:
1993 return;
1994 }
1995
1996
1997 }
1998
2000
2002 {
2004 {
2005
2007 {
2009 }
2011 {
2014 {
2016 }
2017 else
2018 {
2020 {
2022 }
2023 else
2024 {
2026 }
2027 }
2028 }
2029 }
2030 }
2031
2032 }
2034 {
2035
2037 {
2039 {
2043 break;
2044
2048 break;
2049
2053 break;
2054
2058 break;
2059
2062 default:
2065 return;
2066 }
2067 }
2068
2070
2072 {
2074 {
2075
2077 {
2079 }
2080 }
2081 }
2082 }
2084 {
2085
2087 {
2089 {
2093 break;
2094
2097 default:
2100 return;
2101 }
2102 }
2103
2105
2107 {
2109 {
2110
2112 {
2114 }
2115 }
2116 }
2117 }
2118 else
2119 {
2120
2122
2124 {
2127
2128 }
2129 else
2130 {
2132 {
2135 }
2136 }
2137 }
2138 }
2139
2141 {
2142 if (
g_Game.IsHeadlessOrDedicatedServer())
2143 return;
2144
2146 {
2148 GetInventory().GetCurrentInventoryLocation(invLoc);
2150 {
2152 if (ptcMgr)
2153 {
2158 }
2159 }
2160 }
2162 {
2164 {
2167 return;
2168 }
2169
2171 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2173 {
2176 }
2177 }
2178 }
2179
2180 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2181 {
2183 {
2188 }
2189
2190 super.GetDebugActions(outputList);
2191 }
2192
2194 {
2195 super.OnAction(action_id, player, ctx);
2196
2198 {
2199 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2200 {
2202 if (food_stage_prev <= 0)
2203 {
2205 }
2207 return true;
2208 }
2209 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2210 {
2213 {
2215 }
2217 return true;
2218 }
2219
2220 }
2221
2222 #ifdef DIAG_DEVELOPER
2223 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2224 {
2225 PrintNutritionsData();
2226 return true;
2227 }
2228 #endif
2229
2230 return false;
2231 }
2232
2234 {
2235 string debug_output;
2236
2237 debug_output = super.GetDebugText();
2238
2241
2242 return debug_output;
2243 }
2244
2245
2246
2247
2248
2250 {
2251 float ret = super.GetBaitEffectivity();
2252
2254 {
2255 ret *= 0.5;
2256 }
2257
2258 return ret;
2259 }
2260
2262 {
2264 }
2265
2267 {
2269 }
2270
2272 {
2274 }
2275
2276 #ifdef DIAG_DEVELOPER
2277 private void PrintNutritionsData()
2278 {
2279 string nutritionsData = "";
2280
2283
2285 if (profile)
2286 {
2287 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2289 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2293 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2295
2298
2299 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2301 }
2302
2303 nutritionsData += "-----\n";
2304
2306 }
2307 #endif
2308
2310
2313 {
2315 }
2316}
2317
2319{
2321};
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.