1466{
1468
1476
1486
1488
1490 {
1492 {
1494
1496 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1497
1501 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1502 }
1503 }
1504
1506 {
1508
1510 }
1511
1513 {
1514 super.EEDelete(parent);
1515
1517
1520 }
1521
1523 {
1524 super.EEItemLocationChanged(oldLoc, newLoc);
1525
1528 {
1529 switch (oldLoc.GetParent().GetType())
1530 {
1531 case "FryingPan":
1532 case "Pot":
1533 case "Cauldron":
1534 case "SharpWoodenStick":
1536 break;
1537 }
1538
1541 {
1543 }
1544 }
1545
1546 if (oldLoc.IsValid())
1548
1551 }
1552
1554 {
1557 }
1558
1560 {
1563
1564 return true;
1565 }
1566
1568 {
1570 {
1572 }
1573 }
1574
1577 {
1578 int foodStageType;
1579
1581 if (foodStage)
1582 foodStageType = foodStage.GetFoodStageType();
1583
1588
1589 return agentsIn;
1590 }
1591
1592
1594 {
1595 return false;
1596 }
1597
1599 {
1600 return false;
1601 }
1602
1604 {
1606 {
1608 {
1611
1614
1615 default:
1616 return super.GetTemperatureFreezeTime();
1617 }
1618 }
1619
1620 return super.GetTemperatureFreezeTime();
1621 }
1622
1624 {
1626 {
1628 {
1631
1634
1635 default:
1636 return super.GetTemperatureThawTime();
1637 }
1638 }
1639
1640 return super.GetTemperatureThawTime();
1641 }
1642
1644 {
1646 }
1647
1648
1649
1650
1652 {
1653 SetSynchDirty();
1654 }
1655
1657 {
1658 super.OnVariablesSynchronized();
1659
1660
1661
1662
1664 {
1666 }
1667 else
1668 {
1670 }
1671
1674 }
1675
1676
1677
1678
1680 {
1683
1685 }
1686
1688 {
1689 string soundName = "";
1690
1693
1695 {
1697 }
1698 else
1699 {
1701 {
1703 {
1708 else
1709 soundName = "";
1710 break;
1711 }
1712
1714 {
1719 else
1720 soundName = "";
1721 break;
1722 }
1723
1725 {
1730 else
1731 soundName = "";
1732 break;
1733 }
1734
1735 default:
1736 soundName = "";
1737 break;
1738 }
1739
1741 {
1742 if (soundName == "")
1743 {
1745 }
1746 else
1747 {
1749 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1750 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1752 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1753 {
1755 }
1756 }
1757 }
1758 }
1759
1761 }
1762
1764 {
1767 }
1768
1769
1770
1771
1773 {
1774 super.OnStoreSave(ctx);
1775
1777 {
1779 }
1780
1781
1784 }
1785
1787 {
1788 if (!super.OnStoreLoad(ctx, version))
1789 return false;
1790
1792 {
1794 return false;
1795 }
1796
1797 if (version >= 115)
1798 {
1800 {
1802 return false;
1803 }
1805 {
1807 return false;
1808 }
1809 }
1810
1813
1814 return true;
1815 }
1816
1818 {
1819 super.AfterStoreLoad();
1820
1822 }
1823
1824
1826 {
1828 }
1829
1830
1832 {
1833 return false;
1834 }
1835
1837 {
1838 return false;
1839 }
1840
1842 {
1843 return false;
1844 }
1845
1847 {
1848 return false;
1849 }
1850
1851
1852
1853
1854
1856 {
1859 {
1860 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
1861 }
1862 else if (classname != "" && food_stage)
1863 {
1864 return FoodStage.GetFullnessIndex(null, food_stage, classname);
1865 }
1866 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
1867 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
1868
1869 }
1870
1872 {
1875 {
1877 }
1878 else if (classname != "" && food_stage)
1879 {
1880 return FoodStage.GetEnergy(null, food_stage, classname);
1881 }
1882 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1883 return g_Game.ConfigGetFloat( class_path +
" energy" );
1884 }
1885
1887 {
1890 {
1892 }
1893 else if (classname != "" && food_stage)
1894 {
1895 return FoodStage.GetWater(null, food_stage, classname);
1896 }
1897 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1898 return g_Game.ConfigGetFloat( class_path +
" water" );
1899 }
1900
1902 {
1905 {
1906 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
1907 }
1908 else if (classname != "" && food_stage)
1909 {
1910 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
1911 }
1912 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1913 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
1914
1915 }
1916
1918 {
1921 {
1922 return FoodStage.GetToxicity(food_item.
GetFoodStage());
1923 }
1924 else if (classname != "" && food_stage)
1925 {
1926 return FoodStage.GetToxicity(null, food_stage, classname);
1927 }
1928 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1929 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
1930 }
1931
1933 {
1936 {
1938 }
1939 else if (classname != "" && food_stage)
1940 {
1941 return FoodStage.GetAgents(null, food_stage, classname);
1942 }
1943 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1944 return g_Game.ConfigGetInt( class_path +
" agents" );
1945 }
1946
1948 {
1951 {
1952 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
1953 }
1954 else if (classname != "" && food_stage)
1955 {
1956 return FoodStage.GetDigestibility(null, food_stage, classname);
1957 }
1958 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
1959 return g_Game.ConfigGetInt( class_path +
" digestibility" );
1960 }
1961
1963 {
1966 {
1967 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
1968 }
1969 else if (className != "" && foodStage)
1970 {
1971 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
1972 }
1973 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
1974 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
1975 }
1976
1978 {
1988
1989 return profile;
1990 }
1991
1992
1993
1994
1996 {
1998 }
1999
2000
2002 {
2004 {
2006 }
2007
2008 return false;
2009 }
2010
2012 {
2014 {
2016 }
2017
2018 return false;
2019 }
2020
2022 {
2024 {
2026 }
2027
2028 return false;
2029 }
2030
2032 {
2034 {
2036 }
2037
2038 return false;
2039 }
2040
2042 {
2044 {
2046 }
2047
2048 return false;
2049 }
2050
2052 {
2054 {
2056 }
2057
2058 return false;
2059 }
2060
2061
2063 {
2065 }
2066
2068 {
2069 return GetFoodStage().GetNextFoodStageType( cooking_method );
2070 }
2071
2073 {
2074 return GetFoodStage().GetFoodStageName( food_stage_type );
2075 }
2076
2078 {
2079 return GetFoodStage().CanChangeToNewStage( cooking_method );
2080 }
2081
2082
2084 {
2085 if ( !source.GetFoodStage())
2086 return;
2091 }
2092
2095 {
2098 }
2099
2102 {
2103 switch (stageNew)
2104 {
2109 break;
2110
2113 break;
2114 }
2115 }
2116
2117
2118
2119
2120
2122 {
2124 }
2125
2127 {
2129
2130
2132 }
2133
2135 {
2137 {
2140 }
2141 }
2142
2143
2145 {
2147 if (player)
2148 {
2150 player.ServerReplaceItemInHandsWithNew(lambda);
2151 }
2152 else
2153 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2154 }
2155
2157 {
2159 }
2160
2162 {
2163 super.SetActions();
2164
2167 }
2168
2170 {
2171 #ifndef SERVER
2172 #ifndef NO_GUI
2174 {
2176
2179 }
2180 #endif
2181 #endif
2182 }
2183
2185 {
2186 #ifndef SERVER
2187 #ifndef NO_GUI
2189 {
2193 }
2194 #endif
2195 #endif
2196 }
2197
2199 {
2200 return false;
2201 }
2202
2204 {
2206 }
2207
2208 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2209 {
2211
2212 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2214 if ( hasRootAsPlayer )
2216
2217
2218
2219
2220
2221
2222
2224 {
2225
2227 {
2229 {
2233 break;
2234
2238 break;
2239
2243 break;
2244
2248 default:
2251 return;
2252 }
2253
2254
2255 }
2256
2258
2260 {
2262 {
2263
2265 {
2267 }
2269 {
2272 {
2274 }
2275 else
2276 {
2278 {
2280 }
2281 else
2282 {
2284 }
2285 }
2286 }
2287 }
2288 }
2289
2290 }
2292 {
2293
2295 {
2297 {
2301 break;
2302
2306 break;
2307
2311 break;
2312
2316 break;
2317
2320 default:
2323 return;
2324 }
2325 }
2326
2328
2330 {
2332 {
2333
2335 {
2337 }
2338 }
2339 }
2340 }
2342 {
2343
2345 {
2347 {
2351 break;
2352
2355 default:
2358 return;
2359 }
2360 }
2361
2363
2365 {
2367 {
2368
2370 {
2372 }
2373 }
2374 }
2375 }
2376 else
2377 {
2378
2380
2382 {
2385
2386 }
2387 else
2388 {
2390 {
2393 }
2394 }
2395 }
2396 }
2397
2399 {
2400 if (
g_Game.IsHeadlessOrDedicatedServer())
2401 return;
2402
2404 {
2406 GetInventory().GetCurrentInventoryLocation(invLoc);
2408 {
2410 if (ptcMgr)
2411 {
2416 }
2417 }
2418 }
2420 {
2422 {
2425 return;
2426 }
2427
2429 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2431 {
2434 }
2435 }
2436 }
2437
2438 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2439 {
2441 {
2446 }
2447
2448 super.GetDebugActions(outputList);
2449 }
2450
2452 {
2453 super.OnAction(action_id, player, ctx);
2454
2456 {
2457 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2458 {
2460 if (food_stage_prev <= 0)
2461 {
2463 }
2465 return true;
2466 }
2467 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2468 {
2471 {
2473 }
2475 return true;
2476 }
2477
2478 }
2479
2480 #ifdef DIAG_DEVELOPER
2481 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2482 {
2483 PrintNutritionsData();
2484 return true;
2485 }
2486 #endif
2487
2488 return false;
2489 }
2490
2492 {
2493 string debug_output;
2494
2495 debug_output = super.GetDebugText();
2496
2499
2500 return debug_output;
2501 }
2502
2503
2504
2505
2506
2508 {
2509 float ret = super.GetBaitEffectivity();
2510
2512 {
2513 ret *= 0.5;
2514 }
2515
2516 return ret;
2517 }
2518
2520 {
2522 }
2523
2525 {
2527 }
2528
2530 {
2532 }
2533
2534 #ifdef DIAG_DEVELOPER
2535 private void PrintNutritionsData()
2536 {
2537 string nutritionsData = "";
2538
2541
2543 if (profile)
2544 {
2545 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2547 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2551 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2553
2556
2557 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2559 }
2560
2561 nutritionsData += "-----\n";
2562
2564 }
2565 #endif
2566
2568
2571 {
2573 }
2574}
2575
2577{
2579};
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.