67 bool ProcessDigestion(
float digestion_points, out
float water, out
float energy, out
float toxicity, out
float volume, out
int agents, out
float consumed_amount)
78 float energy_per_unit = profile.
GetEnergy() / 100;
83 if(digestability == 0)
88 float consumed_quantity = digestion_points * digestability;
94 if ( consumed_quantity > 0 )
96 water = consumed_quantity * water_per_unit;
97 energy = consumed_quantity * energy_per_unit;
98 toxicity = consumed_quantity * toxicity_per_unit;
100 return consumed_quantity;
161 int hash = classname.
Hash();
185 all_paths.Insert(
"CfgVehicles");
186 all_paths.Insert(
"cfgLiquidDefinitions");
192 int consumable_count;
193 for(
int i = 0; i < all_paths.Count(); i++)
195 config_path = all_paths.Get(i);
198 for(
int x = 0;
x < children_count;
x++)
201 path = config_path +
" " + child_name;
203 bool should_check = 1;
204 if( config_path ==
"CfgVehicles" && scope == 0)
214 if(has_nutrition || has_stages)
253 if(stomach_items_count == 0)
256 float digestion_points_per_item = (
DIGESTION_POINTS / stomach_items_count) * delta_time;
261 float water, energy, toxicity, volume, consumed_amount;
263 if(item.
ProcessDigestion( digestion_points_per_item, water, energy, toxicity, volume, agents, consumed_amount ))
269 m_Player.GetStatEnergy().Add(energy);
291 agents = agents & (~m_AgentTransferFilter);
292 int highest_bit =
Math.
Log2(agents) + 1;
293 for(
int i = 0; i < highest_bit;i++)
295 int agent = (1 << i)& agents;
298 m_Player.m_AgentPool.DigestAgent(agent, quantity);
305 Print(
"================================");
313 Print(
"itemname:" + itemname);
314 Print(
"amount:" + amount);
315 Print(
"food_stage:" + food_stage);
316 Print(
"agents:" + agents);
320 Print(
"================================");
359 if (is_liquid || stomach_item.
GetFoodStage() == food_stage)
389 ctx.
Write( write_result );
399 if(!ctx.
Read(checksum))
408 for(
int i = 0; i < count; i++)
411 if(!ctx.
Read(value) )
415 if(!ctx.
Read(agents) )
425 int food_stage = value & food_mask;
437 Print(
"Stomach checksum fail");
451 Param4<int,int,int,float> p4 =
new Param4<int,int,int,float>(
id, food_stage, agents, amount);
452 object_out.Insert(p4);
455 object_out.Insert(p1);
class RecipeCacheData int
void OnStoreSave(ParamsWriteContext ctx)
const int STORAGE_VERSION
bool OnStoreLoad(ParamsReadContext ctx, int version)
class OptionSelectorMultistate extends OptionSelector class_name
void AddToStomach(string class_name, float amount, int food_stage=0, int agents=0)
const int ACCEPTABLE_QUANTITY_MAX
const int ACCEPTABLE_FOODSTAGE_MAX
int GetAgentTransferFilter()
static ref map< int, string > m_IDsToNames
const float DIGESTION_POINTS
class StomachItem DIGESTING_WATER
const int quantity_bit_offset
void DigestAgents(int agents, float quantity)
int GetDebugObject(array< ref Param > object_out)
const int DIGESTING_ENERGY
void ProcessNutrients(float delta_time)
static void RegisterItem(string classname, int id)
static string GetClassnameFromID(int id)
void SetAgentTransferFilter(int filter_agents)
ref array< ref StomachItem > m_StomachContents
static const bool m_InitData
static int GetIDFromClassname(string name)
int m_AgentTransferFilter
static ref map< string, int > m_NamesToIDs
void PlayerStomach(PlayerBase player)
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native int ConfigGetInt(string path)
Get int value from config on path.
proto native bool ConfigIsExisting(string path)
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
static NutritionalProfile GetNutritionalProfileByName(string class_name)
static const float DIGESTION_SPEED
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
void AddAgents(int agents)
void SetFoodStage(int food_stage)
bool ProcessDigestion(float digestion_points, out float water, out float energy, out float toxicity, out float volume, out int agents, out float consumed_amount)
void StomachItem(string class_name, float amount, NutritionalProfile profile, int foodstage, int agents)
float GetNutritions(float digestion_points, NutritionalProfile profile, out float water, out float energy, out float toxicity)
void AddAmount(float amount)
ref NutritionalProfile m_Profile
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
array< string > TStringArray
static proto float Log2(float x)
Returns the binary (base-2) logarithm of x.
static proto float Pow(float v, float power)
Return power of v ^ power.
proto native int Hash()
Returns hash of string.