1727{
1729
1737
1747
1749
1751 {
1753 {
1755
1757 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1758
1762 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1763 }
1764 }
1765
1767 {
1769
1771 }
1772
1774 {
1775 super.EEDelete(parent);
1776
1778
1781 }
1782
1784 {
1785 super.EEItemLocationChanged(oldLoc, newLoc);
1786
1789 {
1790 switch (oldLoc.GetParent().GetType())
1791 {
1792 case "FryingPan":
1793 case "Pot":
1794 case "Cauldron":
1795 case "SharpWoodenStick":
1797 break;
1798 }
1799
1802 {
1804 }
1805 }
1806
1807 if (oldLoc.IsValid())
1809
1812 }
1813
1815 {
1818 }
1819
1821 {
1824
1825 return true;
1826 }
1827
1829 {
1831 {
1833 }
1834 }
1835
1838 {
1839 int foodStageType;
1840
1842 if (foodStage)
1843 foodStageType = foodStage.GetFoodStageType();
1844
1849
1850 return agentsIn;
1851 }
1852
1853
1855 {
1856 return false;
1857 }
1858
1860 {
1861 return false;
1862 }
1863
1865 {
1867 {
1869 {
1872
1875
1876 default:
1877 return super.GetTemperatureFreezeTime();
1878 }
1879 }
1880
1881 return super.GetTemperatureFreezeTime();
1882 }
1883
1885 {
1887 {
1889 {
1892
1895
1896 default:
1897 return super.GetTemperatureThawTime();
1898 }
1899 }
1900
1901 return super.GetTemperatureThawTime();
1902 }
1903
1905 {
1907 }
1908
1909
1910
1911
1913 {
1914 SetSynchDirty();
1915 }
1916
1918 {
1919 super.OnVariablesSynchronized();
1920
1921
1922
1923
1925 {
1927 }
1928 else
1929 {
1931 }
1932
1935 }
1936
1937
1938
1939
1941 {
1944
1946 }
1947
1949 {
1950 string soundName = "";
1951
1954
1956 {
1958 }
1959 else
1960 {
1962 {
1964 {
1969 else
1970 soundName = "";
1971 break;
1972 }
1973
1975 {
1980 else
1981 soundName = "";
1982 break;
1983 }
1984
1986 {
1991 else
1992 soundName = "";
1993 break;
1994 }
1995
1996 default:
1997 soundName = "";
1998 break;
1999 }
2000
2002 {
2003 if (soundName == "")
2004 {
2006 }
2007 else
2008 {
2010 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
2011 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
2013 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
2014 {
2016 }
2017 }
2018 }
2019 }
2020
2022 }
2023
2025 {
2028 }
2029
2030
2031
2032
2034 {
2035 super.OnStoreSave(ctx);
2036
2038 {
2040 }
2041
2042
2045 }
2046
2048 {
2049 if (!super.OnStoreLoad(ctx, version))
2050 return false;
2051
2053 {
2055 return false;
2056 }
2057
2058 if (version >= 115)
2059 {
2061 {
2063 return false;
2064 }
2066 {
2068 return false;
2069 }
2070 }
2071
2074
2075 return true;
2076 }
2077
2079 {
2080 super.AfterStoreLoad();
2081
2083 }
2084
2085
2087 {
2089 }
2090
2091
2093 {
2094 return false;
2095 }
2096
2098 {
2099 return false;
2100 }
2101
2103 {
2104 return false;
2105 }
2106
2108 {
2109 return false;
2110 }
2111
2112
2113
2114
2115
2117 {
2120 {
2121 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2122 }
2123 else if (classname != "" && food_stage)
2124 {
2125 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2126 }
2127 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2129
2130 }
2131
2133 {
2136 {
2138 }
2139 else if (classname != "" && food_stage)
2140 {
2141 return FoodStage.GetEnergy(null, food_stage, classname);
2142 }
2143 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2145 }
2146
2148 {
2151 {
2153 }
2154 else if (classname != "" && food_stage)
2155 {
2156 return FoodStage.GetWater(null, food_stage, classname);
2157 }
2158 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2160 }
2161
2163 {
2166 {
2167 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2168 }
2169 else if (classname != "" && food_stage)
2170 {
2171 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2172 }
2173 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2175
2176 }
2177
2179 {
2182 {
2183 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2184 }
2185 else if (classname != "" && food_stage)
2186 {
2187 return FoodStage.GetToxicity(null, food_stage, classname);
2188 }
2189 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2191 }
2192
2194 {
2197 {
2199 }
2200 else if (classname != "" && food_stage)
2201 {
2202 return FoodStage.GetAgents(null, food_stage, classname);
2203 }
2204 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2206 }
2207
2209 {
2212 {
2213 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2214 }
2215 else if (classname != "" && food_stage)
2216 {
2217 return FoodStage.GetDigestibility(null, food_stage, classname);
2218 }
2219 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2221 }
2222
2224 {
2227 {
2228 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2229 }
2230 else if (className != "" && foodStage)
2231 {
2232 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2233 }
2234 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2236 }
2237
2239 {
2249
2250 return profile;
2251 }
2252
2253
2254
2255
2257 {
2259 }
2260
2261
2263 {
2265 {
2267 }
2268
2269 return false;
2270 }
2271
2273 {
2275 {
2277 }
2278
2279 return false;
2280 }
2281
2283 {
2285 {
2287 }
2288
2289 return false;
2290 }
2291
2293 {
2295 {
2297 }
2298
2299 return false;
2300 }
2301
2303 {
2305 {
2307 }
2308
2309 return false;
2310 }
2311
2313 {
2315 {
2317 }
2318
2319 return false;
2320 }
2321
2322
2324 {
2326 }
2327
2329 {
2330 return GetFoodStage().GetNextFoodStageType( cooking_method );
2331 }
2332
2334 {
2335 return GetFoodStage().GetFoodStageName( food_stage_type );
2336 }
2337
2339 {
2340 return GetFoodStage().CanChangeToNewStage( cooking_method );
2341 }
2342
2343
2345 {
2346 if ( !source.GetFoodStage())
2347 return;
2352 }
2353
2356 {
2359 }
2360
2363 {
2364 switch (stageNew)
2365 {
2370 break;
2371
2374 break;
2375 }
2376 }
2377
2378
2379
2380
2381
2383 {
2385 }
2386
2388 {
2390
2391
2393 }
2394
2396 {
2398 {
2401 }
2402 }
2403
2404
2406 {
2408 if (player)
2409 {
2411 player.ServerReplaceItemInHandsWithNew(lambda);
2412 }
2413 else
2414 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2415 }
2416
2418 {
2420 }
2421
2423 {
2424 super.SetActions();
2425
2428 }
2429
2431 {
2432 #ifndef SERVER
2434 {
2436
2439 }
2440 #endif
2441 }
2442
2444 {
2445 #ifndef SERVER
2447 {
2451 }
2452 #endif
2453 }
2454
2456 {
2457 return false;
2458 }
2459
2461 {
2463 }
2464
2465 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2466 {
2468
2469 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2471 if ( hasRootAsPlayer )
2473
2474
2475
2476
2477
2478
2479
2481 {
2482
2484 {
2486 {
2490 break;
2491
2495 break;
2496
2500 break;
2501
2505 default:
2508 return;
2509 }
2510
2511
2512 }
2513
2515
2517 {
2519 {
2520
2522 {
2524 }
2526 {
2529 {
2531 }
2532 else
2533 {
2535 {
2537 }
2538 else
2539 {
2541 }
2542 }
2543 }
2544 }
2545 }
2546
2547 }
2549 {
2550
2552 {
2554 {
2558 break;
2559
2563 break;
2564
2568 break;
2569
2573 break;
2574
2577 default:
2580 return;
2581 }
2582 }
2583
2585
2587 {
2589 {
2590
2592 {
2594 }
2595 }
2596 }
2597 }
2599 {
2600
2602 {
2604 {
2608 break;
2609
2612 default:
2615 return;
2616 }
2617 }
2618
2620
2622 {
2624 {
2625
2627 {
2629 }
2630 }
2631 }
2632 }
2633 else
2634 {
2635
2637
2639 {
2642
2643 }
2644 else
2645 {
2647 {
2650 }
2651 }
2652 }
2653 }
2654
2656 {
2657 if (
GetGame().IsDedicatedServer())
2658 return;
2659
2661 {
2663 GetInventory().GetCurrentInventoryLocation(invLoc);
2665 {
2667 if (ptcMgr)
2668 {
2673 }
2674 }
2675 }
2677 {
2679 {
2682 return;
2683 }
2684
2686 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2688 {
2691 }
2692 }
2693 }
2694
2695 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2696 {
2697 super.GetDebugActions(outputList);
2698
2700 {
2704 }
2705 }
2706
2708 {
2709 super.OnAction(action_id, player, ctx);
2710
2712 {
2713 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2714 {
2716 if (food_stage_prev <= 0)
2717 {
2719 }
2721 return true;
2722 }
2723 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2724 {
2727 {
2729 }
2731 return true;
2732 }
2733
2734 }
2735
2736 #ifdef DIAG_DEVELOPER
2737 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2738 {
2739 PrintNutritionsData();
2740 return true;
2741 }
2742 #endif
2743
2744 return false;
2745 }
2746
2748 {
2749 string debug_output;
2750
2751 debug_output = super.GetDebugText();
2752
2755
2756 return debug_output;
2757 }
2758
2759
2760
2761
2762
2764 {
2765 float ret = super.GetBaitEffectivity();
2766
2768 {
2769 ret *= 0.5;
2770 }
2771
2772 return ret;
2773 }
2774
2776 {
2778 }
2779
2781 {
2783 }
2784
2786 {
2788 }
2789
2790 #ifdef DIAG_DEVELOPER
2791 private void PrintNutritionsData()
2792 {
2793 string nutritionsData = "";
2794
2797
2799 if (profile)
2800 {
2801 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2803 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2807 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2809
2812
2813 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2815 }
2816
2817 nutritionsData += "-----\n";
2818
2820 }
2821 #endif
2822
2824
2827 {
2829 }
2830}
2831
2833{
2835};
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.