1305{
1307
1315
1325
1327
1329 {
1331 {
1333
1335 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1336
1340 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1341 }
1342 }
1343
1345 {
1347
1349 }
1350
1352 {
1353 super.EEDelete(parent);
1354
1356
1359 }
1360
1362 {
1363 super.EEItemLocationChanged(oldLoc, newLoc);
1364
1367 {
1368 switch (oldLoc.GetParent().GetType())
1369 {
1370 case "FryingPan":
1371 case "Pot":
1372 case "Cauldron":
1373 case "SharpWoodenStick":
1375 break;
1376 }
1377
1380 {
1382 }
1383 }
1384
1385 if (oldLoc.IsValid())
1387
1390 }
1391
1393 {
1396 }
1397
1399 {
1402
1403 return true;
1404 }
1405
1407 {
1409 {
1411 }
1412 }
1413
1416 {
1417 int foodStageType;
1418
1420 if (foodStage)
1421 foodStageType = foodStage.GetFoodStageType();
1422
1427
1428 return agentsIn;
1429 }
1430
1431
1433 {
1434 return false;
1435 }
1436
1438 {
1439 return false;
1440 }
1441
1443 {
1445 {
1447 {
1450
1453
1454 default:
1455 return super.GetTemperatureFreezeTime();
1456 }
1457 }
1458
1459 return super.GetTemperatureFreezeTime();
1460 }
1461
1463 {
1465 {
1467 {
1470
1473
1474 default:
1475 return super.GetTemperatureThawTime();
1476 }
1477 }
1478
1479 return super.GetTemperatureThawTime();
1480 }
1481
1483 {
1485 }
1486
1487
1488
1489
1491 {
1492 SetSynchDirty();
1493 }
1494
1496 {
1497 super.OnVariablesSynchronized();
1498
1499
1500
1501
1503 {
1505 }
1506 else
1507 {
1509 }
1510
1513 }
1514
1515
1516
1517
1519 {
1522
1524 }
1525
1527 {
1528 string soundName = "";
1529
1532
1534 {
1536 }
1537 else
1538 {
1540 {
1542 {
1547 else
1548 soundName = "";
1549 break;
1550 }
1551
1553 {
1558 else
1559 soundName = "";
1560 break;
1561 }
1562
1564 {
1569 else
1570 soundName = "";
1571 break;
1572 }
1573
1574 default:
1575 soundName = "";
1576 break;
1577 }
1578
1580 {
1581 if (soundName == "")
1582 {
1584 }
1585 else
1586 {
1588 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1589 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1591 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1592 {
1594 }
1595 }
1596 }
1597 }
1598
1600 }
1601
1603 {
1606 }
1607
1608
1609
1610
1612 {
1613 super.OnStoreSave(ctx);
1614
1616 {
1618 }
1619
1620
1623 }
1624
1626 {
1627 if (!super.OnStoreLoad(ctx, version))
1628 return false;
1629
1631 {
1633 return false;
1634 }
1635
1636 if (version >= 115)
1637 {
1639 {
1641 return false;
1642 }
1644 {
1646 return false;
1647 }
1648 }
1649
1652
1653 return true;
1654 }
1655
1657 {
1658 super.AfterStoreLoad();
1659
1661 }
1662
1663
1665 {
1667 }
1668
1669
1671 {
1672 return false;
1673 }
1674
1676 {
1677 return false;
1678 }
1679
1681 {
1682 return false;
1683 }
1684
1686 {
1687 return false;
1688 }
1689
1690
1691
1692
1693
1695 {
1698 {
1699 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1700 }
1701 else if (classname != "" && food_stage)
1702 {
1703 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1704 }
1705 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1706 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1707
1708 }
1709
1711 {
1714 {
1716 }
1717 else if (classname != "" && food_stage)
1718 {
1719 return FoodStage.GetEnergy(null, food_stage, classname);
1720 }
1721 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1722 return g_Game.ConfigGetFloat( class_path +
" energy" );
1723 }
1724
1726 {
1729 {
1731 }
1732 else if (classname != "" && food_stage)
1733 {
1734 return FoodStage.GetWater(null, food_stage, classname);
1735 }
1736 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1737 return g_Game.ConfigGetFloat( class_path +
" water" );
1738 }
1739
1741 {
1744 {
1745 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1746 }
1747 else if (classname != "" && food_stage)
1748 {
1749 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1750 }
1751 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1752 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1753
1754 }
1755
1757 {
1760 {
1761 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1762 }
1763 else if (classname != "" && food_stage)
1764 {
1765 return FoodStage.GetToxicity(null, food_stage, classname);
1766 }
1767 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1768 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1769 }
1770
1772 {
1775 {
1777 }
1778 else if (classname != "" && food_stage)
1779 {
1780 return FoodStage.GetAgents(null, food_stage, classname);
1781 }
1782 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1783 return g_Game.ConfigGetInt( class_path +
" agents" );
1784 }
1785
1787 {
1790 {
1791 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1792 }
1793 else if (classname != "" && food_stage)
1794 {
1795 return FoodStage.GetDigestibility(null, food_stage, classname);
1796 }
1797 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1798 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1799 }
1800
1802 {
1805 {
1806 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1807 }
1808 else if (className != "" && foodStage)
1809 {
1810 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1811 }
1812 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1813 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1814 }
1815
1817 {
1827
1828 return profile;
1829 }
1830
1831
1832
1833
1835 {
1837 }
1838
1839
1841 {
1843 {
1845 }
1846
1847 return false;
1848 }
1849
1851 {
1853 {
1855 }
1856
1857 return false;
1858 }
1859
1861 {
1863 {
1865 }
1866
1867 return false;
1868 }
1869
1871 {
1873 {
1875 }
1876
1877 return false;
1878 }
1879
1881 {
1883 {
1885 }
1886
1887 return false;
1888 }
1889
1891 {
1893 {
1895 }
1896
1897 return false;
1898 }
1899
1900
1902 {
1904 }
1905
1907 {
1908 return GetFoodStage().GetNextFoodStageType( cooking_method );
1909 }
1910
1912 {
1913 return GetFoodStage().GetFoodStageName( food_stage_type );
1914 }
1915
1917 {
1918 return GetFoodStage().CanChangeToNewStage( cooking_method );
1919 }
1920
1921
1923 {
1924 if ( !source.GetFoodStage())
1925 return;
1930 }
1931
1934 {
1937 }
1938
1941 {
1942 switch (stageNew)
1943 {
1948 break;
1949
1952 break;
1953 }
1954 }
1955
1956
1957
1958
1959
1961 {
1963 }
1964
1966 {
1968
1969
1971 }
1972
1974 {
1976 {
1979 }
1980 }
1981
1982
1984 {
1986 if (player)
1987 {
1989 player.ServerReplaceItemInHandsWithNew(lambda);
1990 }
1991 else
1992 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1993 }
1994
1996 {
1998 }
1999
2001 {
2002 super.SetActions();
2003
2006 }
2007
2009 {
2010 #ifndef SERVER
2011 #ifndef NO_GUI
2013 {
2015
2018 }
2019 #endif
2020 #endif
2021 }
2022
2024 {
2025 #ifndef SERVER
2026 #ifndef NO_GUI
2028 {
2032 }
2033 #endif
2034 #endif
2035 }
2036
2038 {
2039 return false;
2040 }
2041
2043 {
2045 }
2046
2047 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2048 {
2050
2051 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2053 if ( hasRootAsPlayer )
2055
2056
2057
2058
2059
2060
2061
2063 {
2064
2066 {
2068 {
2072 break;
2073
2077 break;
2078
2082 break;
2083
2087 default:
2090 return;
2091 }
2092
2093
2094 }
2095
2097
2099 {
2101 {
2102
2104 {
2106 }
2108 {
2111 {
2113 }
2114 else
2115 {
2117 {
2119 }
2120 else
2121 {
2123 }
2124 }
2125 }
2126 }
2127 }
2128
2129 }
2131 {
2132
2134 {
2136 {
2140 break;
2141
2145 break;
2146
2150 break;
2151
2155 break;
2156
2159 default:
2162 return;
2163 }
2164 }
2165
2167
2169 {
2171 {
2172
2174 {
2176 }
2177 }
2178 }
2179 }
2181 {
2182
2184 {
2186 {
2190 break;
2191
2194 default:
2197 return;
2198 }
2199 }
2200
2202
2204 {
2206 {
2207
2209 {
2211 }
2212 }
2213 }
2214 }
2215 else
2216 {
2217
2219
2221 {
2224
2225 }
2226 else
2227 {
2229 {
2232 }
2233 }
2234 }
2235 }
2236
2238 {
2239 if (
g_Game.IsHeadlessOrDedicatedServer())
2240 return;
2241
2243 {
2245 GetInventory().GetCurrentInventoryLocation(invLoc);
2247 {
2249 if (ptcMgr)
2250 {
2255 }
2256 }
2257 }
2259 {
2261 {
2264 return;
2265 }
2266
2268 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2270 {
2273 }
2274 }
2275 }
2276
2277 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2278 {
2280 {
2285 }
2286
2287 super.GetDebugActions(outputList);
2288 }
2289
2291 {
2292 super.OnAction(action_id, player, ctx);
2293
2295 {
2296 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2297 {
2299 if (food_stage_prev <= 0)
2300 {
2302 }
2304 return true;
2305 }
2306 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2307 {
2310 {
2312 }
2314 return true;
2315 }
2316
2317 }
2318
2319 #ifdef DIAG_DEVELOPER
2320 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2321 {
2322 PrintNutritionsData();
2323 return true;
2324 }
2325 #endif
2326
2327 return false;
2328 }
2329
2331 {
2332 string debug_output;
2333
2334 debug_output = super.GetDebugText();
2335
2338
2339 return debug_output;
2340 }
2341
2342
2343
2344
2345
2347 {
2348 float ret = super.GetBaitEffectivity();
2349
2351 {
2352 ret *= 0.5;
2353 }
2354
2355 return ret;
2356 }
2357
2359 {
2361 }
2362
2364 {
2366 }
2367
2369 {
2371 }
2372
2373 #ifdef DIAG_DEVELOPER
2374 private void PrintNutritionsData()
2375 {
2376 string nutritionsData = "";
2377
2380
2382 if (profile)
2383 {
2384 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2386 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2390 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2392
2395
2396 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2398 }
2399
2400 nutritionsData += "-----\n";
2401
2403 }
2404 #endif
2405
2407
2410 {
2412 }
2413}
2414
2416{
2418};
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.