1606{
1608
1616
1626
1628
1630 {
1632 {
1634
1636 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1637
1641 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1642 }
1643 }
1644
1646 {
1648
1650 }
1651
1653 {
1654 super.EEDelete(parent);
1655
1657
1660 }
1661
1663 {
1664 super.EEItemLocationChanged(oldLoc, newLoc);
1665
1668 {
1669 switch (oldLoc.GetParent().GetType())
1670 {
1671 case "FryingPan":
1672 case "Pot":
1673 case "Cauldron":
1674 case "SharpWoodenStick":
1676 break;
1677 }
1678
1681 {
1683 }
1684 }
1685
1686 if (oldLoc.IsValid())
1688
1691 }
1692
1694 {
1697 }
1698
1700 {
1703
1704 return true;
1705 }
1706
1708 {
1710 {
1712 }
1713 }
1714
1717 {
1718 int foodStageType;
1719
1721 if (foodStage)
1722 foodStageType = foodStage.GetFoodStageType();
1723
1728
1729 return agentsIn;
1730 }
1731
1732
1734 {
1735 return false;
1736 }
1737
1739 {
1740 return false;
1741 }
1742
1744 {
1746 {
1748 {
1751
1754
1755 default:
1756 return super.GetTemperatureFreezeTime();
1757 }
1758 }
1759
1760 return super.GetTemperatureFreezeTime();
1761 }
1762
1764 {
1766 {
1768 {
1771
1774
1775 default:
1776 return super.GetTemperatureThawTime();
1777 }
1778 }
1779
1780 return super.GetTemperatureThawTime();
1781 }
1782
1784 {
1786 }
1787
1788
1789
1790
1792 {
1793 SetSynchDirty();
1794 }
1795
1797 {
1798 super.OnVariablesSynchronized();
1799
1800
1801
1802
1804 {
1806 }
1807 else
1808 {
1810 }
1811
1814 }
1815
1816
1817
1818
1820 {
1823
1825 }
1826
1828 {
1829 string soundName = "";
1830
1833
1835 {
1837 }
1838 else
1839 {
1841 {
1843 {
1848 else
1849 soundName = "";
1850 break;
1851 }
1852
1854 {
1859 else
1860 soundName = "";
1861 break;
1862 }
1863
1865 {
1870 else
1871 soundName = "";
1872 break;
1873 }
1874
1875 default:
1876 soundName = "";
1877 break;
1878 }
1879
1881 {
1882 if (soundName == "")
1883 {
1885 }
1886 else
1887 {
1889 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1890 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1892 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1893 {
1895 }
1896 }
1897 }
1898 }
1899
1901 }
1902
1904 {
1907 }
1908
1909
1910
1911
1913 {
1914 super.OnStoreSave(ctx);
1915
1917 {
1919 }
1920
1921
1924 }
1925
1927 {
1928 if (!super.OnStoreLoad(ctx, version))
1929 return false;
1930
1932 {
1934 return false;
1935 }
1936
1937 if (version >= 115)
1938 {
1940 {
1942 return false;
1943 }
1945 {
1947 return false;
1948 }
1949 }
1950
1953
1954 return true;
1955 }
1956
1958 {
1959 super.AfterStoreLoad();
1960
1962 }
1963
1964
1966 {
1968 }
1969
1970
1972 {
1973 return false;
1974 }
1975
1977 {
1978 return false;
1979 }
1980
1982 {
1983 return false;
1984 }
1985
1987 {
1988 return false;
1989 }
1990
1991
1992
1993
1994
1996 {
1999 {
2000 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2001 }
2002 else if (classname != "" && food_stage)
2003 {
2004 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2005 }
2006 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2008
2009 }
2010
2012 {
2015 {
2017 }
2018 else if (classname != "" && food_stage)
2019 {
2020 return FoodStage.GetEnergy(null, food_stage, classname);
2021 }
2022 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2024 }
2025
2027 {
2030 {
2032 }
2033 else if (classname != "" && food_stage)
2034 {
2035 return FoodStage.GetWater(null, food_stage, classname);
2036 }
2037 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2039 }
2040
2042 {
2045 {
2046 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2047 }
2048 else if (classname != "" && food_stage)
2049 {
2050 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2051 }
2052 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2054
2055 }
2056
2058 {
2061 {
2062 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2063 }
2064 else if (classname != "" && food_stage)
2065 {
2066 return FoodStage.GetToxicity(null, food_stage, classname);
2067 }
2068 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2070 }
2071
2073 {
2076 {
2078 }
2079 else if (classname != "" && food_stage)
2080 {
2081 return FoodStage.GetAgents(null, food_stage, classname);
2082 }
2083 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2085 }
2086
2088 {
2091 {
2092 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2093 }
2094 else if (classname != "" && food_stage)
2095 {
2096 return FoodStage.GetDigestibility(null, food_stage, classname);
2097 }
2098 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2100 }
2101
2103 {
2106 {
2107 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2108 }
2109 else if (className != "" && foodStage)
2110 {
2111 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2112 }
2113 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2115 }
2116
2118 {
2128
2129 return profile;
2130 }
2131
2132
2133
2134
2136 {
2138 }
2139
2140
2142 {
2144 {
2146 }
2147
2148 return false;
2149 }
2150
2152 {
2154 {
2156 }
2157
2158 return false;
2159 }
2160
2162 {
2164 {
2166 }
2167
2168 return false;
2169 }
2170
2172 {
2174 {
2176 }
2177
2178 return false;
2179 }
2180
2182 {
2184 {
2186 }
2187
2188 return false;
2189 }
2190
2192 {
2194 {
2196 }
2197
2198 return false;
2199 }
2200
2201
2203 {
2205 }
2206
2208 {
2209 return GetFoodStage().GetNextFoodStageType( cooking_method );
2210 }
2211
2213 {
2214 return GetFoodStage().GetFoodStageName( food_stage_type );
2215 }
2216
2218 {
2219 return GetFoodStage().CanChangeToNewStage( cooking_method );
2220 }
2221
2222
2224 {
2225 if ( !source.GetFoodStage())
2226 return;
2231 }
2232
2235 {
2238 }
2239
2242 {
2243 switch (stageNew)
2244 {
2249 break;
2250
2253 break;
2254 }
2255 }
2256
2257
2258
2259
2260
2262 {
2264 }
2265
2267 {
2269
2270
2272 }
2273
2275 {
2277 {
2280 }
2281 }
2282
2283
2285 {
2287 if (player)
2288 {
2290 player.ServerReplaceItemInHandsWithNew(lambda);
2291 }
2292 else
2293 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2294 }
2295
2297 {
2299 }
2300
2302 {
2303 super.SetActions();
2304
2307 }
2308
2310 {
2311 #ifndef SERVER
2313 {
2315
2318 }
2319 #endif
2320 }
2321
2323 {
2324 #ifndef SERVER
2326 {
2330 }
2331 #endif
2332 }
2333
2335 {
2336 return false;
2337 }
2338
2340 {
2342 }
2343
2344 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2345 {
2347
2348 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2350 if ( hasRootAsPlayer )
2352
2353
2354
2355
2356
2357
2358
2360 {
2361
2363 {
2365 {
2369 break;
2370
2374 break;
2375
2379 break;
2380
2384 default:
2387 return;
2388 }
2389
2390
2391 }
2392
2394
2396 {
2398 {
2399
2401 {
2403 }
2405 {
2408 {
2410 }
2411 else
2412 {
2414 {
2416 }
2417 else
2418 {
2420 }
2421 }
2422 }
2423 }
2424 }
2425
2426 }
2428 {
2429
2431 {
2433 {
2437 break;
2438
2442 break;
2443
2447 break;
2448
2452 break;
2453
2456 default:
2459 return;
2460 }
2461 }
2462
2464
2466 {
2468 {
2469
2471 {
2473 }
2474 }
2475 }
2476 }
2478 {
2479
2481 {
2483 {
2487 break;
2488
2491 default:
2494 return;
2495 }
2496 }
2497
2499
2501 {
2503 {
2504
2506 {
2508 }
2509 }
2510 }
2511 }
2512 else
2513 {
2514
2516
2518 {
2521
2522 }
2523 else
2524 {
2526 {
2529 }
2530 }
2531 }
2532 }
2533
2535 {
2536 if (
GetGame().IsDedicatedServer())
2537 return;
2538
2540 {
2542 GetInventory().GetCurrentInventoryLocation(invLoc);
2544 {
2546 if (ptcMgr)
2547 {
2552 }
2553 }
2554 }
2556 {
2558 {
2561 return;
2562 }
2563
2565 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2567 {
2570 }
2571 }
2572 }
2573
2574 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2575 {
2576 super.GetDebugActions(outputList);
2577
2579 {
2583 }
2584 }
2585
2587 {
2588 super.OnAction(action_id, player, ctx);
2589
2591 {
2592 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2593 {
2595 if (food_stage_prev <= 0)
2596 {
2598 }
2600 return true;
2601 }
2602 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2603 {
2606 {
2608 }
2610 return true;
2611 }
2612
2613 }
2614
2615 #ifdef DIAG_DEVELOPER
2616 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2617 {
2618 PrintNutritionsData();
2619 return true;
2620 }
2621 #endif
2622
2623 return false;
2624 }
2625
2627 {
2628 string debug_output;
2629
2630 debug_output = super.GetDebugText();
2631
2634
2635 return debug_output;
2636 }
2637
2638
2639
2640
2641
2643 {
2644 float ret = super.GetBaitEffectivity();
2645
2647 {
2648 ret *= 0.5;
2649 }
2650
2651 return ret;
2652 }
2653
2655 {
2657 }
2658
2660 {
2662 }
2663
2665 {
2667 }
2668
2669 #ifdef DIAG_DEVELOPER
2670 private void PrintNutritionsData()
2671 {
2672 string nutritionsData = "";
2673
2676
2678 if (profile)
2679 {
2680 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2682 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2686 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2688
2691
2692 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2694 }
2695
2696 nutritionsData += "-----\n";
2697
2699 }
2700 #endif
2701
2703
2706 {
2708 }
2709}
2710
2712{
2714};
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.