1300{
1302
1310
1320
1322
1324 {
1326 {
1328
1330 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1331
1335 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1336 }
1337 }
1338
1340 {
1342
1344 }
1345
1347 {
1348 super.EEDelete(parent);
1349
1351
1354 }
1355
1357 {
1358 super.EEItemLocationChanged(oldLoc, newLoc);
1359
1362 {
1363 switch (oldLoc.GetParent().GetType())
1364 {
1365 case "FryingPan":
1366 case "Pot":
1367 case "Cauldron":
1368 case "SharpWoodenStick":
1370 break;
1371 }
1372
1375 {
1377 }
1378 }
1379
1380 if (oldLoc.IsValid())
1382
1385 }
1386
1388 {
1391 }
1392
1394 {
1397
1398 return true;
1399 }
1400
1402 {
1404 {
1406 }
1407 }
1408
1411 {
1412 int foodStageType;
1413
1415 if (foodStage)
1416 foodStageType = foodStage.GetFoodStageType();
1417
1422
1423 return agentsIn;
1424 }
1425
1426
1428 {
1429 return false;
1430 }
1431
1433 {
1434 return false;
1435 }
1436
1438 {
1440 {
1442 {
1445
1448
1449 default:
1450 return super.GetTemperatureFreezeTime();
1451 }
1452 }
1453
1454 return super.GetTemperatureFreezeTime();
1455 }
1456
1458 {
1460 {
1462 {
1465
1468
1469 default:
1470 return super.GetTemperatureThawTime();
1471 }
1472 }
1473
1474 return super.GetTemperatureThawTime();
1475 }
1476
1478 {
1480 }
1481
1482
1483
1484
1486 {
1487 SetSynchDirty();
1488 }
1489
1491 {
1492 super.OnVariablesSynchronized();
1493
1494
1495
1496
1498 {
1500 }
1501 else
1502 {
1504 }
1505
1508 }
1509
1510
1511
1512
1514 {
1517
1519 }
1520
1522 {
1523 string soundName = "";
1524
1527
1529 {
1531 }
1532 else
1533 {
1535 {
1537 {
1542 else
1543 soundName = "";
1544 break;
1545 }
1546
1548 {
1553 else
1554 soundName = "";
1555 break;
1556 }
1557
1559 {
1564 else
1565 soundName = "";
1566 break;
1567 }
1568
1569 default:
1570 soundName = "";
1571 break;
1572 }
1573
1575 {
1576 if (soundName == "")
1577 {
1579 }
1580 else
1581 {
1583 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1584 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1586 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1587 {
1589 }
1590 }
1591 }
1592 }
1593
1595 }
1596
1598 {
1601 }
1602
1603
1604
1605
1607 {
1608 super.OnStoreSave(ctx);
1609
1611 {
1613 }
1614
1615
1618 }
1619
1621 {
1622 if (!super.OnStoreLoad(ctx, version))
1623 return false;
1624
1626 {
1628 return false;
1629 }
1630
1631 if (version >= 115)
1632 {
1634 {
1636 return false;
1637 }
1639 {
1641 return false;
1642 }
1643 }
1644
1647
1648 return true;
1649 }
1650
1652 {
1653 super.AfterStoreLoad();
1654
1656 }
1657
1658
1660 {
1662 }
1663
1664
1666 {
1667 return false;
1668 }
1669
1671 {
1672 return false;
1673 }
1674
1676 {
1677 return false;
1678 }
1679
1681 {
1682 return false;
1683 }
1684
1685
1686
1687
1688
1690 {
1693 {
1694 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1695 }
1696 else if (classname != "" && food_stage)
1697 {
1698 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1699 }
1700 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1702
1703 }
1704
1706 {
1709 {
1711 }
1712 else if (classname != "" && food_stage)
1713 {
1714 return FoodStage.GetEnergy(null, food_stage, classname);
1715 }
1716 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1718 }
1719
1721 {
1724 {
1726 }
1727 else if (classname != "" && food_stage)
1728 {
1729 return FoodStage.GetWater(null, food_stage, classname);
1730 }
1731 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1733 }
1734
1736 {
1739 {
1740 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1741 }
1742 else if (classname != "" && food_stage)
1743 {
1744 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1745 }
1746 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1748
1749 }
1750
1752 {
1755 {
1756 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1757 }
1758 else if (classname != "" && food_stage)
1759 {
1760 return FoodStage.GetToxicity(null, food_stage, classname);
1761 }
1762 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1764 }
1765
1767 {
1770 {
1772 }
1773 else if (classname != "" && food_stage)
1774 {
1775 return FoodStage.GetAgents(null, food_stage, classname);
1776 }
1777 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1779 }
1780
1782 {
1785 {
1786 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1787 }
1788 else if (classname != "" && food_stage)
1789 {
1790 return FoodStage.GetDigestibility(null, food_stage, classname);
1791 }
1792 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1794 }
1795
1797 {
1800 {
1801 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1802 }
1803 else if (className != "" && foodStage)
1804 {
1805 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1806 }
1807 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1809 }
1810
1812 {
1822
1823 return profile;
1824 }
1825
1826
1827
1828
1830 {
1832 }
1833
1834
1836 {
1838 {
1840 }
1841
1842 return false;
1843 }
1844
1846 {
1848 {
1850 }
1851
1852 return false;
1853 }
1854
1856 {
1858 {
1860 }
1861
1862 return false;
1863 }
1864
1866 {
1868 {
1870 }
1871
1872 return false;
1873 }
1874
1876 {
1878 {
1880 }
1881
1882 return false;
1883 }
1884
1886 {
1888 {
1890 }
1891
1892 return false;
1893 }
1894
1895
1897 {
1899 }
1900
1902 {
1903 return GetFoodStage().GetNextFoodStageType( cooking_method );
1904 }
1905
1907 {
1908 return GetFoodStage().GetFoodStageName( food_stage_type );
1909 }
1910
1912 {
1913 return GetFoodStage().CanChangeToNewStage( cooking_method );
1914 }
1915
1916
1918 {
1919 if ( !source.GetFoodStage())
1920 return;
1925 }
1926
1929 {
1932 }
1933
1936 {
1937 switch (stageNew)
1938 {
1943 break;
1944
1947 break;
1948 }
1949 }
1950
1951
1952
1953
1954
1956 {
1958 }
1959
1961 {
1963
1964
1966 }
1967
1969 {
1971 {
1974 }
1975 }
1976
1977
1979 {
1981 if (player)
1982 {
1984 player.ServerReplaceItemInHandsWithNew(lambda);
1985 }
1986 else
1987 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
1988 }
1989
1991 {
1993 }
1994
1996 {
1997 super.SetActions();
1998
2001 }
2002
2004 {
2005 #ifndef SERVER
2007 {
2009
2012 }
2013 #endif
2014 }
2015
2017 {
2018 #ifndef SERVER
2020 {
2024 }
2025 #endif
2026 }
2027
2029 {
2030 return false;
2031 }
2032
2034 {
2036 }
2037
2038 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2039 {
2041
2042 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2044 if ( hasRootAsPlayer )
2046
2047
2048
2049
2050
2051
2052
2054 {
2055
2057 {
2059 {
2063 break;
2064
2068 break;
2069
2073 break;
2074
2078 default:
2081 return;
2082 }
2083
2084
2085 }
2086
2088
2090 {
2092 {
2093
2095 {
2097 }
2099 {
2102 {
2104 }
2105 else
2106 {
2108 {
2110 }
2111 else
2112 {
2114 }
2115 }
2116 }
2117 }
2118 }
2119
2120 }
2122 {
2123
2125 {
2127 {
2131 break;
2132
2136 break;
2137
2141 break;
2142
2146 break;
2147
2150 default:
2153 return;
2154 }
2155 }
2156
2158
2160 {
2162 {
2163
2165 {
2167 }
2168 }
2169 }
2170 }
2172 {
2173
2175 {
2177 {
2181 break;
2182
2185 default:
2188 return;
2189 }
2190 }
2191
2193
2195 {
2197 {
2198
2200 {
2202 }
2203 }
2204 }
2205 }
2206 else
2207 {
2208
2210
2212 {
2215
2216 }
2217 else
2218 {
2220 {
2223 }
2224 }
2225 }
2226 }
2227
2229 {
2230 if (
GetGame().IsDedicatedServer())
2231 return;
2232
2234 {
2236 GetInventory().GetCurrentInventoryLocation(invLoc);
2238 {
2240 if (ptcMgr)
2241 {
2246 }
2247 }
2248 }
2250 {
2252 {
2255 return;
2256 }
2257
2259 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2261 {
2264 }
2265 }
2266 }
2267
2268 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2269 {
2270 super.GetDebugActions(outputList);
2271
2273 {
2277 }
2278 }
2279
2281 {
2282 super.OnAction(action_id, player, ctx);
2283
2285 {
2286 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2287 {
2289 if (food_stage_prev <= 0)
2290 {
2292 }
2294 return true;
2295 }
2296 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2297 {
2300 {
2302 }
2304 return true;
2305 }
2306
2307 }
2308
2309 #ifdef DIAG_DEVELOPER
2310 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2311 {
2312 PrintNutritionsData();
2313 return true;
2314 }
2315 #endif
2316
2317 return false;
2318 }
2319
2321 {
2322 string debug_output;
2323
2324 debug_output = super.GetDebugText();
2325
2328
2329 return debug_output;
2330 }
2331
2332
2333
2334
2335
2337 {
2338 float ret = super.GetBaitEffectivity();
2339
2341 {
2342 ret *= 0.5;
2343 }
2344
2345 return ret;
2346 }
2347
2349 {
2351 }
2352
2354 {
2356 }
2357
2359 {
2361 }
2362
2363 #ifdef DIAG_DEVELOPER
2364 private void PrintNutritionsData()
2365 {
2366 string nutritionsData = "";
2367
2370
2372 if (profile)
2373 {
2374 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2376 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2380 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2382
2385
2386 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2388 }
2389
2390 nutritionsData += "-----\n";
2391
2393 }
2394 #endif
2395
2397
2400 {
2402 }
2403}
2404
2406{
2408};
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.