1732{
1734
1742
1752
1754
1756 {
1758 {
1760
1762 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1763
1767 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1768 }
1769 }
1770
1772 {
1774
1776 }
1777
1779 {
1780 super.EEDelete(parent);
1781
1783
1786 }
1787
1789 {
1790 super.EEItemLocationChanged(oldLoc, newLoc);
1791
1794 {
1795 switch (oldLoc.GetParent().GetType())
1796 {
1797 case "FryingPan":
1798 case "Pot":
1799 case "Cauldron":
1800 case "SharpWoodenStick":
1802 break;
1803 }
1804
1807 {
1809 }
1810 }
1811
1812 if (oldLoc.IsValid())
1814
1817 }
1818
1820 {
1823 }
1824
1826 {
1829
1830 return true;
1831 }
1832
1834 {
1836 {
1838 }
1839 }
1840
1843 {
1844 int foodStageType;
1845
1847 if (foodStage)
1848 foodStageType = foodStage.GetFoodStageType();
1849
1854
1855 return agentsIn;
1856 }
1857
1858
1860 {
1861 return false;
1862 }
1863
1865 {
1866 return false;
1867 }
1868
1870 {
1872 {
1874 {
1877
1880
1881 default:
1882 return super.GetTemperatureFreezeTime();
1883 }
1884 }
1885
1886 return super.GetTemperatureFreezeTime();
1887 }
1888
1890 {
1892 {
1894 {
1897
1900
1901 default:
1902 return super.GetTemperatureThawTime();
1903 }
1904 }
1905
1906 return super.GetTemperatureThawTime();
1907 }
1908
1910 {
1912 }
1913
1914
1915
1916
1918 {
1919 SetSynchDirty();
1920 }
1921
1923 {
1924 super.OnVariablesSynchronized();
1925
1926
1927
1928
1930 {
1932 }
1933 else
1934 {
1936 }
1937
1940 }
1941
1942
1943
1944
1946 {
1949
1951 }
1952
1954 {
1955 string soundName = "";
1956
1959
1961 {
1963 }
1964 else
1965 {
1967 {
1969 {
1974 else
1975 soundName = "";
1976 break;
1977 }
1978
1980 {
1985 else
1986 soundName = "";
1987 break;
1988 }
1989
1991 {
1996 else
1997 soundName = "";
1998 break;
1999 }
2000
2001 default:
2002 soundName = "";
2003 break;
2004 }
2005
2007 {
2008 if (soundName == "")
2009 {
2011 }
2012 else
2013 {
2015 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2016 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2018 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2019 {
2021 }
2022 }
2023 }
2024 }
2025
2027 }
2028
2030 {
2033 }
2034
2035
2036
2037
2039 {
2040 super.OnStoreSave(ctx);
2041
2043 {
2045 }
2046
2047
2050 }
2051
2053 {
2054 if (!super.OnStoreLoad(ctx, version))
2055 return false;
2056
2058 {
2060 return false;
2061 }
2062
2063 if (version >= 115)
2064 {
2066 {
2068 return false;
2069 }
2071 {
2073 return false;
2074 }
2075 }
2076
2079
2080 return true;
2081 }
2082
2084 {
2085 super.AfterStoreLoad();
2086
2088 }
2089
2090
2092 {
2094 }
2095
2096
2098 {
2099 return false;
2100 }
2101
2103 {
2104 return false;
2105 }
2106
2108 {
2109 return false;
2110 }
2111
2113 {
2114 return false;
2115 }
2116
2117
2118
2119
2120
2122 {
2125 {
2126 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2127 }
2128 else if (classname != "" && food_stage)
2129 {
2130 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2131 }
2132 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2133 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2134
2135 }
2136
2138 {
2141 {
2143 }
2144 else if (classname != "" && food_stage)
2145 {
2146 return FoodStage.GetEnergy(null, food_stage, classname);
2147 }
2148 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2149 return g_Game.ConfigGetFloat( class_path +
" energy" );
2150 }
2151
2153 {
2156 {
2158 }
2159 else if (classname != "" && food_stage)
2160 {
2161 return FoodStage.GetWater(null, food_stage, classname);
2162 }
2163 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2164 return g_Game.ConfigGetFloat( class_path +
" water" );
2165 }
2166
2168 {
2171 {
2172 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2173 }
2174 else if (classname != "" && food_stage)
2175 {
2176 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2177 }
2178 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2179 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2180
2181 }
2182
2184 {
2187 {
2188 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2189 }
2190 else if (classname != "" && food_stage)
2191 {
2192 return FoodStage.GetToxicity(null, food_stage, classname);
2193 }
2194 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2195 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2196 }
2197
2199 {
2202 {
2204 }
2205 else if (classname != "" && food_stage)
2206 {
2207 return FoodStage.GetAgents(null, food_stage, classname);
2208 }
2209 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2210 return g_Game.ConfigGetInt( class_path +
" agents" );
2211 }
2212
2214 {
2217 {
2218 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2219 }
2220 else if (classname != "" && food_stage)
2221 {
2222 return FoodStage.GetDigestibility(null, food_stage, classname);
2223 }
2224 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2225 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2226 }
2227
2229 {
2232 {
2233 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2234 }
2235 else if (className != "" && foodStage)
2236 {
2237 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2238 }
2239 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2240 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2241 }
2242
2244 {
2254
2255 return profile;
2256 }
2257
2258
2259
2260
2262 {
2264 }
2265
2266
2268 {
2270 {
2272 }
2273
2274 return false;
2275 }
2276
2278 {
2280 {
2282 }
2283
2284 return false;
2285 }
2286
2288 {
2290 {
2292 }
2293
2294 return false;
2295 }
2296
2298 {
2300 {
2302 }
2303
2304 return false;
2305 }
2306
2308 {
2310 {
2312 }
2313
2314 return false;
2315 }
2316
2318 {
2320 {
2322 }
2323
2324 return false;
2325 }
2326
2327
2329 {
2331 }
2332
2334 {
2335 return GetFoodStage().GetNextFoodStageType( cooking_method );
2336 }
2337
2339 {
2340 return GetFoodStage().GetFoodStageName( food_stage_type );
2341 }
2342
2344 {
2345 return GetFoodStage().CanChangeToNewStage( cooking_method );
2346 }
2347
2348
2350 {
2351 if ( !source.GetFoodStage())
2352 return;
2357 }
2358
2361 {
2364 }
2365
2368 {
2369 switch (stageNew)
2370 {
2375 break;
2376
2379 break;
2380 }
2381 }
2382
2383
2384
2385
2386
2388 {
2390 }
2391
2393 {
2395
2396
2398 }
2399
2401 {
2403 {
2406 }
2407 }
2408
2409
2411 {
2413 if (player)
2414 {
2416 player.ServerReplaceItemInHandsWithNew(lambda);
2417 }
2418 else
2419 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2420 }
2421
2423 {
2425 }
2426
2428 {
2429 super.SetActions();
2430
2433 }
2434
2436 {
2437 #ifndef SERVER
2438 #ifndef NO_GUI
2440 {
2442
2445 }
2446 #endif
2447 #endif
2448 }
2449
2451 {
2452 #ifndef SERVER
2453 #ifndef NO_GUI
2455 {
2459 }
2460 #endif
2461 #endif
2462 }
2463
2465 {
2466 return false;
2467 }
2468
2470 {
2472 }
2473
2474 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2475 {
2477
2478 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2480 if ( hasRootAsPlayer )
2482
2483
2484
2485
2486
2487
2488
2490 {
2491
2493 {
2495 {
2499 break;
2500
2504 break;
2505
2509 break;
2510
2514 default:
2517 return;
2518 }
2519
2520
2521 }
2522
2524
2526 {
2528 {
2529
2531 {
2533 }
2535 {
2538 {
2540 }
2541 else
2542 {
2544 {
2546 }
2547 else
2548 {
2550 }
2551 }
2552 }
2553 }
2554 }
2555
2556 }
2558 {
2559
2561 {
2563 {
2567 break;
2568
2572 break;
2573
2577 break;
2578
2582 break;
2583
2586 default:
2589 return;
2590 }
2591 }
2592
2594
2596 {
2598 {
2599
2601 {
2603 }
2604 }
2605 }
2606 }
2608 {
2609
2611 {
2613 {
2617 break;
2618
2621 default:
2624 return;
2625 }
2626 }
2627
2629
2631 {
2633 {
2634
2636 {
2638 }
2639 }
2640 }
2641 }
2642 else
2643 {
2644
2646
2648 {
2651
2652 }
2653 else
2654 {
2656 {
2659 }
2660 }
2661 }
2662 }
2663
2665 {
2666 if (
g_Game.IsHeadlessOrDedicatedServer())
2667 return;
2668
2670 {
2672 GetInventory().GetCurrentInventoryLocation(invLoc);
2674 {
2676 if (ptcMgr)
2677 {
2682 }
2683 }
2684 }
2686 {
2688 {
2691 return;
2692 }
2693
2695 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2697 {
2700 }
2701 }
2702 }
2703
2704 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2705 {
2707 {
2712 }
2713
2714 super.GetDebugActions(outputList);
2715 }
2716
2718 {
2719 super.OnAction(action_id, player, ctx);
2720
2722 {
2723 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2724 {
2726 if (food_stage_prev <= 0)
2727 {
2729 }
2731 return true;
2732 }
2733 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2734 {
2737 {
2739 }
2741 return true;
2742 }
2743
2744 }
2745
2746 #ifdef DIAG_DEVELOPER
2747 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2748 {
2749 PrintNutritionsData();
2750 return true;
2751 }
2752 #endif
2753
2754 return false;
2755 }
2756
2758 {
2759 string debug_output;
2760
2761 debug_output = super.GetDebugText();
2762
2765
2766 return debug_output;
2767 }
2768
2769
2770
2771
2772
2774 {
2775 float ret = super.GetBaitEffectivity();
2776
2778 {
2779 ret *= 0.5;
2780 }
2781
2782 return ret;
2783 }
2784
2786 {
2788 }
2789
2791 {
2793 }
2794
2796 {
2798 }
2799
2800 #ifdef DIAG_DEVELOPER
2801 private void PrintNutritionsData()
2802 {
2803 string nutritionsData = "";
2804
2807
2809 if (profile)
2810 {
2811 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2813 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2817 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2819
2822
2823 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2825 }
2826
2827 nutritionsData += "-----\n";
2828
2830 }
2831 #endif
2832
2834
2837 {
2839 }
2840}
2841
2843{
2845};
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.