1644{
1646
1654
1664
1666
1668 {
1670 {
1672
1674 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1675
1679 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1680 }
1681 }
1682
1684 {
1686
1688 }
1689
1691 {
1692 super.EEDelete(parent);
1693
1695
1698 }
1699
1701 {
1702 super.EEItemLocationChanged(oldLoc, newLoc);
1703
1706 {
1707 switch (oldLoc.GetParent().GetType())
1708 {
1709 case "FryingPan":
1710 case "Pot":
1711 case "Cauldron":
1712 case "SharpWoodenStick":
1714 break;
1715 }
1716
1719 {
1721 }
1722 }
1723
1724 if (oldLoc.IsValid())
1726
1729 }
1730
1732 {
1735 }
1736
1738 {
1741
1742 return true;
1743 }
1744
1746 {
1748 {
1750 }
1751 }
1752
1755 {
1756 int foodStageType;
1757
1759 if (foodStage)
1760 foodStageType = foodStage.GetFoodStageType();
1761
1766
1767 return agentsIn;
1768 }
1769
1770
1772 {
1773 return false;
1774 }
1775
1777 {
1778 return false;
1779 }
1780
1782 {
1784 {
1786 {
1789
1792
1793 default:
1794 return super.GetTemperatureFreezeTime();
1795 }
1796 }
1797
1798 return super.GetTemperatureFreezeTime();
1799 }
1800
1802 {
1804 {
1806 {
1809
1812
1813 default:
1814 return super.GetTemperatureThawTime();
1815 }
1816 }
1817
1818 return super.GetTemperatureThawTime();
1819 }
1820
1822 {
1824 }
1825
1826
1827
1828
1830 {
1831 SetSynchDirty();
1832 }
1833
1835 {
1836 super.OnVariablesSynchronized();
1837
1838
1839
1840
1842 {
1844 }
1845 else
1846 {
1848 }
1849
1852 }
1853
1854
1855
1856
1858 {
1861
1863 }
1864
1866 {
1867 string soundName = "";
1868
1871
1873 {
1875 }
1876 else
1877 {
1879 {
1881 {
1886 else
1887 soundName = "";
1888 break;
1889 }
1890
1892 {
1897 else
1898 soundName = "";
1899 break;
1900 }
1901
1903 {
1908 else
1909 soundName = "";
1910 break;
1911 }
1912
1913 default:
1914 soundName = "";
1915 break;
1916 }
1917
1919 {
1920 if (soundName == "")
1921 {
1923 }
1924 else
1925 {
1927 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1928 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1930 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1931 {
1933 }
1934 }
1935 }
1936 }
1937
1939 }
1940
1942 {
1945 }
1946
1947
1948
1949
1951 {
1952 super.OnStoreSave(ctx);
1953
1955 {
1957 }
1958
1959
1962 }
1963
1965 {
1966 if (!super.OnStoreLoad(ctx, version))
1967 return false;
1968
1970 {
1972 return false;
1973 }
1974
1975 if (version >= 115)
1976 {
1978 {
1980 return false;
1981 }
1983 {
1985 return false;
1986 }
1987 }
1988
1991
1992 return true;
1993 }
1994
1996 {
1997 super.AfterStoreLoad();
1998
2000 }
2001
2002
2004 {
2006 }
2007
2008
2010 {
2011 return false;
2012 }
2013
2015 {
2016 return false;
2017 }
2018
2020 {
2021 return false;
2022 }
2023
2025 {
2026 return false;
2027 }
2028
2029
2030
2031
2032
2034 {
2037 {
2038 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2039 }
2040 else if (classname != "" && food_stage)
2041 {
2042 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2043 }
2044 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2045 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
2046
2047 }
2048
2050 {
2053 {
2055 }
2056 else if (classname != "" && food_stage)
2057 {
2058 return FoodStage.GetEnergy(null, food_stage, classname);
2059 }
2060 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2061 return g_Game.ConfigGetFloat( class_path +
" energy" );
2062 }
2063
2065 {
2068 {
2070 }
2071 else if (classname != "" && food_stage)
2072 {
2073 return FoodStage.GetWater(null, food_stage, classname);
2074 }
2075 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2076 return g_Game.ConfigGetFloat( class_path +
" water" );
2077 }
2078
2080 {
2083 {
2084 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2085 }
2086 else if (classname != "" && food_stage)
2087 {
2088 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2089 }
2090 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2091 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
2092
2093 }
2094
2096 {
2099 {
2100 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2101 }
2102 else if (classname != "" && food_stage)
2103 {
2104 return FoodStage.GetToxicity(null, food_stage, classname);
2105 }
2106 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2107 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
2108 }
2109
2111 {
2114 {
2116 }
2117 else if (classname != "" && food_stage)
2118 {
2119 return FoodStage.GetAgents(null, food_stage, classname);
2120 }
2121 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2122 return g_Game.ConfigGetInt( class_path +
" agents" );
2123 }
2124
2126 {
2129 {
2130 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2131 }
2132 else if (classname != "" && food_stage)
2133 {
2134 return FoodStage.GetDigestibility(null, food_stage, classname);
2135 }
2136 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2137 return g_Game.ConfigGetInt( class_path +
" digestibility" );
2138 }
2139
2141 {
2144 {
2145 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2146 }
2147 else if (className != "" && foodStage)
2148 {
2149 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2150 }
2151 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2152 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
2153 }
2154
2156 {
2166
2167 return profile;
2168 }
2169
2170
2171
2172
2174 {
2176 }
2177
2178
2180 {
2182 {
2184 }
2185
2186 return false;
2187 }
2188
2190 {
2192 {
2194 }
2195
2196 return false;
2197 }
2198
2200 {
2202 {
2204 }
2205
2206 return false;
2207 }
2208
2210 {
2212 {
2214 }
2215
2216 return false;
2217 }
2218
2220 {
2222 {
2224 }
2225
2226 return false;
2227 }
2228
2230 {
2232 {
2234 }
2235
2236 return false;
2237 }
2238
2239
2241 {
2243 }
2244
2246 {
2247 return GetFoodStage().GetNextFoodStageType( cooking_method );
2248 }
2249
2251 {
2252 return GetFoodStage().GetFoodStageName( food_stage_type );
2253 }
2254
2256 {
2257 return GetFoodStage().CanChangeToNewStage( cooking_method );
2258 }
2259
2260
2262 {
2263 if ( !source.GetFoodStage())
2264 return;
2269 }
2270
2273 {
2276 }
2277
2280 {
2281 switch (stageNew)
2282 {
2287 break;
2288
2291 break;
2292 }
2293 }
2294
2295
2296
2297
2298
2300 {
2302 }
2303
2305 {
2307
2308
2310 }
2311
2313 {
2315 {
2318 }
2319 }
2320
2321
2323 {
2325 if (player)
2326 {
2328 player.ServerReplaceItemInHandsWithNew(lambda);
2329 }
2330 else
2331 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2332 }
2333
2335 {
2337 }
2338
2340 {
2341 super.SetActions();
2342
2345 }
2346
2348 {
2349 #ifndef SERVER
2350 #ifndef NO_GUI
2352 {
2354
2357 }
2358 #endif
2359 #endif
2360 }
2361
2363 {
2364 #ifndef SERVER
2365 #ifndef NO_GUI
2367 {
2371 }
2372 #endif
2373 #endif
2374 }
2375
2377 {
2378 return false;
2379 }
2380
2382 {
2384 }
2385
2386 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2387 {
2389
2390 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
2392 if ( hasRootAsPlayer )
2394
2395
2396
2397
2398
2399
2400
2402 {
2403
2405 {
2407 {
2411 break;
2412
2416 break;
2417
2421 break;
2422
2426 default:
2429 return;
2430 }
2431
2432
2433 }
2434
2436
2438 {
2440 {
2441
2443 {
2445 }
2447 {
2450 {
2452 }
2453 else
2454 {
2456 {
2458 }
2459 else
2460 {
2462 }
2463 }
2464 }
2465 }
2466 }
2467
2468 }
2470 {
2471
2473 {
2475 {
2479 break;
2480
2484 break;
2485
2489 break;
2490
2494 break;
2495
2498 default:
2501 return;
2502 }
2503 }
2504
2506
2508 {
2510 {
2511
2513 {
2515 }
2516 }
2517 }
2518 }
2520 {
2521
2523 {
2525 {
2529 break;
2530
2533 default:
2536 return;
2537 }
2538 }
2539
2541
2543 {
2545 {
2546
2548 {
2550 }
2551 }
2552 }
2553 }
2554 else
2555 {
2556
2558
2560 {
2563
2564 }
2565 else
2566 {
2568 {
2571 }
2572 }
2573 }
2574 }
2575
2577 {
2578 if (
g_Game.IsHeadlessOrDedicatedServer())
2579 return;
2580
2582 {
2584 GetInventory().GetCurrentInventoryLocation(invLoc);
2586 {
2588 if (ptcMgr)
2589 {
2594 }
2595 }
2596 }
2598 {
2600 {
2603 return;
2604 }
2605
2607 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2609 {
2612 }
2613 }
2614 }
2615
2616 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2617 {
2619 {
2624 }
2625
2626 super.GetDebugActions(outputList);
2627 }
2628
2630 {
2631 super.OnAction(action_id, player, ctx);
2632
2634 {
2635 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2636 {
2638 if (food_stage_prev <= 0)
2639 {
2641 }
2643 return true;
2644 }
2645 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2646 {
2649 {
2651 }
2653 return true;
2654 }
2655
2656 }
2657
2658 #ifdef DIAG_DEVELOPER
2659 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2660 {
2661 PrintNutritionsData();
2662 return true;
2663 }
2664 #endif
2665
2666 return false;
2667 }
2668
2670 {
2671 string debug_output;
2672
2673 debug_output = super.GetDebugText();
2674
2677
2678 return debug_output;
2679 }
2680
2681
2682
2683
2684
2686 {
2687 float ret = super.GetBaitEffectivity();
2688
2690 {
2691 ret *= 0.5;
2692 }
2693
2694 return ret;
2695 }
2696
2698 {
2700 }
2701
2703 {
2705 }
2706
2708 {
2710 }
2711
2712 #ifdef DIAG_DEVELOPER
2713 private void PrintNutritionsData()
2714 {
2715 string nutritionsData = "";
2716
2719
2721 if (profile)
2722 {
2723 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2725 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2729 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2731
2734
2735 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2737 }
2738
2739 nutritionsData += "-----\n";
2740
2742 }
2743 #endif
2744
2746
2749 {
2751 }
2752}
2753
2755{
2757};
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.