1750{
1752
1760
1770
1772
1774 {
1776 {
1778
1780 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1781
1785 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1786 }
1787 }
1788
1790 {
1792
1794 }
1795
1797 {
1798 super.EEDelete(parent);
1799
1801
1804 }
1805
1807 {
1808 super.EEItemLocationChanged(oldLoc, newLoc);
1809
1812 {
1813 switch (oldLoc.GetParent().GetType())
1814 {
1815 case "FryingPan":
1816 case "Pot":
1817 case "Cauldron":
1818 case "SharpWoodenStick":
1820 break;
1821 }
1822
1825 {
1827 }
1828 }
1829
1830 if (oldLoc.IsValid())
1832
1835 }
1836
1838 {
1841 }
1842
1844 {
1847
1848 return true;
1849 }
1850
1852 {
1854 {
1856 }
1857 }
1858
1861 {
1862 int foodStageType;
1863
1865 if (foodStage)
1866 foodStageType = foodStage.GetFoodStageType();
1867
1872
1873 return agentsIn;
1874 }
1875
1876
1878 {
1879 return false;
1880 }
1881
1883 {
1884 return false;
1885 }
1886
1888 {
1890 {
1892 {
1895
1898
1899 default:
1900 return super.GetTemperatureFreezeTime();
1901 }
1902 }
1903
1904 return super.GetTemperatureFreezeTime();
1905 }
1906
1908 {
1910 {
1912 {
1915
1918
1919 default:
1920 return super.GetTemperatureThawTime();
1921 }
1922 }
1923
1924 return super.GetTemperatureThawTime();
1925 }
1926
1928 {
1930 }
1931
1932
1933
1934
1936 {
1937 SetSynchDirty();
1938 }
1939
1941 {
1942 super.OnVariablesSynchronized();
1943
1944
1945
1946
1948 {
1950 }
1951 else
1952 {
1954 }
1955
1958 }
1959
1960
1961
1962
1964 {
1967
1969 }
1970
1972 {
1973 string soundName = "";
1974
1977
1979 {
1981 }
1982 else
1983 {
1985 {
1987 {
1992 else
1993 soundName = "";
1994 break;
1995 }
1996
1998 {
2003 else
2004 soundName = "";
2005 break;
2006 }
2007
2009 {
2014 else
2015 soundName = "";
2016 break;
2017 }
2018
2019 default:
2020 soundName = "";
2021 break;
2022 }
2023
2025 {
2026 if (soundName == "")
2027 {
2029 }
2030 else
2031 {
2033 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2034 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2036 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2037 {
2039 }
2040 }
2041 }
2042 }
2043
2045 }
2046
2048 {
2051 }
2052
2053
2054
2055
2057 {
2058 super.OnStoreSave(ctx);
2059
2061 {
2063 }
2064
2065
2068 }
2069
2071 {
2072 if (!super.OnStoreLoad(ctx, version))
2073 return false;
2074
2076 {
2078 return false;
2079 }
2080
2081 if (version >= 115)
2082 {
2084 {
2086 return false;
2087 }
2089 {
2091 return false;
2092 }
2093 }
2094
2097
2098 return true;
2099 }
2100
2102 {
2103 super.AfterStoreLoad();
2104
2106 }
2107
2108
2110 {
2112 }
2113
2114
2116 {
2117 return false;
2118 }
2119
2121 {
2122 return false;
2123 }
2124
2126 {
2127 return false;
2128 }
2129
2131 {
2132 return false;
2133 }
2134
2135
2136
2137
2138
2140 {
2143 {
2144 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2145 }
2146 else if (classname != "" && food_stage)
2147 {
2148 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2149 }
2150 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2151 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2152
2153 }
2154
2156 {
2159 {
2161 }
2162 else if (classname != "" && food_stage)
2163 {
2164 return FoodStage.GetEnergy(null, food_stage, classname);
2165 }
2166 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2167 return g_Game.ConfigGetFloat( class_path +
" energy" );
2168 }
2169
2171 {
2174 {
2176 }
2177 else if (classname != "" && food_stage)
2178 {
2179 return FoodStage.GetWater(null, food_stage, classname);
2180 }
2181 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2182 return g_Game.ConfigGetFloat( class_path +
" water" );
2183 }
2184
2186 {
2189 {
2190 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2191 }
2192 else if (classname != "" && food_stage)
2193 {
2194 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2195 }
2196 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2197 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2198
2199 }
2200
2202 {
2205 {
2206 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2207 }
2208 else if (classname != "" && food_stage)
2209 {
2210 return FoodStage.GetToxicity(null, food_stage, classname);
2211 }
2212 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2213 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2214 }
2215
2217 {
2220 {
2222 }
2223 else if (classname != "" && food_stage)
2224 {
2225 return FoodStage.GetAgents(null, food_stage, classname);
2226 }
2227 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2228 return g_Game.ConfigGetInt( class_path +
" agents" );
2229 }
2230
2232 {
2235 {
2236 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2237 }
2238 else if (classname != "" && food_stage)
2239 {
2240 return FoodStage.GetDigestibility(null, food_stage, classname);
2241 }
2242 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2243 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2244 }
2245
2247 {
2250 {
2251 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2252 }
2253 else if (className != "" && foodStage)
2254 {
2255 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2256 }
2257 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2258 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2259 }
2260
2262 {
2272
2273 return profile;
2274 }
2275
2276
2277
2278
2280 {
2282 }
2283
2284
2286 {
2288 {
2290 }
2291
2292 return false;
2293 }
2294
2296 {
2298 {
2300 }
2301
2302 return false;
2303 }
2304
2306 {
2308 {
2310 }
2311
2312 return false;
2313 }
2314
2316 {
2318 {
2320 }
2321
2322 return false;
2323 }
2324
2326 {
2328 {
2330 }
2331
2332 return false;
2333 }
2334
2336 {
2338 {
2340 }
2341
2342 return false;
2343 }
2344
2345
2347 {
2349 }
2350
2352 {
2353 return GetFoodStage().GetNextFoodStageType( cooking_method );
2354 }
2355
2357 {
2358 return GetFoodStage().GetFoodStageName( food_stage_type );
2359 }
2360
2362 {
2363 return GetFoodStage().CanChangeToNewStage( cooking_method );
2364 }
2365
2366
2368 {
2369 if ( !source.GetFoodStage())
2370 return;
2375 }
2376
2379 {
2382 }
2383
2386 {
2387 switch (stageNew)
2388 {
2393 break;
2394
2397 break;
2398 }
2399 }
2400
2401
2402
2403
2404
2406 {
2408 }
2409
2411 {
2413
2414
2416 }
2417
2419 {
2421 {
2424 }
2425 }
2426
2427
2429 {
2431 if (player)
2432 {
2434 player.ServerReplaceItemInHandsWithNew(lambda);
2435 }
2436 else
2437 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2438 }
2439
2441 {
2443 }
2444
2446 {
2447 super.SetActions();
2448
2451 }
2452
2454 {
2455 #ifndef SERVER
2456 #ifndef NO_GUI
2458 {
2460
2463 }
2464 #endif
2465 #endif
2466 }
2467
2469 {
2470 #ifndef SERVER
2471 #ifndef NO_GUI
2473 {
2477 }
2478 #endif
2479 #endif
2480 }
2481
2483 {
2484 return false;
2485 }
2486
2488 {
2490 }
2491
2492 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2493 {
2495
2496 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2498 if ( hasRootAsPlayer )
2500
2501
2502
2503
2504
2505
2506
2508 {
2509
2511 {
2513 {
2517 break;
2518
2522 break;
2523
2527 break;
2528
2532 default:
2535 return;
2536 }
2537
2538
2539 }
2540
2542
2544 {
2546 {
2547
2549 {
2551 }
2553 {
2556 {
2558 }
2559 else
2560 {
2562 {
2564 }
2565 else
2566 {
2568 }
2569 }
2570 }
2571 }
2572 }
2573
2574 }
2576 {
2577
2579 {
2581 {
2585 break;
2586
2590 break;
2591
2595 break;
2596
2600 break;
2601
2604 default:
2607 return;
2608 }
2609 }
2610
2612
2614 {
2616 {
2617
2619 {
2621 }
2622 }
2623 }
2624 }
2626 {
2627
2629 {
2631 {
2635 break;
2636
2639 default:
2642 return;
2643 }
2644 }
2645
2647
2649 {
2651 {
2652
2654 {
2656 }
2657 }
2658 }
2659 }
2660 else
2661 {
2662
2664
2666 {
2669
2670 }
2671 else
2672 {
2674 {
2677 }
2678 }
2679 }
2680 }
2681
2683 {
2684 if (
g_Game.IsHeadlessOrDedicatedServer())
2685 return;
2686
2688 {
2690 GetInventory().GetCurrentInventoryLocation(invLoc);
2692 {
2694 if (ptcMgr)
2695 {
2700 }
2701 }
2702 }
2704 {
2706 {
2709 return;
2710 }
2711
2713 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2715 {
2718 }
2719 }
2720 }
2721
2722 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2723 {
2725 {
2730 }
2731
2732 super.GetDebugActions(outputList);
2733 }
2734
2736 {
2737 super.OnAction(action_id, player, ctx);
2738
2740 {
2741 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2742 {
2744 if (food_stage_prev <= 0)
2745 {
2747 }
2749 return true;
2750 }
2751 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2752 {
2755 {
2757 }
2759 return true;
2760 }
2761
2762 }
2763
2764 #ifdef DIAG_DEVELOPER
2765 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2766 {
2767 PrintNutritionsData();
2768 return true;
2769 }
2770 #endif
2771
2772 return false;
2773 }
2774
2776 {
2777 string debug_output;
2778
2779 debug_output = super.GetDebugText();
2780
2783
2784 return debug_output;
2785 }
2786
2787
2788
2789
2790
2792 {
2793 float ret = super.GetBaitEffectivity();
2794
2796 {
2797 ret *= 0.5;
2798 }
2799
2800 return ret;
2801 }
2802
2804 {
2806 }
2807
2809 {
2811 }
2812
2814 {
2816 }
2817
2818 #ifdef DIAG_DEVELOPER
2819 private void PrintNutritionsData()
2820 {
2821 string nutritionsData = "";
2822
2825
2827 if (profile)
2828 {
2829 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2831 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2835 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2837
2840
2841 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2843 }
2844
2845 nutritionsData += "-----\n";
2846
2848 }
2849 #endif
2850
2852
2855 {
2857 }
2858}
2859
2861{
2863};
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.