1700{
1702
1710
1720
1722
1724 {
1726 {
1728
1730 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1731
1735 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1736 }
1737 }
1738
1740 {
1742
1744 }
1745
1747 {
1748 super.EEDelete(parent);
1749
1751
1754 }
1755
1757 {
1758 super.EEItemLocationChanged(oldLoc, newLoc);
1759
1762 {
1763 switch (oldLoc.GetParent().GetType())
1764 {
1765 case "FryingPan":
1766 case "Pot":
1767 case "Cauldron":
1768 case "SharpWoodenStick":
1770 break;
1771 }
1772
1775 {
1777 }
1778 }
1779
1780 if (oldLoc.IsValid())
1782
1785 }
1786
1788 {
1791 }
1792
1794 {
1797
1798 return true;
1799 }
1800
1802 {
1804 {
1806 }
1807 }
1808
1811 {
1812 int foodStageType;
1813
1815 if (foodStage)
1816 foodStageType = foodStage.GetFoodStageType();
1817
1822
1823 return agentsIn;
1824 }
1825
1826
1828 {
1829 return false;
1830 }
1831
1833 {
1834 return false;
1835 }
1836
1838 {
1840 {
1842 {
1845
1848
1849 default:
1850 return super.GetTemperatureFreezeTime();
1851 }
1852 }
1853
1854 return super.GetTemperatureFreezeTime();
1855 }
1856
1858 {
1860 {
1862 {
1865
1868
1869 default:
1870 return super.GetTemperatureThawTime();
1871 }
1872 }
1873
1874 return super.GetTemperatureThawTime();
1875 }
1876
1878 {
1880 }
1881
1882
1883
1884
1886 {
1887 SetSynchDirty();
1888 }
1889
1891 {
1892 super.OnVariablesSynchronized();
1893
1894
1895
1896
1898 {
1900 }
1901 else
1902 {
1904 }
1905
1908 }
1909
1910
1911
1912
1914 {
1917
1919 }
1920
1922 {
1923 string soundName = "";
1924
1927
1929 {
1931 }
1932 else
1933 {
1935 {
1937 {
1942 else
1943 soundName = "";
1944 break;
1945 }
1946
1948 {
1953 else
1954 soundName = "";
1955 break;
1956 }
1957
1959 {
1964 else
1965 soundName = "";
1966 break;
1967 }
1968
1969 default:
1970 soundName = "";
1971 break;
1972 }
1973
1975 {
1976 if (soundName == "")
1977 {
1979 }
1980 else
1981 {
1983 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1984 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1986 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1987 {
1989 }
1990 }
1991 }
1992 }
1993
1995 }
1996
1998 {
2001 }
2002
2003
2004
2005
2007 {
2008 super.OnStoreSave(ctx);
2009
2011 {
2013 }
2014
2015
2018 }
2019
2021 {
2022 if (!super.OnStoreLoad(ctx, version))
2023 return false;
2024
2026 {
2028 return false;
2029 }
2030
2031 if (version >= 115)
2032 {
2034 {
2036 return false;
2037 }
2039 {
2041 return false;
2042 }
2043 }
2044
2047
2048 return true;
2049 }
2050
2052 {
2053 super.AfterStoreLoad();
2054
2056 }
2057
2058
2060 {
2062 }
2063
2064
2066 {
2067 return false;
2068 }
2069
2071 {
2072 return false;
2073 }
2074
2076 {
2077 return false;
2078 }
2079
2081 {
2082 return false;
2083 }
2084
2085
2086
2087
2088
2090 {
2093 {
2094 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2095 }
2096 else if (classname != "" && food_stage)
2097 {
2098 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2099 }
2100 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2101 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2102
2103 }
2104
2106 {
2109 {
2111 }
2112 else if (classname != "" && food_stage)
2113 {
2114 return FoodStage.GetEnergy(null, food_stage, classname);
2115 }
2116 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2117 return g_Game.ConfigGetFloat( class_path +
" energy" );
2118 }
2119
2121 {
2124 {
2126 }
2127 else if (classname != "" && food_stage)
2128 {
2129 return FoodStage.GetWater(null, food_stage, classname);
2130 }
2131 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2132 return g_Game.ConfigGetFloat( class_path +
" water" );
2133 }
2134
2136 {
2139 {
2140 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2141 }
2142 else if (classname != "" && food_stage)
2143 {
2144 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2145 }
2146 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2147 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2148
2149 }
2150
2152 {
2155 {
2156 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2157 }
2158 else if (classname != "" && food_stage)
2159 {
2160 return FoodStage.GetToxicity(null, food_stage, classname);
2161 }
2162 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2163 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2164 }
2165
2167 {
2170 {
2172 }
2173 else if (classname != "" && food_stage)
2174 {
2175 return FoodStage.GetAgents(null, food_stage, classname);
2176 }
2177 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2178 return g_Game.ConfigGetInt( class_path +
" agents" );
2179 }
2180
2182 {
2185 {
2186 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2187 }
2188 else if (classname != "" && food_stage)
2189 {
2190 return FoodStage.GetDigestibility(null, food_stage, classname);
2191 }
2192 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2193 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2194 }
2195
2197 {
2200 {
2201 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2202 }
2203 else if (className != "" && foodStage)
2204 {
2205 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2206 }
2207 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2208 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2209 }
2210
2212 {
2222
2223 return profile;
2224 }
2225
2226
2227
2228
2230 {
2232 }
2233
2234
2236 {
2238 {
2240 }
2241
2242 return false;
2243 }
2244
2246 {
2248 {
2250 }
2251
2252 return false;
2253 }
2254
2256 {
2258 {
2260 }
2261
2262 return false;
2263 }
2264
2266 {
2268 {
2270 }
2271
2272 return false;
2273 }
2274
2276 {
2278 {
2280 }
2281
2282 return false;
2283 }
2284
2286 {
2288 {
2290 }
2291
2292 return false;
2293 }
2294
2295
2297 {
2299 }
2300
2302 {
2303 return GetFoodStage().GetNextFoodStageType( cooking_method );
2304 }
2305
2307 {
2308 return GetFoodStage().GetFoodStageName( food_stage_type );
2309 }
2310
2312 {
2313 return GetFoodStage().CanChangeToNewStage( cooking_method );
2314 }
2315
2316
2318 {
2319 if ( !source.GetFoodStage())
2320 return;
2325 }
2326
2329 {
2332 }
2333
2336 {
2337 switch (stageNew)
2338 {
2343 break;
2344
2347 break;
2348 }
2349 }
2350
2351
2352
2353
2354
2356 {
2358 }
2359
2361 {
2363
2364
2366 }
2367
2369 {
2371 {
2374 }
2375 }
2376
2377
2379 {
2381 if (player)
2382 {
2384 player.ServerReplaceItemInHandsWithNew(lambda);
2385 }
2386 else
2387 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2388 }
2389
2391 {
2393 }
2394
2396 {
2397 super.SetActions();
2398
2401 }
2402
2404 {
2405 #ifndef SERVER
2406 #ifndef NO_GUI
2408 {
2410
2413 }
2414 #endif
2415 #endif
2416 }
2417
2419 {
2420 #ifndef SERVER
2421 #ifndef NO_GUI
2423 {
2427 }
2428 #endif
2429 #endif
2430 }
2431
2433 {
2434 return false;
2435 }
2436
2438 {
2440 }
2441
2442 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2443 {
2445
2446 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2448 if ( hasRootAsPlayer )
2450
2451
2452
2453
2454
2455
2456
2458 {
2459
2461 {
2463 {
2467 break;
2468
2472 break;
2473
2477 break;
2478
2482 default:
2485 return;
2486 }
2487
2488
2489 }
2490
2492
2494 {
2496 {
2497
2499 {
2501 }
2503 {
2506 {
2508 }
2509 else
2510 {
2512 {
2514 }
2515 else
2516 {
2518 }
2519 }
2520 }
2521 }
2522 }
2523
2524 }
2526 {
2527
2529 {
2531 {
2535 break;
2536
2540 break;
2541
2545 break;
2546
2550 break;
2551
2554 default:
2557 return;
2558 }
2559 }
2560
2562
2564 {
2566 {
2567
2569 {
2571 }
2572 }
2573 }
2574 }
2576 {
2577
2579 {
2581 {
2585 break;
2586
2589 default:
2592 return;
2593 }
2594 }
2595
2597
2599 {
2601 {
2602
2604 {
2606 }
2607 }
2608 }
2609 }
2610 else
2611 {
2612
2614
2616 {
2619
2620 }
2621 else
2622 {
2624 {
2627 }
2628 }
2629 }
2630 }
2631
2633 {
2634 if (
g_Game.IsHeadlessOrDedicatedServer())
2635 return;
2636
2638 {
2640 GetInventory().GetCurrentInventoryLocation(invLoc);
2642 {
2644 if (ptcMgr)
2645 {
2650 }
2651 }
2652 }
2654 {
2656 {
2659 return;
2660 }
2661
2663 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2665 {
2668 }
2669 }
2670 }
2671
2672 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2673 {
2675 {
2680 }
2681
2682 super.GetDebugActions(outputList);
2683 }
2684
2686 {
2687 super.OnAction(action_id, player, ctx);
2688
2690 {
2691 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2692 {
2694 if (food_stage_prev <= 0)
2695 {
2697 }
2699 return true;
2700 }
2701 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2702 {
2705 {
2707 }
2709 return true;
2710 }
2711
2712 }
2713
2714 #ifdef DIAG_DEVELOPER
2715 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2716 {
2717 PrintNutritionsData();
2718 return true;
2719 }
2720 #endif
2721
2722 return false;
2723 }
2724
2726 {
2727 string debug_output;
2728
2729 debug_output = super.GetDebugText();
2730
2733
2734 return debug_output;
2735 }
2736
2737
2738
2739
2740
2742 {
2743 float ret = super.GetBaitEffectivity();
2744
2746 {
2747 ret *= 0.5;
2748 }
2749
2750 return ret;
2751 }
2752
2754 {
2756 }
2757
2759 {
2761 }
2762
2764 {
2766 }
2767
2768 #ifdef DIAG_DEVELOPER
2769 private void PrintNutritionsData()
2770 {
2771 string nutritionsData = "";
2772
2775
2777 if (profile)
2778 {
2779 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2781 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2785 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2787
2790
2791 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2793 }
2794
2795 nutritionsData += "-----\n";
2796
2798 }
2799 #endif
2800
2802
2805 {
2807 }
2808}
2809
2811{
2813};
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
AttachActionData ActionData ActionAttach()
void AddAction(typename actionName)
DamageType
exposed from C++ (do not change)
AbstractWave m_SoundPlaying
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 RemoveAllAgentsExcept(int agent_to_keep)
override void InsertAgent(int agent, float count=1)
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.
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
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
vector GetPosition()
Get the world position of the Effect.
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.