1793{
1795
1803
1813
1815
1817 {
1819 {
1821
1823 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1824
1828 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1829 }
1830 }
1831
1833 {
1835
1837 }
1838
1840 {
1841 super.EEDelete(parent);
1842
1844
1847 }
1848
1850 {
1851 super.EEItemLocationChanged(oldLoc, newLoc);
1852
1855 {
1856 switch (oldLoc.GetParent().GetType())
1857 {
1858 case "FryingPan":
1859 case "Pot":
1860 case "Cauldron":
1861 case "SharpWoodenStick":
1863 break;
1864 }
1865
1868 {
1870 }
1871 }
1872
1873 if (oldLoc.IsValid())
1875
1878 }
1879
1881 {
1884 }
1885
1887 {
1890
1891 return true;
1892 }
1893
1895 {
1897 {
1899 }
1900 }
1901
1904 {
1905 int foodStageType;
1906
1908 if (foodStage)
1909 foodStageType = foodStage.GetFoodStageType();
1910
1915
1916 return agentsIn;
1917 }
1918
1919
1921 {
1922 return false;
1923 }
1924
1926 {
1927 return false;
1928 }
1929
1931 {
1933 {
1935 {
1938
1941
1942 default:
1943 return super.GetTemperatureFreezeTime();
1944 }
1945 }
1946
1947 return super.GetTemperatureFreezeTime();
1948 }
1949
1951 {
1953 {
1955 {
1958
1961
1962 default:
1963 return super.GetTemperatureThawTime();
1964 }
1965 }
1966
1967 return super.GetTemperatureThawTime();
1968 }
1969
1971 {
1973 }
1974
1975
1976
1977
1979 {
1980 SetSynchDirty();
1981 }
1982
1984 {
1985 super.OnVariablesSynchronized();
1986
1987
1988
1989
1991 {
1993 }
1994 else
1995 {
1997 }
1998
2001 }
2002
2003
2004
2005
2007 {
2010
2012 }
2013
2015 {
2016 string soundName = "";
2017
2020
2022 {
2024 }
2025 else
2026 {
2028 {
2030 {
2035 else
2036 soundName = "";
2037 break;
2038 }
2039
2041 {
2046 else
2047 soundName = "";
2048 break;
2049 }
2050
2052 {
2057 else
2058 soundName = "";
2059 break;
2060 }
2061
2062 default:
2063 soundName = "";
2064 break;
2065 }
2066
2068 {
2069 if (soundName == "")
2070 {
2072 }
2073 else
2074 {
2076 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2077 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2079 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2080 {
2082 }
2083 }
2084 }
2085 }
2086
2088 }
2089
2091 {
2094 }
2095
2096
2097
2098
2100 {
2101 super.OnStoreSave(ctx);
2102
2104 {
2106 }
2107
2108
2111 }
2112
2114 {
2115 if (!super.OnStoreLoad(ctx, version))
2116 return false;
2117
2119 {
2121 return false;
2122 }
2123
2124 if (version >= 115)
2125 {
2127 {
2129 return false;
2130 }
2132 {
2134 return false;
2135 }
2136 }
2137
2140
2141 return true;
2142 }
2143
2145 {
2146 super.AfterStoreLoad();
2147
2149 }
2150
2151
2153 {
2155 }
2156
2157
2159 {
2160 return false;
2161 }
2162
2164 {
2165 return false;
2166 }
2167
2169 {
2170 return false;
2171 }
2172
2174 {
2175 return false;
2176 }
2177
2178
2179
2180
2181
2183 {
2186 {
2187 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2188 }
2189 else if (classname != "" && food_stage)
2190 {
2191 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2192 }
2193 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2194 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2195
2196 }
2197
2199 {
2202 {
2204 }
2205 else if (classname != "" && food_stage)
2206 {
2207 return FoodStage.GetEnergy(null, food_stage, classname);
2208 }
2209 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2210 return g_Game.ConfigGetFloat( class_path +
" energy" );
2211 }
2212
2214 {
2217 {
2219 }
2220 else if (classname != "" && food_stage)
2221 {
2222 return FoodStage.GetWater(null, food_stage, classname);
2223 }
2224 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2225 return g_Game.ConfigGetFloat( class_path +
" water" );
2226 }
2227
2229 {
2232 {
2233 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2234 }
2235 else if (classname != "" && food_stage)
2236 {
2237 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2238 }
2239 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2240 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2241
2242 }
2243
2245 {
2248 {
2249 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2250 }
2251 else if (classname != "" && food_stage)
2252 {
2253 return FoodStage.GetToxicity(null, food_stage, classname);
2254 }
2255 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2256 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2257 }
2258
2260 {
2263 {
2265 }
2266 else if (classname != "" && food_stage)
2267 {
2268 return FoodStage.GetAgents(null, food_stage, classname);
2269 }
2270 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2271 return g_Game.ConfigGetInt( class_path +
" agents" );
2272 }
2273
2275 {
2278 {
2279 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2280 }
2281 else if (classname != "" && food_stage)
2282 {
2283 return FoodStage.GetDigestibility(null, food_stage, classname);
2284 }
2285 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2286 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2287 }
2288
2290 {
2293 {
2294 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2295 }
2296 else if (className != "" && foodStage)
2297 {
2298 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2299 }
2300 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2301 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2302 }
2303
2305 {
2315
2316 return profile;
2317 }
2318
2319
2320
2321
2323 {
2325 }
2326
2327
2329 {
2331 {
2333 }
2334
2335 return false;
2336 }
2337
2339 {
2341 {
2343 }
2344
2345 return false;
2346 }
2347
2349 {
2351 {
2353 }
2354
2355 return false;
2356 }
2357
2359 {
2361 {
2363 }
2364
2365 return false;
2366 }
2367
2369 {
2371 {
2373 }
2374
2375 return false;
2376 }
2377
2379 {
2381 {
2383 }
2384
2385 return false;
2386 }
2387
2388
2390 {
2392 }
2393
2395 {
2396 return GetFoodStage().GetNextFoodStageType( cooking_method );
2397 }
2398
2400 {
2401 return GetFoodStage().GetFoodStageName( food_stage_type );
2402 }
2403
2405 {
2406 return GetFoodStage().CanChangeToNewStage( cooking_method );
2407 }
2408
2409
2411 {
2412 if ( !source.GetFoodStage())
2413 return;
2418 }
2419
2422 {
2425 }
2426
2429 {
2430 switch (stageNew)
2431 {
2436 break;
2437
2440 break;
2441 }
2442 }
2443
2444
2445
2446
2447
2449 {
2451 }
2452
2454 {
2456
2457
2459 }
2460
2462 {
2464 {
2467 }
2468 }
2469
2470
2472 {
2474 if (player)
2475 {
2477 player.ServerReplaceItemInHandsWithNew(lambda);
2478 }
2479 else
2480 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2481 }
2482
2484 {
2486 }
2487
2489 {
2490 super.SetActions();
2491
2494 }
2495
2497 {
2498 #ifndef SERVER
2499 #ifndef NO_GUI
2501 {
2503
2506 }
2507 #endif
2508 #endif
2509 }
2510
2512 {
2513 #ifndef SERVER
2514 #ifndef NO_GUI
2516 {
2520 }
2521 #endif
2522 #endif
2523 }
2524
2526 {
2527 return false;
2528 }
2529
2531 {
2533 }
2534
2535 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2536 {
2538
2539 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2541 if ( hasRootAsPlayer )
2543
2544
2545
2546
2547
2548
2549
2551 {
2552
2554 {
2556 {
2560 break;
2561
2565 break;
2566
2570 break;
2571
2575 default:
2578 return;
2579 }
2580
2581
2582 }
2583
2585
2587 {
2589 {
2590
2592 {
2594 }
2596 {
2599 {
2601 }
2602 else
2603 {
2605 {
2607 }
2608 else
2609 {
2611 }
2612 }
2613 }
2614 }
2615 }
2616
2617 }
2619 {
2620
2622 {
2624 {
2628 break;
2629
2633 break;
2634
2638 break;
2639
2643 break;
2644
2647 default:
2650 return;
2651 }
2652 }
2653
2655
2657 {
2659 {
2660
2662 {
2664 }
2665 }
2666 }
2667 }
2669 {
2670
2672 {
2674 {
2678 break;
2679
2682 default:
2685 return;
2686 }
2687 }
2688
2690
2692 {
2694 {
2695
2697 {
2699 }
2700 }
2701 }
2702 }
2703 else
2704 {
2705
2707
2709 {
2712
2713 }
2714 else
2715 {
2717 {
2720 }
2721 }
2722 }
2723 }
2724
2726 {
2727 if (
g_Game.IsHeadlessOrDedicatedServer())
2728 return;
2729
2731 {
2733 GetInventory().GetCurrentInventoryLocation(invLoc);
2735 {
2737 if (ptcMgr)
2738 {
2743 }
2744 }
2745 }
2747 {
2749 {
2752 return;
2753 }
2754
2756 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2758 {
2761 }
2762 }
2763 }
2764
2765 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2766 {
2768 {
2773 }
2774
2775 super.GetDebugActions(outputList);
2776 }
2777
2779 {
2780 super.OnAction(action_id, player, ctx);
2781
2783 {
2784 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2785 {
2787 if (food_stage_prev <= 0)
2788 {
2790 }
2792 return true;
2793 }
2794 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2795 {
2798 {
2800 }
2802 return true;
2803 }
2804
2805 }
2806
2807 #ifdef DIAG_DEVELOPER
2808 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2809 {
2810 PrintNutritionsData();
2811 return true;
2812 }
2813 #endif
2814
2815 return false;
2816 }
2817
2819 {
2820 string debug_output;
2821
2822 debug_output = super.GetDebugText();
2823
2826
2827 return debug_output;
2828 }
2829
2830
2831
2832
2833
2835 {
2836 float ret = super.GetBaitEffectivity();
2837
2839 {
2840 ret *= 0.5;
2841 }
2842
2843 return ret;
2844 }
2845
2847 {
2849 }
2850
2852 {
2854 }
2855
2857 {
2859 }
2860
2861 #ifdef DIAG_DEVELOPER
2862 private void PrintNutritionsData()
2863 {
2864 string nutritionsData = "";
2865
2868
2870 if (profile)
2871 {
2872 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2874 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2878 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2880
2883
2884 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2886 }
2887
2888 nutritionsData += "-----\n";
2889
2891 }
2892 #endif
2893
2895
2898 {
2900 }
2901}
2902
2904{
2906};
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.