1852{
1854
1862
1872
1874
1876 {
1878 {
1880
1882 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1883
1887 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1888 }
1889 }
1890
1892 {
1894
1896 }
1897
1899 {
1900 super.EEDelete(parent);
1901
1903
1906 }
1907
1909 {
1910 super.EEItemLocationChanged(oldLoc, newLoc);
1911
1914 {
1915 switch (oldLoc.GetParent().GetType())
1916 {
1917 case "FryingPan":
1918 case "Pot":
1919 case "Cauldron":
1920 case "SharpWoodenStick":
1922 break;
1923 }
1924
1927 {
1929 }
1930 }
1931
1932 if (oldLoc.IsValid())
1934
1937 }
1938
1940 {
1943 }
1944
1946 {
1949
1950 return true;
1951 }
1952
1954 {
1956 {
1958 }
1959 }
1960
1963 {
1964 int foodStageType;
1965
1967 if (foodStage)
1968 foodStageType = foodStage.GetFoodStageType();
1969
1974
1975 return agentsIn;
1976 }
1977
1978
1980 {
1981 return false;
1982 }
1983
1985 {
1986 return false;
1987 }
1988
1990 {
1992 {
1994 {
1997
2000
2001 default:
2002 return super.GetTemperatureFreezeTime();
2003 }
2004 }
2005
2006 return super.GetTemperatureFreezeTime();
2007 }
2008
2010 {
2012 {
2014 {
2017
2020
2021 default:
2022 return super.GetTemperatureThawTime();
2023 }
2024 }
2025
2026 return super.GetTemperatureThawTime();
2027 }
2028
2030 {
2032 }
2033
2034
2035
2036
2038 {
2039 SetSynchDirty();
2040 }
2041
2043 {
2044 super.OnVariablesSynchronized();
2045
2046
2047
2048
2050 {
2052 }
2053 else
2054 {
2056 }
2057
2060 }
2061
2062
2063
2064
2066 {
2069
2071 }
2072
2074 {
2075 string soundName = "";
2076
2079
2081 {
2083 }
2084 else
2085 {
2087 {
2089 {
2094 else
2095 soundName = "";
2096 break;
2097 }
2098
2100 {
2105 else
2106 soundName = "";
2107 break;
2108 }
2109
2111 {
2116 else
2117 soundName = "";
2118 break;
2119 }
2120
2121 default:
2122 soundName = "";
2123 break;
2124 }
2125
2127 {
2128 if (soundName == "")
2129 {
2131 }
2132 else
2133 {
2135 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2136 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2138 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2139 {
2141 }
2142 }
2143 }
2144 }
2145
2147 }
2148
2150 {
2153 }
2154
2155
2156
2157
2159 {
2160 super.OnStoreSave(ctx);
2161
2163 {
2165 }
2166
2167
2170 }
2171
2173 {
2174 if (!super.OnStoreLoad(ctx, version))
2175 return false;
2176
2178 {
2180 return false;
2181 }
2182
2183 if (version >= 115)
2184 {
2186 {
2188 return false;
2189 }
2191 {
2193 return false;
2194 }
2195 }
2196
2199
2200 return true;
2201 }
2202
2204 {
2205 super.AfterStoreLoad();
2206
2208 }
2209
2210
2212 {
2214 }
2215
2216
2218 {
2219 return false;
2220 }
2221
2223 {
2224 return false;
2225 }
2226
2228 {
2229 return false;
2230 }
2231
2233 {
2234 return false;
2235 }
2236
2237
2238
2239
2240
2242 {
2245 {
2246 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2247 }
2248 else if (classname != "" && food_stage)
2249 {
2250 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2251 }
2252 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2253 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2254
2255 }
2256
2258 {
2261 {
2263 }
2264 else if (classname != "" && food_stage)
2265 {
2266 return FoodStage.GetEnergy(null, food_stage, classname);
2267 }
2268 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2269 return g_Game.ConfigGetFloat( class_path +
" energy" );
2270 }
2271
2273 {
2276 {
2278 }
2279 else if (classname != "" && food_stage)
2280 {
2281 return FoodStage.GetWater(null, food_stage, classname);
2282 }
2283 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2284 return g_Game.ConfigGetFloat( class_path +
" water" );
2285 }
2286
2288 {
2291 {
2292 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2293 }
2294 else if (classname != "" && food_stage)
2295 {
2296 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2297 }
2298 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2299 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2300
2301 }
2302
2304 {
2307 {
2308 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2309 }
2310 else if (classname != "" && food_stage)
2311 {
2312 return FoodStage.GetToxicity(null, food_stage, classname);
2313 }
2314 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2315 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2316 }
2317
2319 {
2322 {
2324 }
2325 else if (classname != "" && food_stage)
2326 {
2327 return FoodStage.GetAgents(null, food_stage, classname);
2328 }
2329 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2330 return g_Game.ConfigGetInt( class_path +
" agents" );
2331 }
2332
2334 {
2337 {
2338 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2339 }
2340 else if (classname != "" && food_stage)
2341 {
2342 return FoodStage.GetDigestibility(null, food_stage, classname);
2343 }
2344 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2345 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2346 }
2347
2349 {
2352 {
2353 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2354 }
2355 else if (className != "" && foodStage)
2356 {
2357 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2358 }
2359 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2360 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2361 }
2362
2364 {
2374
2375 return profile;
2376 }
2377
2378
2379
2380
2382 {
2384 }
2385
2386
2388 {
2390 {
2392 }
2393
2394 return false;
2395 }
2396
2398 {
2400 {
2402 }
2403
2404 return false;
2405 }
2406
2408 {
2410 {
2412 }
2413
2414 return false;
2415 }
2416
2418 {
2420 {
2422 }
2423
2424 return false;
2425 }
2426
2428 {
2430 {
2432 }
2433
2434 return false;
2435 }
2436
2438 {
2440 {
2442 }
2443
2444 return false;
2445 }
2446
2447
2449 {
2451 }
2452
2454 {
2455 return GetFoodStage().GetNextFoodStageType( cooking_method );
2456 }
2457
2459 {
2460 return GetFoodStage().GetFoodStageName( food_stage_type );
2461 }
2462
2464 {
2465 return GetFoodStage().CanChangeToNewStage( cooking_method );
2466 }
2467
2468
2470 {
2471 if ( !source.GetFoodStage())
2472 return;
2477 }
2478
2481 {
2484 }
2485
2488 {
2489 switch (stageNew)
2490 {
2495 break;
2496
2499 break;
2500 }
2501 }
2502
2503
2504
2505
2506
2508 {
2510 }
2511
2513 {
2515
2516
2518 }
2519
2521 {
2523 {
2526 }
2527 }
2528
2529
2531 {
2533 if (player)
2534 {
2536 player.ServerReplaceItemInHandsWithNew(lambda);
2537 }
2538 else
2539 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2540 }
2541
2543 {
2545 }
2546
2548 {
2549 super.SetActions();
2550
2553 }
2554
2556 {
2557 #ifndef SERVER
2558 #ifndef NO_GUI
2560 {
2562
2565 }
2566 #endif
2567 #endif
2568 }
2569
2571 {
2572 #ifndef SERVER
2573 #ifndef NO_GUI
2575 {
2579 }
2580 #endif
2581 #endif
2582 }
2583
2585 {
2586 return false;
2587 }
2588
2590 {
2592 }
2593
2594 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2595 {
2597
2598 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2600 if ( hasRootAsPlayer )
2602
2603
2604
2605
2606
2607
2608
2610 {
2611
2613 {
2615 {
2619 break;
2620
2624 break;
2625
2629 break;
2630
2634 default:
2637 return;
2638 }
2639
2640
2641 }
2642
2644
2646 {
2648 {
2649
2651 {
2653 }
2655 {
2658 {
2660 }
2661 else
2662 {
2664 {
2666 }
2667 else
2668 {
2670 }
2671 }
2672 }
2673 }
2674 }
2675
2676 }
2678 {
2679
2681 {
2683 {
2687 break;
2688
2692 break;
2693
2697 break;
2698
2702 break;
2703
2706 default:
2709 return;
2710 }
2711 }
2712
2714
2716 {
2718 {
2719
2721 {
2723 }
2724 }
2725 }
2726 }
2728 {
2729
2731 {
2733 {
2737 break;
2738
2741 default:
2744 return;
2745 }
2746 }
2747
2749
2751 {
2753 {
2754
2756 {
2758 }
2759 }
2760 }
2761 }
2762 else
2763 {
2764
2766
2768 {
2771
2772 }
2773 else
2774 {
2776 {
2779 }
2780 }
2781 }
2782 }
2783
2785 {
2786 if (
g_Game.IsHeadlessOrDedicatedServer())
2787 return;
2788
2790 {
2792 GetInventory().GetCurrentInventoryLocation(invLoc);
2794 {
2796 if (ptcMgr)
2797 {
2802 }
2803 }
2804 }
2806 {
2808 {
2811 return;
2812 }
2813
2815 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2817 {
2820 }
2821 }
2822 }
2823
2824 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2825 {
2827 {
2832 }
2833
2834 super.GetDebugActions(outputList);
2835 }
2836
2838 {
2839 super.OnAction(action_id, player, ctx);
2840
2842 {
2843 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2844 {
2846 if (food_stage_prev <= 0)
2847 {
2849 }
2851 return true;
2852 }
2853 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2854 {
2857 {
2859 }
2861 return true;
2862 }
2863
2864 }
2865
2866 #ifdef DIAG_DEVELOPER
2867 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2868 {
2869 PrintNutritionsData();
2870 return true;
2871 }
2872 #endif
2873
2874 return false;
2875 }
2876
2878 {
2879 string debug_output;
2880
2881 debug_output = super.GetDebugText();
2882
2885
2886 return debug_output;
2887 }
2888
2889
2890
2891
2892
2894 {
2895 float ret = super.GetBaitEffectivity();
2896
2898 {
2899 ret *= 0.5;
2900 }
2901
2902 return ret;
2903 }
2904
2906 {
2908 }
2909
2911 {
2913 }
2914
2916 {
2918 }
2919
2920 #ifdef DIAG_DEVELOPER
2921 private void PrintNutritionsData()
2922 {
2923 string nutritionsData = "";
2924
2927
2929 if (profile)
2930 {
2931 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2933 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2937 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2939
2942
2943 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2945 }
2946
2947 nutritionsData += "-----\n";
2948
2950 }
2951 #endif
2952
2954
2957 {
2959 }
2960}
2961
2963{
2965};
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.