1665{
1667
1675
1685
1687
1689 {
1691 {
1693
1695 RegisterNetSyncVariableFloat("m_FoodStage.m_CookingTime", 0, 600, 0);
1696
1700 RegisterNetSyncVariableBool("m_MakeCookingSounds");
1701 }
1702 }
1703
1705 {
1707
1709 }
1710
1712 {
1713 super.EEDelete(parent);
1714
1716
1719 }
1720
1722 {
1723 super.EEItemLocationChanged(oldLoc, newLoc);
1724
1727 {
1728 switch (oldLoc.GetParent().GetType())
1729 {
1730 case "FryingPan":
1731 case "Pot":
1732 case "Cauldron":
1733 case "SharpWoodenStick":
1735 break;
1736 }
1737
1740 {
1742 }
1743 }
1744
1745 if (oldLoc.IsValid())
1747
1750 }
1751
1753 {
1756 }
1757
1759 {
1762
1763 return true;
1764 }
1765
1767 {
1769 {
1771 }
1772 }
1773
1776 {
1777 int foodStageType;
1778
1780 if (foodStage)
1781 foodStageType = foodStage.GetFoodStageType();
1782
1787
1788 return agentsIn;
1789 }
1790
1791
1793 {
1794 return false;
1795 }
1796
1798 {
1799 return false;
1800 }
1801
1803 {
1805 {
1807 {
1810
1813
1814 default:
1815 return super.GetTemperatureFreezeTime();
1816 }
1817 }
1818
1819 return super.GetTemperatureFreezeTime();
1820 }
1821
1823 {
1825 {
1827 {
1830
1833
1834 default:
1835 return super.GetTemperatureThawTime();
1836 }
1837 }
1838
1839 return super.GetTemperatureThawTime();
1840 }
1841
1843 {
1845 }
1846
1847
1848
1849
1851 {
1852 SetSynchDirty();
1853 }
1854
1856 {
1857 super.OnVariablesSynchronized();
1858
1859
1860
1861
1863 {
1865 }
1866 else
1867 {
1869 }
1870
1873 }
1874
1875
1876
1877
1879 {
1882
1884 }
1885
1887 {
1888 string soundName = "";
1889
1892
1894 {
1896 }
1897 else
1898 {
1900 {
1902 {
1907 else
1908 soundName = "";
1909 break;
1910 }
1911
1913 {
1918 else
1919 soundName = "";
1920 break;
1921 }
1922
1924 {
1929 else
1930 soundName = "";
1931 break;
1932 }
1933
1934 default:
1935 soundName = "";
1936 break;
1937 }
1938
1940 {
1941 if (soundName == "")
1942 {
1944 }
1945 else
1946 {
1948 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
1949 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
1951 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
1952 {
1954 }
1955 }
1956 }
1957 }
1958
1960 }
1961
1963 {
1966 }
1967
1968
1969
1970
1972 {
1973 super.OnStoreSave(ctx);
1974
1976 {
1978 }
1979
1980
1983 }
1984
1986 {
1987 if (!super.OnStoreLoad(ctx, version))
1988 return false;
1989
1991 {
1993 return false;
1994 }
1995
1996 if (version >= 115)
1997 {
1999 {
2001 return false;
2002 }
2004 {
2006 return false;
2007 }
2008 }
2009
2012
2013 return true;
2014 }
2015
2017 {
2018 super.AfterStoreLoad();
2019
2021 }
2022
2023
2025 {
2027 }
2028
2029
2031 {
2032 return false;
2033 }
2034
2036 {
2037 return false;
2038 }
2039
2041 {
2042 return false;
2043 }
2044
2046 {
2047 return false;
2048 }
2049
2050
2051
2052
2053
2055 {
2058 {
2059 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
2060 }
2061 else if (classname != "" && food_stage)
2062 {
2063 return FoodStage.GetFullnessIndex(null, food_stage, classname);
2064 }
2065 string class_path = string.Format("cfgVehicles %1 Nutrition", classname);
2067
2068 }
2069
2071 {
2074 {
2076 }
2077 else if (classname != "" && food_stage)
2078 {
2079 return FoodStage.GetEnergy(null, food_stage, classname);
2080 }
2081 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2083 }
2084
2086 {
2089 {
2091 }
2092 else if (classname != "" && food_stage)
2093 {
2094 return FoodStage.GetWater(null, food_stage, classname);
2095 }
2096 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2098 }
2099
2101 {
2104 {
2105 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
2106 }
2107 else if (classname != "" && food_stage)
2108 {
2109 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
2110 }
2111 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2113
2114 }
2115
2117 {
2120 {
2121 return FoodStage.GetToxicity(food_item.
GetFoodStage());
2122 }
2123 else if (classname != "" && food_stage)
2124 {
2125 return FoodStage.GetToxicity(null, food_stage, classname);
2126 }
2127 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2129 }
2130
2132 {
2135 {
2137 }
2138 else if (classname != "" && food_stage)
2139 {
2140 return FoodStage.GetAgents(null, food_stage, classname);
2141 }
2142 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2144 }
2145
2147 {
2150 {
2151 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
2152 }
2153 else if (classname != "" && food_stage)
2154 {
2155 return FoodStage.GetDigestibility(null, food_stage, classname);
2156 }
2157 string class_path =
string.
Format(
"cfgVehicles %1 Nutrition", classname);
2159 }
2160
2162 {
2165 {
2166 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
2167 }
2168 else if (className != "" && foodStage)
2169 {
2170 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
2171 }
2172 string classPath = string.Format("cfgVehicles %1 Nutrition", className);
2174 }
2175
2177 {
2187
2188 return profile;
2189 }
2190
2191
2192
2193
2195 {
2197 }
2198
2199
2201 {
2203 {
2205 }
2206
2207 return false;
2208 }
2209
2211 {
2213 {
2215 }
2216
2217 return false;
2218 }
2219
2221 {
2223 {
2225 }
2226
2227 return false;
2228 }
2229
2231 {
2233 {
2235 }
2236
2237 return false;
2238 }
2239
2241 {
2243 {
2245 }
2246
2247 return false;
2248 }
2249
2251 {
2253 {
2255 }
2256
2257 return false;
2258 }
2259
2260
2262 {
2264 }
2265
2267 {
2268 return GetFoodStage().GetNextFoodStageType( cooking_method );
2269 }
2270
2272 {
2273 return GetFoodStage().GetFoodStageName( food_stage_type );
2274 }
2275
2277 {
2278 return GetFoodStage().CanChangeToNewStage( cooking_method );
2279 }
2280
2281
2283 {
2284 if ( !source.GetFoodStage())
2285 return;
2290 }
2291
2294 {
2297 }
2298
2301 {
2302 switch (stageNew)
2303 {
2308 break;
2309
2312 break;
2313 }
2314 }
2315
2316
2317
2318
2319
2321 {
2323 }
2324
2326 {
2328
2329
2331 }
2332
2334 {
2336 {
2339 }
2340 }
2341
2342
2344 {
2346 if (player)
2347 {
2349 player.ServerReplaceItemInHandsWithNew(lambda);
2350 }
2351 else
2352 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
2353 }
2354
2356 {
2358 }
2359
2361 {
2362 super.SetActions();
2363
2366 }
2367
2369 {
2370 #ifndef SERVER
2372 {
2374
2377 }
2378 #endif
2379 }
2380
2382 {
2383 #ifndef SERVER
2385 {
2389 }
2390 #endif
2391 }
2392
2394 {
2395 return false;
2396 }
2397
2399 {
2401 }
2402
2403 override void ProcessDecay(
float delta,
bool hasRootAsPlayer )
2404 {
2406
2407 delta *= DayZGame.Cast(
GetGame()).GetFoodDecayModifier();
2409 if ( hasRootAsPlayer )
2411
2412
2413
2414
2415
2416
2417
2419 {
2420
2422 {
2424 {
2428 break;
2429
2433 break;
2434
2438 break;
2439
2443 default:
2446 return;
2447 }
2448
2449
2450 }
2451
2453
2455 {
2457 {
2458
2460 {
2462 }
2464 {
2467 {
2469 }
2470 else
2471 {
2473 {
2475 }
2476 else
2477 {
2479 }
2480 }
2481 }
2482 }
2483 }
2484
2485 }
2487 {
2488
2490 {
2492 {
2496 break;
2497
2501 break;
2502
2506 break;
2507
2511 break;
2512
2515 default:
2518 return;
2519 }
2520 }
2521
2523
2525 {
2527 {
2528
2530 {
2532 }
2533 }
2534 }
2535 }
2537 {
2538
2540 {
2542 {
2546 break;
2547
2550 default:
2553 return;
2554 }
2555 }
2556
2558
2560 {
2562 {
2563
2565 {
2567 }
2568 }
2569 }
2570 }
2571 else
2572 {
2573
2575
2577 {
2580
2581 }
2582 else
2583 {
2585 {
2588 }
2589 }
2590 }
2591 }
2592
2594 {
2595 if (
GetGame().IsDedicatedServer())
2596 return;
2597
2599 {
2601 GetInventory().GetCurrentInventoryLocation(invLoc);
2603 {
2605 if (ptcMgr)
2606 {
2611 }
2612 }
2613 }
2615 {
2617 {
2620 return;
2621 }
2622
2624 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
2626 {
2629 }
2630 }
2631 }
2632
2633 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2634 {
2635 super.GetDebugActions(outputList);
2636
2638 {
2642 }
2643 }
2644
2646 {
2647 super.OnAction(action_id, player, ctx);
2648
2650 {
2651 if ( action_id ==
EActions.FOOD_STAGE_PREV )
2652 {
2654 if (food_stage_prev <= 0)
2655 {
2657 }
2659 return true;
2660 }
2661 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
2662 {
2665 {
2667 }
2669 return true;
2670 }
2671
2672 }
2673
2674 #ifdef DIAG_DEVELOPER
2675 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
2676 {
2677 PrintNutritionsData();
2678 return true;
2679 }
2680 #endif
2681
2682 return false;
2683 }
2684
2686 {
2687 string debug_output;
2688
2689 debug_output = super.GetDebugText();
2690
2693
2694 return debug_output;
2695 }
2696
2697
2698
2699
2700
2702 {
2703 float ret = super.GetBaitEffectivity();
2704
2706 {
2707 ret *= 0.5;
2708 }
2709
2710 return ret;
2711 }
2712
2714 {
2716 }
2717
2719 {
2721 }
2722
2724 {
2726 }
2727
2728 #ifdef DIAG_DEVELOPER
2729 private void PrintNutritionsData()
2730 {
2731 string nutritionsData = "";
2732
2735
2737 if (profile)
2738 {
2739 nutritionsData =
string.
Format(
"Item: %1\n\n",
this);
2741 nutritionsData +=
string.
Format(
"Energy: %1\n", profile.
m_Energy);
2745 nutritionsData +=
string.
Format(
"Toxicity (obsolete): %1\n", profile.
m_Toxicity);
2747
2750
2751 nutritionsData +=
string.
Format(
"Agents: %1\n", profile.
m_Agents);
2753 }
2754
2755 nutritionsData += "-----\n";
2756
2758 }
2759 #endif
2760
2762
2765 {
2767 }
2768}
2769
2771{
2773};
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.