1778{
1780
1788
1798
1800
1802 {
1804 {
1806
1808 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1809
1813 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1814 }
1815 }
1816
1818 {
1820
1822 }
1823
1825 {
1826 super.EEDelete(parent);
1827
1829
1832 }
1833
1835 {
1836 super.EEItemLocationChanged(oldLoc, newLoc);
1837
1840 {
1841 switch (oldLoc.GetParent().GetType())
1842 {
1843 case "FryingPan":
1844 case "Pot":
1845 case "Cauldron":
1846 case "SharpWoodenStick":
1848 break;
1849 }
1850
1853 {
1855 }
1856 }
1857
1858 if (oldLoc.IsValid())
1860
1863 }
1864
1866 {
1869 }
1870
1872 {
1875
1876 return true;
1877 }
1878
1880 {
1882 {
1884 }
1885 }
1886
1889 {
1890 int foodStageType;
1891
1893 if (foodStage)
1894 foodStageType = foodStage.GetFoodStageType();
1895
1900
1901 return agentsIn;
1902 }
1903
1904
1906 {
1907 return false;
1908 }
1909
1911 {
1912 return false;
1913 }
1914
1916 {
1918 {
1920 {
1923
1926
1927 default:
1928 return super.GetTemperatureFreezeTime();
1929 }
1930 }
1931
1932 return super.GetTemperatureFreezeTime();
1933 }
1934
1936 {
1938 {
1940 {
1943
1946
1947 default:
1948 return super.GetTemperatureThawTime();
1949 }
1950 }
1951
1952 return super.GetTemperatureThawTime();
1953 }
1954
1956 {
1958 }
1959
1960
1961
1962
1964 {
1965 SetSynchDirty();
1966 }
1967
1969 {
1970 super.OnVariablesSynchronized();
1971
1972
1973
1974
1976 {
1978 }
1979 else
1980 {
1982 }
1983
1986 }
1987
1988
1989
1990
1992 {
1995
1997 }
1998
2000 {
2001 string soundName = "";
2002
2005
2007 {
2009 }
2010 else
2011 {
2013 {
2015 {
2020 else
2021 soundName = "";
2022 break;
2023 }
2024
2026 {
2031 else
2032 soundName = "";
2033 break;
2034 }
2035
2037 {
2042 else
2043 soundName = "";
2044 break;
2045 }
2046
2047 default:
2048 soundName = "";
2049 break;
2050 }
2051
2053 {
2054 if (soundName == "")
2055 {
2057 }
2058 else
2059 {
2061 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2062 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2064 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2065 {
2067 }
2068 }
2069 }
2070 }
2071
2073 }
2074
2076 {
2079 }
2080
2081
2082
2083
2085 {
2086 super.OnStoreSave(ctx);
2087
2089 {
2091 }
2092
2093
2096 }
2097
2099 {
2100 if (!super.OnStoreLoad(ctx, version))
2101 return false;
2102
2104 {
2106 return false;
2107 }
2108
2109 if (version >= 115)
2110 {
2112 {
2114 return false;
2115 }
2117 {
2119 return false;
2120 }
2121 }
2122
2125
2126 return true;
2127 }
2128
2130 {
2131 super.AfterStoreLoad();
2132
2134 }
2135
2136
2138 {
2140 }
2141
2142
2144 {
2145 return false;
2146 }
2147
2149 {
2150 return false;
2151 }
2152
2154 {
2155 return false;
2156 }
2157
2159 {
2160 return false;
2161 }
2162
2163
2164
2165
2166
2168 {
2171 {
2172 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2173 }
2174 else if (classname != "" && food_stage)
2175 {
2176 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2177 }
2178 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2180
2181 }
2182
2184 {
2187 {
2189 }
2190 else if (classname != "" && food_stage)
2191 {
2192 return FoodStage.GetEnergy(null, food_stage, classname);
2193 }
2194 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2196 }
2197
2199 {
2202 {
2204 }
2205 else if (classname != "" && food_stage)
2206 {
2207 return FoodStage.GetWater(null, food_stage, classname);
2208 }
2209 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2211 }
2212
2214 {
2217 {
2218 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2219 }
2220 else if (classname != "" && food_stage)
2221 {
2222 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2223 }
2224 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2226
2227 }
2228
2230 {
2233 {
2234 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2235 }
2236 else if (classname != "" && food_stage)
2237 {
2238 return FoodStage.GetToxicity(null, food_stage, classname);
2239 }
2240 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2242 }
2243
2245 {
2248 {
2250 }
2251 else if (classname != "" && food_stage)
2252 {
2253 return FoodStage.GetAgents(null, food_stage, classname);
2254 }
2255 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2257 }
2258
2260 {
2263 {
2264 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2265 }
2266 else if (classname != "" && food_stage)
2267 {
2268 return FoodStage.GetDigestibility(null, food_stage, classname);
2269 }
2270 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2272 }
2273
2275 {
2278 {
2279 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2280 }
2281 else if (className != "" && foodStage)
2282 {
2283 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2284 }
2285 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2287 }
2288
2290 {
2300
2301 return profile;
2302 }
2303
2304
2305
2306
2308 {
2310 }
2311
2312
2314 {
2316 {
2318 }
2319
2320 return false;
2321 }
2322
2324 {
2326 {
2328 }
2329
2330 return false;
2331 }
2332
2334 {
2336 {
2338 }
2339
2340 return false;
2341 }
2342
2344 {
2346 {
2348 }
2349
2350 return false;
2351 }
2352
2354 {
2356 {
2358 }
2359
2360 return false;
2361 }
2362
2364 {
2366 {
2368 }
2369
2370 return false;
2371 }
2372
2373
2375 {
2377 }
2378
2380 {
2381 return GetFoodStage().GetNextFoodStageType( cooking_method );
2382 }
2383
2385 {
2386 return GetFoodStage().GetFoodStageName( food_stage_type );
2387 }
2388
2390 {
2391 return GetFoodStage().CanChangeToNewStage( cooking_method );
2392 }
2393
2394
2396 {
2397 if ( !source.GetFoodStage())
2398 return;
2403 }
2404
2407 {
2410 }
2411
2414 {
2415 switch (stageNew)
2416 {
2421 break;
2422
2425 break;
2426 }
2427 }
2428
2429
2430
2431
2432
2434 {
2436 }
2437
2439 {
2441
2442
2444 }
2445
2447 {
2449 {
2452 }
2453 }
2454
2455
2457 {
2459 if (player)
2460 {
2462 player.ServerReplaceItemInHandsWithNew(lambda);
2463 }
2464 else
2465 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2466 }
2467
2469 {
2471 }
2472
2474 {
2475 super.SetActions();
2476
2479 }
2480
2482 {
2483 #ifndef SERVER
2485 {
2487
2490 }
2491 #endif
2492 }
2493
2495 {
2496 #ifndef SERVER
2498 {
2502 }
2503 #endif
2504 }
2505
2507 {
2508 return false;
2509 }
2510
2512 {
2514 }
2515
2516 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2517 {
2519
2520 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2522 if ( hasRootAsPlayer )
2524
2525
2526
2527
2528
2529
2530
2532 {
2533
2535 {
2537 {
2541 break;
2542
2546 break;
2547
2551 break;
2552
2556 default:
2559 return;
2560 }
2561
2562
2563 }
2564
2566
2568 {
2570 {
2571
2573 {
2575 }
2577 {
2580 {
2582 }
2583 else
2584 {
2586 {
2588 }
2589 else
2590 {
2592 }
2593 }
2594 }
2595 }
2596 }
2597
2598 }
2600 {
2601
2603 {
2605 {
2609 break;
2610
2614 break;
2615
2619 break;
2620
2624 break;
2625
2628 default:
2631 return;
2632 }
2633 }
2634
2636
2638 {
2640 {
2641
2643 {
2645 }
2646 }
2647 }
2648 }
2650 {
2651
2653 {
2655 {
2659 break;
2660
2663 default:
2666 return;
2667 }
2668 }
2669
2671
2673 {
2675 {
2676
2678 {
2680 }
2681 }
2682 }
2683 }
2684 else
2685 {
2686
2688
2690 {
2693
2694 }
2695 else
2696 {
2698 {
2701 }
2702 }
2703 }
2704 }
2705
2707 {
2708 if (
GetGame().IsDedicatedServer())
2709 return;
2710
2712 {
2714 GetInventory().GetCurrentInventoryLocation(invLoc);
2716 {
2718 if (ptcMgr)
2719 {
2724 }
2725 }
2726 }
2728 {
2730 {
2733 return;
2734 }
2735
2737 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2739 {
2742 }
2743 }
2744 }
2745
2746 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2747 {
2748 super.GetDebugActions(outputList);
2749
2751 {
2755 }
2756 }
2757
2759 {
2760 super.OnAction(action_id, player, ctx);
2761
2763 {
2764 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2765 {
2767 if (food_stage_prev <= 0)
2768 {
2770 }
2772 return true;
2773 }
2774 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2775 {
2778 {
2780 }
2782 return true;
2783 }
2784
2785 }
2786
2787 #ifdef DIAG_DEVELOPER
2788 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2789 {
2790 PrintNutritionsData();
2791 return true;
2792 }
2793 #endif
2794
2795 return false;
2796 }
2797
2799 {
2800 string debug_output;
2801
2802 debug_output = super.GetDebugText();
2803
2806
2807 return debug_output;
2808 }
2809
2810
2811
2812
2813
2815 {
2816 float ret = super.GetBaitEffectivity();
2817
2819 {
2820 ret *= 0.5;
2821 }
2822
2823 return ret;
2824 }
2825
2827 {
2829 }
2830
2832 {
2834 }
2835
2837 {
2839 }
2840
2841 #ifdef DIAG_DEVELOPER
2842 private void PrintNutritionsData()
2843 {
2844 string nutritionsData = "";
2845
2848
2850 if (profile)
2851 {
2852 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2854 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2858 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2860
2863
2864 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2866 }
2867
2868 nutritionsData += "-----\n";
2869
2871 }
2872 #endif
2873
2875
2878 {
2880 }
2881}
2882
2884{
2886};
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.