1848{
1850
1858
1868
1870
1872 {
1874 {
1876
1878 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1879
1883 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1884 }
1885 }
1886
1888 {
1890
1892 }
1893
1895 {
1896 super.EEDelete(parent);
1897
1899
1902 }
1903
1905 {
1906 super.EEItemLocationChanged(oldLoc, newLoc);
1907
1910 {
1911 switch (oldLoc.GetParent().GetType())
1912 {
1913 case "FryingPan":
1914 case "Pot":
1915 case "Cauldron":
1916 case "SharpWoodenStick":
1918 break;
1919 }
1920
1923 {
1925 }
1926 }
1927
1928 if (oldLoc.IsValid())
1930
1933 }
1934
1936 {
1939 }
1940
1942 {
1945
1946 return true;
1947 }
1948
1950 {
1952 {
1954 }
1955 }
1956
1959 {
1960 int foodStageType;
1961
1963 if (foodStage)
1964 foodStageType = foodStage.GetFoodStageType();
1965
1970
1971 return agentsIn;
1972 }
1973
1974
1976 {
1977 return false;
1978 }
1979
1981 {
1982 return false;
1983 }
1984
1986 {
1988 {
1990 {
1993
1996
1997 default:
1998 return super.GetTemperatureFreezeTime();
1999 }
2000 }
2001
2002 return super.GetTemperatureFreezeTime();
2003 }
2004
2006 {
2008 {
2010 {
2013
2016
2017 default:
2018 return super.GetTemperatureThawTime();
2019 }
2020 }
2021
2022 return super.GetTemperatureThawTime();
2023 }
2024
2026 {
2028 }
2029
2030
2031
2032
2034 {
2035 SetSynchDirty();
2036 }
2037
2039 {
2040 super.OnVariablesSynchronized();
2041
2042
2043
2044
2046 {
2048 }
2049 else
2050 {
2052 }
2053
2056 }
2057
2058
2059
2060
2062 {
2065
2067 }
2068
2070 {
2071 string soundName = "";
2072
2075
2077 {
2079 }
2080 else
2081 {
2083 {
2085 {
2090 else
2091 soundName = "";
2092 break;
2093 }
2094
2096 {
2101 else
2102 soundName = "";
2103 break;
2104 }
2105
2107 {
2112 else
2113 soundName = "";
2114 break;
2115 }
2116
2117 default:
2118 soundName = "";
2119 break;
2120 }
2121
2123 {
2124 if (soundName == "")
2125 {
2127 }
2128 else
2129 {
2131 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2132 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2134 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2135 {
2137 }
2138 }
2139 }
2140 }
2141
2143 }
2144
2146 {
2149 }
2150
2151
2152
2153
2155 {
2156 super.OnStoreSave(ctx);
2157
2159 {
2161 }
2162
2163
2166 }
2167
2169 {
2170 if (!super.OnStoreLoad(ctx, version))
2171 return false;
2172
2174 {
2176 return false;
2177 }
2178
2179 if (version >= 115)
2180 {
2182 {
2184 return false;
2185 }
2187 {
2189 return false;
2190 }
2191 }
2192
2195
2196 return true;
2197 }
2198
2200 {
2201 super.AfterStoreLoad();
2202
2204 }
2205
2206
2208 {
2210 }
2211
2212
2214 {
2215 return false;
2216 }
2217
2219 {
2220 return false;
2221 }
2222
2224 {
2225 return false;
2226 }
2227
2229 {
2230 return false;
2231 }
2232
2233
2234
2235
2236
2238 {
2241 {
2242 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2243 }
2244 else if (classname != "" && food_stage)
2245 {
2246 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2247 }
2248 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2250
2251 }
2252
2254 {
2257 {
2259 }
2260 else if (classname != "" && food_stage)
2261 {
2262 return FoodStage.GetEnergy(null, food_stage, classname);
2263 }
2264 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2266 }
2267
2269 {
2272 {
2274 }
2275 else if (classname != "" && food_stage)
2276 {
2277 return FoodStage.GetWater(null, food_stage, classname);
2278 }
2279 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2281 }
2282
2284 {
2287 {
2288 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2289 }
2290 else if (classname != "" && food_stage)
2291 {
2292 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2293 }
2294 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2296
2297 }
2298
2300 {
2303 {
2304 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2305 }
2306 else if (classname != "" && food_stage)
2307 {
2308 return FoodStage.GetToxicity(null, food_stage, classname);
2309 }
2310 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2312 }
2313
2315 {
2318 {
2320 }
2321 else if (classname != "" && food_stage)
2322 {
2323 return FoodStage.GetAgents(null, food_stage, classname);
2324 }
2325 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2327 }
2328
2330 {
2333 {
2334 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2335 }
2336 else if (classname != "" && food_stage)
2337 {
2338 return FoodStage.GetDigestibility(null, food_stage, classname);
2339 }
2340 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2342 }
2343
2345 {
2348 {
2349 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2350 }
2351 else if (className != "" && foodStage)
2352 {
2353 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2354 }
2355 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2357 }
2358
2360 {
2370
2371 return profile;
2372 }
2373
2374
2375
2376
2378 {
2380 }
2381
2382
2384 {
2386 {
2388 }
2389
2390 return false;
2391 }
2392
2394 {
2396 {
2398 }
2399
2400 return false;
2401 }
2402
2404 {
2406 {
2408 }
2409
2410 return false;
2411 }
2412
2414 {
2416 {
2418 }
2419
2420 return false;
2421 }
2422
2424 {
2426 {
2428 }
2429
2430 return false;
2431 }
2432
2434 {
2436 {
2438 }
2439
2440 return false;
2441 }
2442
2443
2445 {
2447 }
2448
2450 {
2451 return GetFoodStage().GetNextFoodStageType( cooking_method );
2452 }
2453
2455 {
2456 return GetFoodStage().GetFoodStageName( food_stage_type );
2457 }
2458
2460 {
2461 return GetFoodStage().CanChangeToNewStage( cooking_method );
2462 }
2463
2464
2466 {
2467 if ( !source.GetFoodStage())
2468 return;
2473 }
2474
2477 {
2480 }
2481
2484 {
2485 switch (stageNew)
2486 {
2491 break;
2492
2495 break;
2496 }
2497 }
2498
2499
2500
2501
2502
2504 {
2506 }
2507
2509 {
2511
2512
2514 }
2515
2517 {
2519 {
2522 }
2523 }
2524
2525
2527 {
2529 if (player)
2530 {
2532 player.ServerReplaceItemInHandsWithNew(lambda);
2533 }
2534 else
2535 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2536 }
2537
2539 {
2541 }
2542
2544 {
2545 super.SetActions();
2546
2549 }
2550
2552 {
2553 #ifndef SERVER
2555 {
2557
2560 }
2561 #endif
2562 }
2563
2565 {
2566 #ifndef SERVER
2568 {
2572 }
2573 #endif
2574 }
2575
2577 {
2578 return false;
2579 }
2580
2582 {
2584 }
2585
2586 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2587 {
2589
2590 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2592 if ( hasRootAsPlayer )
2594
2595
2596
2597
2598
2599
2600
2602 {
2603
2605 {
2607 {
2611 break;
2612
2616 break;
2617
2621 break;
2622
2626 default:
2629 return;
2630 }
2631
2632
2633 }
2634
2636
2638 {
2640 {
2641
2643 {
2645 }
2647 {
2650 {
2652 }
2653 else
2654 {
2656 {
2658 }
2659 else
2660 {
2662 }
2663 }
2664 }
2665 }
2666 }
2667
2668 }
2670 {
2671
2673 {
2675 {
2679 break;
2680
2684 break;
2685
2689 break;
2690
2694 break;
2695
2698 default:
2701 return;
2702 }
2703 }
2704
2706
2708 {
2710 {
2711
2713 {
2715 }
2716 }
2717 }
2718 }
2720 {
2721
2723 {
2725 {
2729 break;
2730
2733 default:
2736 return;
2737 }
2738 }
2739
2741
2743 {
2745 {
2746
2748 {
2750 }
2751 }
2752 }
2753 }
2754 else
2755 {
2756
2758
2760 {
2763
2764 }
2765 else
2766 {
2768 {
2771 }
2772 }
2773 }
2774 }
2775
2777 {
2778 if (
GetGame().IsDedicatedServer())
2779 return;
2780
2782 {
2784 GetInventory().GetCurrentInventoryLocation(invLoc);
2786 {
2788 if (ptcMgr)
2789 {
2794 }
2795 }
2796 }
2798 {
2800 {
2803 return;
2804 }
2805
2807 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2809 {
2812 }
2813 }
2814 }
2815
2816 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2817 {
2818 super.GetDebugActions(outputList);
2819
2821 {
2825 }
2826 }
2827
2829 {
2830 super.OnAction(action_id, player, ctx);
2831
2833 {
2834 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2835 {
2837 if (food_stage_prev <= 0)
2838 {
2840 }
2842 return true;
2843 }
2844 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2845 {
2848 {
2850 }
2852 return true;
2853 }
2854
2855 }
2856
2857 #ifdef DIAG_DEVELOPER
2858 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2859 {
2860 PrintNutritionsData();
2861 return true;
2862 }
2863 #endif
2864
2865 return false;
2866 }
2867
2869 {
2870 string debug_output;
2871
2872 debug_output = super.GetDebugText();
2873
2876
2877 return debug_output;
2878 }
2879
2880
2881
2882
2883
2885 {
2886 float ret = super.GetBaitEffectivity();
2887
2889 {
2890 ret *= 0.5;
2891 }
2892
2893 return ret;
2894 }
2895
2897 {
2899 }
2900
2902 {
2904 }
2905
2907 {
2909 }
2910
2911 #ifdef DIAG_DEVELOPER
2912 private void PrintNutritionsData()
2913 {
2914 string nutritionsData = "";
2915
2918
2920 if (profile)
2921 {
2922 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2924 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2928 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2930
2933
2934 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2936 }
2937
2938 nutritionsData += "-----\n";
2939
2941 }
2942 #endif
2943
2945
2948 {
2950 }
2951}
2952
2954{
2956};
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.