3 const string DIRECT_COOKING_SLOT_NAME =
"DirectCooking";
5 const string SOUND_BAKING_START =
"Baking_SoundSet";
6 const string SOUND_BAKING_DONE =
"Baking_Done_SoundSet";
7 const string SOUND_BOILING_START =
"Boiling_SoundSet";
8 const string SOUND_BOILING_DONE =
"Boiling_Done_SoundSet";
9 const string SOUND_DRYING_START =
"Drying_SoundSet";
10 const string SOUND_DRYING_DONE =
"Drying_Done_SoundSet";
11 const string SOUND_BURNING_DONE =
"Food_Burning_SoundSet";
32 RegisterNetSyncVariableFloat(
"m_FoodStage.m_CookingTime", 0, 600, 0);
37 RegisterNetSyncVariableBool(
"m_MakeCookingSounds");
45 UpdateVisualsEx(
true);
48 override void EEDelete(
EntityAI parent)
50 super.EEDelete(parent);
58 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
60 super.EEItemLocationChanged(oldLoc, newLoc);
65 switch (oldLoc.GetParent().GetType())
70 case "SharpWoodenStick":
71 MakeSoundsOnClient(
false);
76 if (oldLoc.GetSlot() > -1 && InventorySlots.GetSlotName(oldLoc.GetSlot()).Contains(DIRECT_COOKING_SLOT_NAME))
78 MakeSoundsOnClient(
false);
89 void UpdateVisualsEx(
bool forced =
false)
95 bool Consume(
float amount, PlayerBase consumer)
98 OnConsume(amount, consumer);
103 void OnConsume(
float amount, PlayerBase consumer)
105 if (
GetTemperature() > PlayerConstants.CONSUMPTION_DAMAGE_TEMP_THRESHOLD)
107 consumer.ProcessDirectDamage(
DamageType.CUSTOM,
this,
"",
"EnviroDmg",
"0 0 0", PlayerConstants.CONSUMPTION_DAMAGE_PER_BITE);
112 int FilterAgents(
int agentsIn)
118 foodStageType = foodStage.GetFoodStageType();
122 if ((agentsIn &
eAgents.SALMONELLA ==
eAgents.SALMONELLA) && (nutritionalProfile.m_Agents == 0 || nutritionalProfile.m_AgentsPerDigest == 0))
123 agentsIn &= ~eAgents.FOOD_POISON;
146 return super.GetTemperatureFreezeTime() * GameConstants.TEMPERATURE_FREEZE_TIME_COEF_DRIED;
149 return super.GetTemperatureFreezeTime() * GameConstants.TEMPERATURE_FREEZE_TIME_COEF_BURNED;
152 return super.GetTemperatureFreezeTime();
156 return super.GetTemperatureFreezeTime();
166 return super.GetTemperatureThawTime() * GameConstants.TEMPERATURE_THAW_TIME_COEF_DRIED;
169 return super.GetTemperatureThawTime() * GameConstants.TEMPERATURE_THAW_TIME_COEF_BURNED;
172 return super.GetTemperatureThawTime();
176 return super.GetTemperatureThawTime();
179 override bool CanItemOverheat()
194 super.OnVariablesSynchronized();
218 m_CookedByMethod = cookingMethod;
225 string soundName =
"";
232 soundName = SOUND_BURNING_DONE;
236 switch (m_CookedByMethod)
241 soundName = SOUND_BAKING_START;
243 soundName = SOUND_BAKING_DONE;
252 soundName = SOUND_BOILING_START;
254 soundName = SOUND_BOILING_DONE;
263 soundName = SOUND_DRYING_START;
265 soundName = SOUND_DRYING_DONE;
280 soundName = SOUND_BURNING_DONE;
285 nextStageProperties = FoodStage.GetAllCookingPropertiesForStage(nextFoodStage, null,
GetType());
286 float nextStageTime = nextStageProperties.Get(eCookingPropertyIndices.COOK_TIME);
288 if (progress01 > Cooking.BURNING_WARNING_THRESHOLD)
290 soundName = SOUND_BURNING_DONE;
310 super.OnStoreSave(ctx);
324 if (!super.OnStoreLoad(ctx, version))
347 UpdateVisualsEx(
true);
355 super.AfterStoreLoad();
393 Edible_Base food_item = Edible_Base.Cast(item);
396 return FoodStage.GetFullnessIndex(food_item.
GetFoodStage());
398 else if (classname !=
"" && food_stage)
400 return FoodStage.GetFullnessIndex(null, food_stage, classname);
402 string class_path =
string.Format(
"cfgVehicles %1 Nutrition", classname);
403 return g_Game.ConfigGetFloat( class_path +
" fullnessIndex" );
409 Edible_Base food_item = Edible_Base.Cast(item);
414 else if (classname !=
"" && food_stage)
416 return FoodStage.GetEnergy(null, food_stage, classname);
418 string class_path =
string.Format(
"cfgVehicles %1 Nutrition", classname);
419 return g_Game.ConfigGetFloat( class_path +
" energy" );
424 Edible_Base food_item = Edible_Base.Cast(item);
429 else if (classname !=
"" && food_stage)
431 return FoodStage.GetWater(null, food_stage, classname);
433 string class_path =
string.Format(
"cfgVehicles %1 Nutrition", classname);
434 return g_Game.ConfigGetFloat( class_path +
" water" );
439 Edible_Base food_item = Edible_Base.Cast(item);
442 return FoodStage.GetNutritionalIndex(food_item.
GetFoodStage());
444 else if (classname !=
"" && food_stage)
446 return FoodStage.GetNutritionalIndex(null, food_stage, classname);
448 string class_path =
string.Format(
"cfgVehicles %1 Nutrition", classname);
449 return g_Game.ConfigGetFloat( class_path +
" nutritionalIndex" );
455 Edible_Base food_item = Edible_Base.Cast(item);
460 else if (classname !=
"" && food_stage)
462 return FoodStage.GetToxicity(null, food_stage, classname);
464 string class_path =
string.Format(
"cfgVehicles %1 Nutrition", classname);
465 return g_Game.ConfigGetFloat( class_path +
" toxicity" );
470 Edible_Base food_item = Edible_Base.Cast(item);
475 else if (classname !=
"" && food_stage)
477 return FoodStage.GetAgents(null, food_stage, classname);
479 string class_path =
string.Format(
"cfgVehicles %1 Nutrition", classname);
480 return g_Game.ConfigGetInt( class_path +
" agents" );
485 Edible_Base food_item = Edible_Base.Cast(item);
488 return FoodStage.GetDigestibility(food_item.
GetFoodStage());
490 else if (classname !=
"" && food_stage)
492 return FoodStage.GetDigestibility(null, food_stage, classname);
494 string class_path =
string.Format(
"cfgVehicles %1 Nutrition", classname);
495 return g_Game.ConfigGetInt( class_path +
" digestibility" );
500 Edible_Base foodItem = Edible_Base.Cast(item);
503 return FoodStage.GetAgentsPerDigest(foodItem.
GetFoodStage());
505 else if (className !=
"" && foodStage)
507 return FoodStage.GetAgentsPerDigest(null, foodStage, className);
509 string classPath =
string.Format(
"cfgVehicles %1 Nutrition", className);
510 return g_Game.ConfigGetInt(classPath +
" agentsPerDigest");
516 profile.m_Energy =
GetFoodEnergy(item, classname, food_stage);
517 profile.m_WaterContent =
GetFoodWater(item, classname, food_stage);
521 profile.m_Agents =
GetFoodAgents(item, classname, food_stage);
605 return GetFoodStage().GetNextFoodStageType( cooking_method );
610 return GetFoodStage().GetFoodStageName( food_stage_type );
615 return GetFoodStage().CanChangeToNewStage( cooking_method );
621 if ( !source.GetFoodStage())
686 player.ServerReplaceItemInHandsWithNew(lambda);
689 Error(
"ReplaceEdibleWithNew - cannot use edible without player");
744 delta *= DayZGame.Cast(
g_Game).GetFoodDecayModifier();
746 if ( hasRootAsPlayer )
802 int rng =
Math.RandomIntInclusive( 0, 100 );
932 if (
g_Game.IsDedicatedServer())
938 GetInventory().GetCurrentInventoryLocation(invLoc);
961 GetInventory().GetCurrentInventoryLocation(inventoryLoc);
980 super.GetDebugActions(outputList);
985 super.OnAction(action_id, player, ctx);
989 if ( action_id ==
EActions.FOOD_STAGE_PREV )
992 if (food_stage_prev <= 0)
999 else if ( action_id ==
EActions.FOOD_STAGE_NEXT )
1012 #ifdef DIAG_DEVELOPER
1013 if (action_id ==
EActions.FOOD_NUTRITIONS_DATA)
1015 PrintNutritionsData();
1025 string debug_output;
1027 debug_output = super.GetDebugText();
1029 debug_output+=
"m_CookedByMethod:"+m_CookedByMethod+
"\n";
1032 return debug_output;
1041 float ret = super.GetBaitEffectivity();
1066 #ifdef DIAG_DEVELOPER
1067 private void PrintNutritionsData()
1069 string nutritionsData =
"";
1077 nutritionsData =
string.Format(
"Item: %1\n\n",
this);
1078 nutritionsData +=
string.Format(
"Stage name: %1\n",
GetFoodStageName(stageType));
1079 nutritionsData +=
string.Format(
"Energy: %1\n", profile.m_Energy);
1080 nutritionsData +=
string.Format(
"Water content: %1\n", profile.m_WaterContent);
1081 nutritionsData +=
string.Format(
"Nutritional index: %1\n", profile.m_NutritionalIndex);
1082 nutritionsData +=
string.Format(
"Fullness index: %1\n", profile.m_FullnessIndex);
1083 nutritionsData +=
string.Format(
"Toxicity (obsolete): %1\n", profile.m_Toxicity);
1084 nutritionsData +=
string.Format(
"Digestibility: %1\n", profile.m_Digestibility);
1086 if (profile.IsLiquid())
1087 nutritionsData +=
string.Format(
"Liquid type: %1\n", profile.m_LiquidClassname);
1089 nutritionsData +=
string.Format(
"Agents: %1\n", profile.m_Agents);
1090 nutritionsData +=
string.Format(
"Agents per consume: %1\n", profile.m_AgentsPerDigest);
1093 nutritionsData +=
"-----\n";
1095 Debug.Log(nutritionsData);
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
AttachActionData ActionData ActionAttach()
void AddAction(typename actionName)
override void OnStoreSave(ParamsWriteContext ctx)
static float GetAgentsPerDigest(ItemBase item, string className="", int foodStage=0)
FoodStageType GetFoodStageType()
override string GetDebugText()
EffectSound m_SoundEffectCooking
DEPRECATED.
FoodStageType GetNextFoodStageType(CookingMethodType cooking_method)
void HandleFoodStageChangeAgents(FoodStageType stageOld, FoodStageType stageNew)
removes select agents on foodstage transitions
override bool IsMushroom()
int GetConsumptionPenaltyContext()
void SoundCookingStart(string sound_name)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override float GetBaitEffectivity()
static float GetFoodTotalVolume(ItemBase item, string classname="", int food_stage=0)
string GetFoodStageName(FoodStageType food_stage_type)
void OnFoodStageChange(FoodStageType stageOld, FoodStageType stageNew)
called on server
static float GetFoodEnergy(ItemBase item, string classname="", int food_stage=0)
ParticleSource m_HotVaporParticle
void SetCookingTime(float time)
static float GetFoodDigestibility(ItemBase item, string classname="", int food_stage=0)
override void ProcessDecay(float delta, bool hasRootAsPlayer)
FoodStageType GetLastDecayStage()
override void SetActions()
SoundOnVehicle m_SoundCooking
static float GetFoodToxicity(ItemBase item, string classname="", int food_stage=0)
static float GetFoodNutritionalIndex(ItemBase item, string classname="", int food_stage=0)
static int GetFoodAgents(ItemBase item, string classname="", int food_stage=0)
override bool CanProcessDecay()
void ChangeFoodStage(FoodStageType new_food_stage_type)
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override FoodStage GetFoodStage()
void UpdateVaporParticle()
bool CanChangeToNewStage(CookingMethodType cooking_method)
ref FoodStage m_FoodStage
FoodStageType m_LastDecayStage
override void AfterStoreLoad()
void ReplaceEdibleWithNew(string typeName)
static NutritionalProfile GetNutritionalProfile(ItemBase item, string classname="", int food_stage=0)
static float GetFoodWater(ItemBase item, string classname="", int food_stage=0)
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
void TransferFoodStage(notnull Edible_Base source)
Wrapper class for managing sound through SEffectManager.
override void OnVariablesSynchronized()
Entity which has the particle instance as an ObjectComponent.
Manager class for managing Effect (EffectParticle, EffectSound).
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.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DamageType
exposed from C++ (do not change)
EConsumptionPenaltyContext
Edible_Base ItemBase ReplaceEdibleWithNewLambda(EntityAI old_item, string new_item_type, PlayerBase player)
override bool CanHaveTemperature()
Serializer ParamsReadContext
Serializer ParamsWriteContext
void Error(string err)
Messagebox with error message.
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
InventoryLocationType
types of Inventory Location
override void InsertAgent(int agent, float count=1)
override void RemoveAllAgentsExcept(int agent_to_keep)
override float GetTemperatureFreezeTime()
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...
override float GetTemperatureThawTime()
bool CanBeCookedOnStick()
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor).
ParticleAutoDestroyFlags
Flags to pass to ParticleSource.SetParticleAutoDestroyFlags.