1430{
1432
1440
1450
1452
1454 {
1456 {
1458
1460 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1461
1465 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1466 }
1467 }
1468
1470 {
1472
1474 }
1475
1477 {
1478 super.EEDelete(parent);
1479
1481
1484 }
1485
1487 {
1488 super.EEItemLocationChanged(oldLoc, newLoc);
1489
1492 {
1493 switch (oldLoc.GetParent().GetType())
1494 {
1495 case "FryingPan":
1496 case "Pot":
1497 case "Cauldron":
1498 case "SharpWoodenStick":
1500 break;
1501 }
1502
1505 {
1507 }
1508 }
1509
1510 if (oldLoc.IsValid())
1512
1515 }
1516
1518 {
1521 }
1522
1524 {
1527
1528 return true;
1529 }
1530
1532 {
1534 {
1536 }
1537 }
1538
1541 {
1542 int foodStageType;
1543
1545 if (foodStage)
1546 foodStageType = foodStage.GetFoodStageType();
1547
1552
1553 return agentsIn;
1554 }
1555
1556
1558 {
1559 return false;
1560 }
1561
1563 {
1564 return false;
1565 }
1566
1568 {
1570 {
1572 {
1575
1578
1579 default:
1580 return super.GetTemperatureFreezeTime();
1581 }
1582 }
1583
1584 return super.GetTemperatureFreezeTime();
1585 }
1586
1588 {
1590 {
1592 {
1595
1598
1599 default:
1600 return super.GetTemperatureThawTime();
1601 }
1602 }
1603
1604 return super.GetTemperatureThawTime();
1605 }
1606
1608 {
1610 }
1611
1612
1613
1614
1616 {
1617 SetSynchDirty();
1618 }
1619
1621 {
1622 super.OnVariablesSynchronized();
1623
1624
1625
1626
1628 {
1630 }
1631 else
1632 {
1634 }
1635
1638 }
1639
1640
1641
1642
1644 {
1647
1649 }
1650
1652 {
1653 string soundName = "";
1654
1657
1659 {
1661 }
1662 else
1663 {
1665 {
1667 {
1672 else
1673 soundName = "";
1674 break;
1675 }
1676
1678 {
1683 else
1684 soundName = "";
1685 break;
1686 }
1687
1689 {
1694 else
1695 soundName = "";
1696 break;
1697 }
1698
1699 default:
1700 soundName = "";
1701 break;
1702 }
1703
1705 {
1706 if (soundName == "")
1707 {
1709 }
1710 else
1711 {
1713 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1714 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1716 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1717 {
1719 }
1720 }
1721 }
1722 }
1723
1725 }
1726
1728 {
1731 }
1732
1733
1734
1735
1737 {
1738 super.OnStoreSave(ctx);
1739
1741 {
1743 }
1744
1745
1748 }
1749
1751 {
1752 if (!super.OnStoreLoad(ctx, version))
1753 return false;
1754
1756 {
1758 return false;
1759 }
1760
1761 if (version >= 115)
1762 {
1764 {
1766 return false;
1767 }
1769 {
1771 return false;
1772 }
1773 }
1774
1777
1778 return true;
1779 }
1780
1782 {
1783 super.AfterStoreLoad();
1784
1786 }
1787
1788
1790 {
1792 }
1793
1794
1796 {
1797 return false;
1798 }
1799
1801 {
1802 return false;
1803 }
1804
1806 {
1807 return false;
1808 }
1809
1811 {
1812 return false;
1813 }
1814
1815
1816
1817
1818
1820 {
1823 {
1824 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1825 }
1826 else if (classname != "" && food_stage)
1827 {
1828 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1829 }
1830 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1832
1833 }
1834
1836 {
1839 {
1841 }
1842 else if (classname != "" && food_stage)
1843 {
1844 return FoodStage.GetEnergy(null, food_stage, classname);
1845 }
1846 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1848 }
1849
1851 {
1854 {
1856 }
1857 else if (classname != "" && food_stage)
1858 {
1859 return FoodStage.GetWater(null, food_stage, classname);
1860 }
1861 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1863 }
1864
1866 {
1869 {
1870 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1871 }
1872 else if (classname != "" && food_stage)
1873 {
1874 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1875 }
1876 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1878
1879 }
1880
1882 {
1885 {
1886 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1887 }
1888 else if (classname != "" && food_stage)
1889 {
1890 return FoodStage.GetToxicity(null, food_stage, classname);
1891 }
1892 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1894 }
1895
1897 {
1900 {
1902 }
1903 else if (classname != "" && food_stage)
1904 {
1905 return FoodStage.GetAgents(null, food_stage, classname);
1906 }
1907 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1909 }
1910
1912 {
1915 {
1916 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1917 }
1918 else if (classname != "" && food_stage)
1919 {
1920 return FoodStage.GetDigestibility(null, food_stage, classname);
1921 }
1922 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1924 }
1925
1927 {
1930 {
1931 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1932 }
1933 else if (className != "" && foodStage)
1934 {
1935 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1936 }
1937 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1939 }
1940
1942 {
1952
1953 return profile;
1954 }
1955
1956
1957
1958
1960 {
1962 }
1963
1964
1966 {
1968 {
1970 }
1971
1972 return false;
1973 }
1974
1976 {
1978 {
1980 }
1981
1982 return false;
1983 }
1984
1986 {
1988 {
1990 }
1991
1992 return false;
1993 }
1994
1996 {
1998 {
2000 }
2001
2002 return false;
2003 }
2004
2006 {
2008 {
2010 }
2011
2012 return false;
2013 }
2014
2016 {
2018 {
2020 }
2021
2022 return false;
2023 }
2024
2025
2027 {
2029 }
2030
2032 {
2033 return GetFoodStage().GetNextFoodStageType( cooking_method );
2034 }
2035
2037 {
2038 return GetFoodStage().GetFoodStageName( food_stage_type );
2039 }
2040
2042 {
2043 return GetFoodStage().CanChangeToNewStage( cooking_method );
2044 }
2045
2046
2048 {
2049 if ( !source.GetFoodStage())
2050 return;
2055 }
2056
2059 {
2062 }
2063
2066 {
2067 switch (stageNew)
2068 {
2073 break;
2074
2077 break;
2078 }
2079 }
2080
2081
2082
2083
2084
2086 {
2088 }
2089
2091 {
2093
2094
2096 }
2097
2099 {
2101 {
2104 }
2105 }
2106
2107
2109 {
2111 if (player)
2112 {
2114 player.ServerReplaceItemInHandsWithNew(lambda);
2115 }
2116 else
2117 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2118 }
2119
2121 {
2123 }
2124
2126 {
2127 super.SetActions();
2128
2131 }
2132
2134 {
2135 #ifndef SERVER
2137 {
2139
2142 }
2143 #endif
2144 }
2145
2147 {
2148 #ifndef SERVER
2150 {
2154 }
2155 #endif
2156 }
2157
2159 {
2160 return false;
2161 }
2162
2164 {
2166 }
2167
2168 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2169 {
2171
2172 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2174 if ( hasRootAsPlayer )
2176
2177
2178
2179
2180
2181
2182
2184 {
2185
2187 {
2189 {
2193 break;
2194
2198 break;
2199
2203 break;
2204
2208 default:
2211 return;
2212 }
2213
2214
2215 }
2216
2218
2220 {
2222 {
2223
2225 {
2227 }
2229 {
2232 {
2234 }
2235 else
2236 {
2238 {
2240 }
2241 else
2242 {
2244 }
2245 }
2246 }
2247 }
2248 }
2249
2250 }
2252 {
2253
2255 {
2257 {
2261 break;
2262
2266 break;
2267
2271 break;
2272
2276 break;
2277
2280 default:
2283 return;
2284 }
2285 }
2286
2288
2290 {
2292 {
2293
2295 {
2297 }
2298 }
2299 }
2300 }
2302 {
2303
2305 {
2307 {
2311 break;
2312
2315 default:
2318 return;
2319 }
2320 }
2321
2323
2325 {
2327 {
2328
2330 {
2332 }
2333 }
2334 }
2335 }
2336 else
2337 {
2338
2340
2342 {
2345
2346 }
2347 else
2348 {
2350 {
2353 }
2354 }
2355 }
2356 }
2357
2359 {
2360 if (
GetGame().IsDedicatedServer())
2361 return;
2362
2364 {
2366 GetInventory().GetCurrentInventoryLocation(invLoc);
2368 {
2370 if (ptcMgr)
2371 {
2376 }
2377 }
2378 }
2380 {
2382 {
2385 return;
2386 }
2387
2389 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2391 {
2394 }
2395 }
2396 }
2397
2398 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2399 {
2400 super.GetDebugActions(outputList);
2401
2403 {
2407 }
2408 }
2409
2411 {
2412 super.OnAction(action_id, player, ctx);
2413
2415 {
2416 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2417 {
2419 if (food_stage_prev <= 0)
2420 {
2422 }
2424 return true;
2425 }
2426 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2427 {
2430 {
2432 }
2434 return true;
2435 }
2436
2437 }
2438
2439 #ifdef DIAG_DEVELOPER
2440 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2441 {
2442 PrintNutritionsData();
2443 return true;
2444 }
2445 #endif
2446
2447 return false;
2448 }
2449
2451 {
2452 string debug_output;
2453
2454 debug_output = super.GetDebugText();
2455
2458
2459 return debug_output;
2460 }
2461
2462
2463
2464
2465
2467 {
2468 float ret = super.GetBaitEffectivity();
2469
2471 {
2472 ret *= 0.5;
2473 }
2474
2475 return ret;
2476 }
2477
2479 {
2481 }
2482
2484 {
2486 }
2487
2489 {
2491 }
2492
2493 #ifdef DIAG_DEVELOPER
2494 private void PrintNutritionsData()
2495 {
2496 string nutritionsData = "";
2497
2500
2502 if (profile)
2503 {
2504 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2506 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2510 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2512
2515
2516 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2518 }
2519
2520 nutritionsData += "-----\n";
2521
2523 }
2524 #endif
2525
2527
2530 {
2532 }
2533}
2534
2536{
2538};
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.