1738{
1740
1748
1758
1760
1762 {
1764 {
1766
1768 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1769
1773 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1774 }
1775 }
1776
1778 {
1780
1782 }
1783
1785 {
1786 super.EEDelete(parent);
1787
1789
1792 }
1793
1795 {
1796 super.EEItemLocationChanged(oldLoc, newLoc);
1797
1800 {
1801 switch (oldLoc.GetParent().GetType())
1802 {
1803 case "FryingPan":
1804 case "Pot":
1805 case "Cauldron":
1806 case "SharpWoodenStick":
1808 break;
1809 }
1810
1813 {
1815 }
1816 }
1817
1818 if (oldLoc.IsValid())
1820
1823 }
1824
1826 {
1829 }
1830
1832 {
1835
1836 return true;
1837 }
1838
1840 {
1842 {
1844 }
1845 }
1846
1849 {
1850 int foodStageType;
1851
1853 if (foodStage)
1854 foodStageType = foodStage.GetFoodStageType();
1855
1860
1861 return agentsIn;
1862 }
1863
1864
1866 {
1867 return false;
1868 }
1869
1871 {
1872 return false;
1873 }
1874
1876 {
1878 {
1880 {
1883
1886
1887 default:
1888 return super.GetTemperatureFreezeTime();
1889 }
1890 }
1891
1892 return super.GetTemperatureFreezeTime();
1893 }
1894
1896 {
1898 {
1900 {
1903
1906
1907 default:
1908 return super.GetTemperatureThawTime();
1909 }
1910 }
1911
1912 return super.GetTemperatureThawTime();
1913 }
1914
1916 {
1918 }
1919
1920
1921
1922
1924 {
1925 SetSynchDirty();
1926 }
1927
1929 {
1930 super.OnVariablesSynchronized();
1931
1932
1933
1934
1936 {
1938 }
1939 else
1940 {
1942 }
1943
1946 }
1947
1948
1949
1950
1952 {
1955
1957 }
1958
1960 {
1961 string soundName = "";
1962
1965
1967 {
1969 }
1970 else
1971 {
1973 {
1975 {
1980 else
1981 soundName = "";
1982 break;
1983 }
1984
1986 {
1991 else
1992 soundName = "";
1993 break;
1994 }
1995
1997 {
2002 else
2003 soundName = "";
2004 break;
2005 }
2006
2007 default:
2008 soundName = "";
2009 break;
2010 }
2011
2013 {
2014 if (soundName == "")
2015 {
2017 }
2018 else
2019 {
2021 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2022 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2024 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2025 {
2027 }
2028 }
2029 }
2030 }
2031
2033 }
2034
2036 {
2039 }
2040
2041
2042
2043
2045 {
2046 super.OnStoreSave(ctx);
2047
2049 {
2051 }
2052
2053
2056 }
2057
2059 {
2060 if (!super.OnStoreLoad(ctx, version))
2061 return false;
2062
2064 {
2066 return false;
2067 }
2068
2069 if (version >= 115)
2070 {
2072 {
2074 return false;
2075 }
2077 {
2079 return false;
2080 }
2081 }
2082
2085
2086 return true;
2087 }
2088
2090 {
2091 super.AfterStoreLoad();
2092
2094 }
2095
2096
2098 {
2100 }
2101
2102
2104 {
2105 return false;
2106 }
2107
2109 {
2110 return false;
2111 }
2112
2114 {
2115 return false;
2116 }
2117
2119 {
2120 return false;
2121 }
2122
2123
2124
2125
2126
2128 {
2131 {
2132 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2133 }
2134 else if (classname != "" && food_stage)
2135 {
2136 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2137 }
2138 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2140
2141 }
2142
2144 {
2147 {
2149 }
2150 else if (classname != "" && food_stage)
2151 {
2152 return FoodStage.GetEnergy(null, food_stage, classname);
2153 }
2154 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2156 }
2157
2159 {
2162 {
2164 }
2165 else if (classname != "" && food_stage)
2166 {
2167 return FoodStage.GetWater(null, food_stage, classname);
2168 }
2169 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2171 }
2172
2174 {
2177 {
2178 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2179 }
2180 else if (classname != "" && food_stage)
2181 {
2182 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2183 }
2184 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2186
2187 }
2188
2190 {
2193 {
2194 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2195 }
2196 else if (classname != "" && food_stage)
2197 {
2198 return FoodStage.GetToxicity(null, food_stage, classname);
2199 }
2200 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2202 }
2203
2205 {
2208 {
2210 }
2211 else if (classname != "" && food_stage)
2212 {
2213 return FoodStage.GetAgents(null, food_stage, classname);
2214 }
2215 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2217 }
2218
2220 {
2223 {
2224 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2225 }
2226 else if (classname != "" && food_stage)
2227 {
2228 return FoodStage.GetDigestibility(null, food_stage, classname);
2229 }
2230 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2232 }
2233
2235 {
2238 {
2239 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2240 }
2241 else if (className != "" && foodStage)
2242 {
2243 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2244 }
2245 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2247 }
2248
2250 {
2260
2261 return profile;
2262 }
2263
2264
2265
2266
2268 {
2270 }
2271
2272
2274 {
2276 {
2278 }
2279
2280 return false;
2281 }
2282
2284 {
2286 {
2288 }
2289
2290 return false;
2291 }
2292
2294 {
2296 {
2298 }
2299
2300 return false;
2301 }
2302
2304 {
2306 {
2308 }
2309
2310 return false;
2311 }
2312
2314 {
2316 {
2318 }
2319
2320 return false;
2321 }
2322
2324 {
2326 {
2328 }
2329
2330 return false;
2331 }
2332
2333
2335 {
2337 }
2338
2340 {
2341 return GetFoodStage().GetNextFoodStageType( cooking_method );
2342 }
2343
2345 {
2346 return GetFoodStage().GetFoodStageName( food_stage_type );
2347 }
2348
2350 {
2351 return GetFoodStage().CanChangeToNewStage( cooking_method );
2352 }
2353
2354
2356 {
2357 if ( !source.GetFoodStage())
2358 return;
2363 }
2364
2367 {
2370 }
2371
2374 {
2375 switch (stageNew)
2376 {
2381 break;
2382
2385 break;
2386 }
2387 }
2388
2389
2390
2391
2392
2394 {
2396 }
2397
2399 {
2401
2402
2404 }
2405
2407 {
2409 {
2412 }
2413 }
2414
2415
2417 {
2419 if (player)
2420 {
2422 player.ServerReplaceItemInHandsWithNew(lambda);
2423 }
2424 else
2425 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2426 }
2427
2429 {
2431 }
2432
2434 {
2435 super.SetActions();
2436
2439 }
2440
2442 {
2443 #ifndef SERVER
2445 {
2447
2450 }
2451 #endif
2452 }
2453
2455 {
2456 #ifndef SERVER
2458 {
2462 }
2463 #endif
2464 }
2465
2467 {
2468 return false;
2469 }
2470
2472 {
2474 }
2475
2476 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2477 {
2479
2480 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2482 if ( hasRootAsPlayer )
2484
2485
2486
2487
2488
2489
2490
2492 {
2493
2495 {
2497 {
2501 break;
2502
2506 break;
2507
2511 break;
2512
2516 default:
2519 return;
2520 }
2521
2522
2523 }
2524
2526
2528 {
2530 {
2531
2533 {
2535 }
2537 {
2540 {
2542 }
2543 else
2544 {
2546 {
2548 }
2549 else
2550 {
2552 }
2553 }
2554 }
2555 }
2556 }
2557
2558 }
2560 {
2561
2563 {
2565 {
2569 break;
2570
2574 break;
2575
2579 break;
2580
2584 break;
2585
2588 default:
2591 return;
2592 }
2593 }
2594
2596
2598 {
2600 {
2601
2603 {
2605 }
2606 }
2607 }
2608 }
2610 {
2611
2613 {
2615 {
2619 break;
2620
2623 default:
2626 return;
2627 }
2628 }
2629
2631
2633 {
2635 {
2636
2638 {
2640 }
2641 }
2642 }
2643 }
2644 else
2645 {
2646
2648
2650 {
2653
2654 }
2655 else
2656 {
2658 {
2661 }
2662 }
2663 }
2664 }
2665
2667 {
2668 if (
GetGame().IsDedicatedServer())
2669 return;
2670
2672 {
2674 GetInventory().GetCurrentInventoryLocation(invLoc);
2676 {
2678 if (ptcMgr)
2679 {
2684 }
2685 }
2686 }
2688 {
2690 {
2693 return;
2694 }
2695
2697 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2699 {
2702 }
2703 }
2704 }
2705
2706 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2707 {
2708 super.GetDebugActions(outputList);
2709
2711 {
2715 }
2716 }
2717
2719 {
2720 super.OnAction(action_id, player, ctx);
2721
2723 {
2724 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2725 {
2727 if (food_stage_prev <= 0)
2728 {
2730 }
2732 return true;
2733 }
2734 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2735 {
2738 {
2740 }
2742 return true;
2743 }
2744
2745 }
2746
2747 #ifdef DIAG_DEVELOPER
2748 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2749 {
2750 PrintNutritionsData();
2751 return true;
2752 }
2753 #endif
2754
2755 return false;
2756 }
2757
2759 {
2760 string debug_output;
2761
2762 debug_output = super.GetDebugText();
2763
2766
2767 return debug_output;
2768 }
2769
2770
2771
2772
2773
2775 {
2776 float ret = super.GetBaitEffectivity();
2777
2779 {
2780 ret *= 0.5;
2781 }
2782
2783 return ret;
2784 }
2785
2787 {
2789 }
2790
2792 {
2794 }
2795
2797 {
2799 }
2800
2801 #ifdef DIAG_DEVELOPER
2802 private void PrintNutritionsData()
2803 {
2804 string nutritionsData = "";
2805
2808
2810 if (profile)
2811 {
2812 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2814 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2818 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2820
2823
2824 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2826 }
2827
2828 nutritionsData += "-----\n";
2829
2831 }
2832 #endif
2833
2835
2838 {
2840 }
2841}
2842
2844{
2846};
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.