1800{
1802
1810
1820
1822
1824 {
1826 {
1828
1830 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1831
1835 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1836 }
1837 }
1838
1840 {
1842
1844 }
1845
1847 {
1848 super.EEDelete(parent);
1849
1851
1854 }
1855
1857 {
1858 super.EEItemLocationChanged(oldLoc, newLoc);
1859
1862 {
1863 switch (oldLoc.GetParent().GetType())
1864 {
1865 case "FryingPan":
1866 case "Pot":
1867 case "Cauldron":
1868 case "SharpWoodenStick":
1870 break;
1871 }
1872
1875 {
1877 }
1878 }
1879
1880 if (oldLoc.IsValid())
1882
1885 }
1886
1888 {
1891 }
1892
1894 {
1897
1898 return true;
1899 }
1900
1902 {
1904 {
1906 }
1907 }
1908
1911 {
1912 int foodStageType;
1913
1915 if (foodStage)
1916 foodStageType = foodStage.GetFoodStageType();
1917
1922
1923 return agentsIn;
1924 }
1925
1926
1928 {
1929 return false;
1930 }
1931
1933 {
1934 return false;
1935 }
1936
1938 {
1940 {
1942 {
1945
1948
1949 default:
1950 return super.GetTemperatureFreezeTime();
1951 }
1952 }
1953
1954 return super.GetTemperatureFreezeTime();
1955 }
1956
1958 {
1960 {
1962 {
1965
1968
1969 default:
1970 return super.GetTemperatureThawTime();
1971 }
1972 }
1973
1974 return super.GetTemperatureThawTime();
1975 }
1976
1978 {
1980 }
1981
1982
1983
1984
1986 {
1987 SetSynchDirty();
1988 }
1989
1991 {
1992 super.OnVariablesSynchronized();
1993
1994
1995
1996
1998 {
2000 }
2001 else
2002 {
2004 }
2005
2008 }
2009
2010
2011
2012
2014 {
2017
2019 }
2020
2022 {
2023 string soundName = "";
2024
2027
2029 {
2031 }
2032 else
2033 {
2035 {
2037 {
2042 else
2043 soundName = "";
2044 break;
2045 }
2046
2048 {
2053 else
2054 soundName = "";
2055 break;
2056 }
2057
2059 {
2064 else
2065 soundName = "";
2066 break;
2067 }
2068
2069 default:
2070 soundName = "";
2071 break;
2072 }
2073
2075 {
2076 if (soundName == "")
2077 {
2079 }
2080 else
2081 {
2083 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2084 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2086 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2087 {
2089 }
2090 }
2091 }
2092 }
2093
2095 }
2096
2098 {
2101 }
2102
2103
2104
2105
2107 {
2108 super.OnStoreSave(ctx);
2109
2111 {
2113 }
2114
2115
2118 }
2119
2121 {
2122 if (!super.OnStoreLoad(ctx, version))
2123 return false;
2124
2126 {
2128 return false;
2129 }
2130
2131 if (version >= 115)
2132 {
2134 {
2136 return false;
2137 }
2139 {
2141 return false;
2142 }
2143 }
2144
2147
2148 return true;
2149 }
2150
2152 {
2153 super.AfterStoreLoad();
2154
2156 }
2157
2158
2160 {
2162 }
2163
2164
2166 {
2167 return false;
2168 }
2169
2171 {
2172 return false;
2173 }
2174
2176 {
2177 return false;
2178 }
2179
2181 {
2182 return false;
2183 }
2184
2185
2186
2187
2188
2190 {
2193 {
2194 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2195 }
2196 else if (classname != "" && food_stage)
2197 {
2198 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2199 }
2200 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2202
2203 }
2204
2206 {
2209 {
2211 }
2212 else if (classname != "" && food_stage)
2213 {
2214 return FoodStage.GetEnergy(null, food_stage, classname);
2215 }
2216 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2218 }
2219
2221 {
2224 {
2226 }
2227 else if (classname != "" && food_stage)
2228 {
2229 return FoodStage.GetWater(null, food_stage, classname);
2230 }
2231 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2233 }
2234
2236 {
2239 {
2240 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2241 }
2242 else if (classname != "" && food_stage)
2243 {
2244 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2245 }
2246 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2248
2249 }
2250
2252 {
2255 {
2256 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2257 }
2258 else if (classname != "" && food_stage)
2259 {
2260 return FoodStage.GetToxicity(null, food_stage, classname);
2261 }
2262 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2264 }
2265
2267 {
2270 {
2272 }
2273 else if (classname != "" && food_stage)
2274 {
2275 return FoodStage.GetAgents(null, food_stage, classname);
2276 }
2277 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2279 }
2280
2282 {
2285 {
2286 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2287 }
2288 else if (classname != "" && food_stage)
2289 {
2290 return FoodStage.GetDigestibility(null, food_stage, classname);
2291 }
2292 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2294 }
2295
2297 {
2300 {
2301 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2302 }
2303 else if (className != "" && foodStage)
2304 {
2305 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2306 }
2307 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2309 }
2310
2312 {
2322
2323 return profile;
2324 }
2325
2326
2327
2328
2330 {
2332 }
2333
2334
2336 {
2338 {
2340 }
2341
2342 return false;
2343 }
2344
2346 {
2348 {
2350 }
2351
2352 return false;
2353 }
2354
2356 {
2358 {
2360 }
2361
2362 return false;
2363 }
2364
2366 {
2368 {
2370 }
2371
2372 return false;
2373 }
2374
2376 {
2378 {
2380 }
2381
2382 return false;
2383 }
2384
2386 {
2388 {
2390 }
2391
2392 return false;
2393 }
2394
2395
2397 {
2399 }
2400
2402 {
2403 return GetFoodStage().GetNextFoodStageType( cooking_method );
2404 }
2405
2407 {
2408 return GetFoodStage().GetFoodStageName( food_stage_type );
2409 }
2410
2412 {
2413 return GetFoodStage().CanChangeToNewStage( cooking_method );
2414 }
2415
2416
2418 {
2419 if ( !source.GetFoodStage())
2420 return;
2425 }
2426
2429 {
2432 }
2433
2436 {
2437 switch (stageNew)
2438 {
2443 break;
2444
2447 break;
2448 }
2449 }
2450
2451
2452
2453
2454
2456 {
2458 }
2459
2461 {
2463
2464
2466 }
2467
2469 {
2471 {
2474 }
2475 }
2476
2477
2479 {
2481 if (player)
2482 {
2484 player.ServerReplaceItemInHandsWithNew(lambda);
2485 }
2486 else
2487 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2488 }
2489
2491 {
2493 }
2494
2496 {
2497 super.SetActions();
2498
2501 }
2502
2504 {
2505 #ifndef SERVER
2507 {
2509
2512 }
2513 #endif
2514 }
2515
2517 {
2518 #ifndef SERVER
2520 {
2524 }
2525 #endif
2526 }
2527
2529 {
2530 return false;
2531 }
2532
2534 {
2536 }
2537
2538 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2539 {
2541
2542 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2544 if ( hasRootAsPlayer )
2546
2547
2548
2549
2550
2551
2552
2554 {
2555
2557 {
2559 {
2563 break;
2564
2568 break;
2569
2573 break;
2574
2578 default:
2581 return;
2582 }
2583
2584
2585 }
2586
2588
2590 {
2592 {
2593
2595 {
2597 }
2599 {
2602 {
2604 }
2605 else
2606 {
2608 {
2610 }
2611 else
2612 {
2614 }
2615 }
2616 }
2617 }
2618 }
2619
2620 }
2622 {
2623
2625 {
2627 {
2631 break;
2632
2636 break;
2637
2641 break;
2642
2646 break;
2647
2650 default:
2653 return;
2654 }
2655 }
2656
2658
2660 {
2662 {
2663
2665 {
2667 }
2668 }
2669 }
2670 }
2672 {
2673
2675 {
2677 {
2681 break;
2682
2685 default:
2688 return;
2689 }
2690 }
2691
2693
2695 {
2697 {
2698
2700 {
2702 }
2703 }
2704 }
2705 }
2706 else
2707 {
2708
2710
2712 {
2715
2716 }
2717 else
2718 {
2720 {
2723 }
2724 }
2725 }
2726 }
2727
2729 {
2730 if (
GetGame().IsDedicatedServer())
2731 return;
2732
2734 {
2736 GetInventory().GetCurrentInventoryLocation(invLoc);
2738 {
2740 if (ptcMgr)
2741 {
2746 }
2747 }
2748 }
2750 {
2752 {
2755 return;
2756 }
2757
2759 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2761 {
2764 }
2765 }
2766 }
2767
2768 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2769 {
2770 super.GetDebugActions(outputList);
2771
2773 {
2777 }
2778 }
2779
2781 {
2782 super.OnAction(action_id, player, ctx);
2783
2785 {
2786 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2787 {
2789 if (food_stage_prev <= 0)
2790 {
2792 }
2794 return true;
2795 }
2796 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2797 {
2800 {
2802 }
2804 return true;
2805 }
2806
2807 }
2808
2809 #ifdef DIAG_DEVELOPER
2810 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2811 {
2812 PrintNutritionsData();
2813 return true;
2814 }
2815 #endif
2816
2817 return false;
2818 }
2819
2821 {
2822 string debug_output;
2823
2824 debug_output = super.GetDebugText();
2825
2828
2829 return debug_output;
2830 }
2831
2832
2833
2834
2835
2837 {
2838 float ret = super.GetBaitEffectivity();
2839
2841 {
2842 ret *= 0.5;
2843 }
2844
2845 return ret;
2846 }
2847
2849 {
2851 }
2852
2854 {
2856 }
2857
2859 {
2861 }
2862
2863 #ifdef DIAG_DEVELOPER
2864 private void PrintNutritionsData()
2865 {
2866 string nutritionsData = "";
2867
2870
2872 if (profile)
2873 {
2874 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2876 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2880 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2882
2885
2886 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2888 }
2889
2890 nutritionsData += "-----\n";
2891
2893 }
2894 #endif
2895
2897
2900 {
2902 }
2903}
2904
2906{
2908};
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.