DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл Liquid.c

См. исходные тексты.

Структуры данных

class  LiquidInfo
 

Функции

static string GetLiquidClassname (int liquid_type)
 
static bool InitAllLiquids ()
 
static void Transfer (ItemBase source_ent, ItemBase target_ent, float quantity=-1)
 
static bool CanTransfer (ItemBase source_ent, ItemBase target_ent)
 
static void FillContainer (ItemBase container, int liquid_type, float amount)
 
static void FillContainerEnviro (ItemBase container, int liquid_type, float amount, bool inject_agents=true)
 
static void AffectContainerOnFill (ItemBase container, int liquid_type, float amount)
 
static bool IsLiquidDrinkWater (int liquidType)
 
static int TranslateLiquidType (int liquidType)
 Translates 'administrative' liquid types into liquid types with valid config class.
 
static bool CanFillContainer (ItemBase container, int liquid_type, bool ignore_fullness_check=false)
 
static float GetLiquidTypeEnviroTemperature (int liquidType)
 Gets liquid temperature from the enviroment.
 
static string GetLiquidConfigProperty (int liquid_type, string property_name, bool is_nutrition_property=false)
 
static NutritionalProfile GetNutritionalProfileByType (int liquid_type)
 
static NutritionalProfile GetNutritionalProfileByName (string class_name)
 
static NutritionalProfile SetUpNutritionalProfile (int liquid_type, string liquid_class_name)
 
static int GetAgents (int liquid_type)
 
static float GetToxicity (int liquid_type)
 
static float GetWaterContent (int liquid_type)
 
static float GetEnergy (int liquid_type)
 
static float GetNutritionalIndex (int liquid_type)
 
static string GetDisplayName (int liquid_type)
 
static float GetFlammability (int liquid_type)
 
static float GetFullness (int liquid_type)
 
static float GetDigestibility (int liquid_type)
 
static float GetFreezeThreshold (int liquid_type)
 
static float GetThawThreshold (int liquid_type)
 
static float GetBoilThreshold (int liquid_type)
 
static string GetName (int liquid_type)
 

Переменные

class LiquidInfo int
 
class LiquidInfo m_AllLiquidsByType = new map<int, ref NutritionalProfile>
 
static ref map< string, ref NutritionalProfilem_AllLiquidsByName = new map<string, ref NutritionalProfile>
 
static ref map< int, ref LiquidInfom_LiquidInfosByType = new map<int, ref LiquidInfo>
 
static ref map< string, ref LiquidInfom_LiquidInfosByName = new map<string, ref LiquidInfo>
 
static bool m_Init = InitAllLiquids()
 

Функции

◆ AffectContainerOnFill()

static void AffectContainerOnFill ( ItemBase container,
int liquid_type,
float amount )
static
202 {
203 container.AffectLiquidContainerOnFill(liquid_type,amount);
204 }
Definition EntityAI.c:95

Используется в FillContainerEnviro().

◆ CanFillContainer()

static bool CanFillContainer ( ItemBase container,
int liquid_type,
bool ignore_fullness_check = false )
static
223 {
224 if (!container)
225 return false;
226
227 bool is_container_full = container.IsFullQuantity();
228
230 {
231 //Debug.Log("container is full", "LiquidTransfer");
232 return false;
233
234 }
235 int container_mask = container.GetLiquidContainerMask();
236
237 if (container_mask == 0)
238 {
239 //Debug.Log("target is not a container", "LiquidTransfer");
240 return false;//if the target liquidContainerType is set to 0
241 }
242
243 if ((liquid_type & container_mask) == 0)
244 {
245 //Debug.Log("target liquidContainerType does not support this liquid type", "LiquidTransfer");
246 return false;
247 }
248
249 float container_quantity = container.GetQuantity();
250
251 int container_liquid_type = container.GetLiquidType();
252
254 {
255 //Debug.Log("target is not empty AND is of different liquid type than liquid_type added in", "LiquidTransfer");
256 return false;
257 }
258 return true;
259 }

Используется в CanTransfer() и FillContainer().

◆ CanTransfer()

static bool CanTransfer ( ItemBase source_ent,
ItemBase target_ent )
static
117 {
118 if (!source_ent || !target_ent)
119 return false;
120
123 if ((barrelTarget && !barrelTarget.IsOpen()) || (barrelSource && !barrelSource.IsOpen()))
124 {
125 return false;
126 }
127
128 if (source_ent.GetIsFrozen())
129 {
130 return false;
131 }
132
133 float source_quantity = source_ent.GetQuantity();
134 if (source_quantity <= 0)
135 {
136 //Debug.Log("source has no quantity", "LiquidTransfer");
137 return false;//if there is nothing to transfer
138 }
139
140 int source_liquid_type = source_ent.GetLiquidType();
141 if (source_liquid_type < 1)
142 {
143 //Debug.Log("source has some quantity, but does not have a valid liquidType set, liquidType = "+ToString(source_liquid_type), "LiquidTransfer");
144 return false;//if source is not a container
145 }
146
148 {
149 return false;
150 }
151
152 return true;
153 }
static bool CanFillContainer(ItemBase container, int liquid_type, bool ignore_fullness_check=false)
Definition Liquid.c:222
Definition Barrel_ColorBase.c:2

Перекрестные ссылки CanFillContainer().

◆ FillContainer()

static void FillContainer ( ItemBase container,
int liquid_type,
float amount )
static
156 {
158 {
159 return;
160 }
161 //filling
162 container.SetLiquidType(liquid_type);
163 container.AddQuantity(amount);
164 }

Перекрестные ссылки CanFillContainer().

Используется в FillContainerEnviro().

◆ FillContainerEnviro()

static void FillContainerEnviro ( ItemBase container,
int liquid_type,
float amount,
bool inject_agents = true )
static
167 {
168 float containerCfgWeight = container.m_ConfigWeight;
169 float retultTemp = (GetLiquidTypeEnviroTemperature(liquid_type) * amount + container.GetTemperature() * (containerCfgWeight + container.GetQuantity())) / (container.GetQuantity() + containerCfgWeight + amount);
170 container.SetTemperature(retultTemp);
172
174
175 if (inject_agents)
176 {
177 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
178 int agtSource;
179 switch (liquid_type)
180 {
185 break;
186 case LIQUID_SNOW:
188 break;
189 case LIQUID_HOTWATER:
191 break;
192 default:
194 break;
195 }
196
197 plugin.TransmitAgents(NULL, container, agtSource, amount);
198 }
199 }
static int TranslateLiquidType(int liquidType)
Translates 'administrative' liquid types into liquid types with valid config class.
Definition Liquid.c:214
static void FillContainer(ItemBase container, int liquid_type, float amount)
Definition Liquid.c:155
static float GetLiquidTypeEnviroTemperature(int liquidType)
Gets liquid temperature from the enviroment.
Definition Liquid.c:265
static void AffectContainerOnFill(ItemBase container, int liquid_type, float amount)
Definition Liquid.c:201
PluginBase GetPlugin(typename plugin_type)
Definition PluginManager.c:316
const int AGT_NONE
Definition constants.c:473
const int AGT_WATER_HOT_SPRING
Definition constants.c:487
const int AGT_WATER_POND
Definition constants.c:479
const int AGT_SNOW
Definition constants.c:485
const int LIQUID_STILLWATER
Definition constants.c:529
const int LIQUID_HOTWATER
Definition constants.c:530
const int LIQUID_FRESHWATER
Definition constants.c:528
const int LIQUID_RIVERWATER
Definition constants.c:519
const int LIQUID_SNOW
Definition constants.c:526

Перекрестные ссылки AffectContainerOnFill(), AGT_NONE, AGT_SNOW, AGT_WATER_HOT_SPRING, AGT_WATER_POND, FillContainer(), GetLiquidTypeEnviroTemperature(), GetPlugin(), LIQUID_FRESHWATER, LIQUID_HOTWATER, LIQUID_RIVERWATER, LIQUID_SNOW, LIQUID_STILLWATER и TranslateLiquidType().

◆ GetAgents()

static int GetAgents ( int liquid_type)
staticprivate
336 {
337 return m_LiquidInfosByType.Get(liquid_type).m_NutriProfile.GetAgents();
338 }
static ref map< int, ref LiquidInfo > m_LiquidInfosByType
Definition Liquid.c:41

Перекрестные ссылки m_LiquidInfosByType.

◆ GetBoilThreshold()

static float GetBoilThreshold ( int liquid_type)
staticprivate
391 {
392 return m_LiquidInfosByType.Get(liquid_type).m_TemperatureLiquidBoilThreshold;
393 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetDigestibility()

static float GetDigestibility ( int liquid_type)
staticprivate
376 {
377 return m_LiquidInfosByType.Get(liquid_type).m_NutriProfile.GetDigestibility();
378 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetDisplayName()

static string GetDisplayName ( int liquid_type)
staticprivate
361 {
362 return m_LiquidInfosByType.Get(liquid_type).m_LiquidDisplayName;
363 }

Перекрестные ссылки m_LiquidInfosByType.

Используется в CheckContactCache(), ManBase::EEHitBy() и Entity::InitDamageZoneDisplayNameMapping().

◆ GetEnergy()

static float GetEnergy ( int liquid_type)
staticprivate
351 {
352 return m_LiquidInfosByType.Get(liquid_type).m_NutriProfile.GetEnergy();
353 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetFlammability()

static float GetFlammability ( int liquid_type)
staticprivate
366 {
367 return m_LiquidInfosByType.Get(liquid_type).m_Flammability;
368 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetFreezeThreshold()

static float GetFreezeThreshold ( int liquid_type)
staticprivate
381 {
382 return m_LiquidInfosByType.Get(liquid_type).m_TemperatureLiquidFreezeThreshold;
383 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetFullness()

static float GetFullness ( int liquid_type)
staticprivate
371 {
372 return m_LiquidInfosByType.Get(liquid_type).m_NutriProfile.GetFullnessIndex();
373 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetLiquidClassname()

static string GetLiquidClassname ( int liquid_type)
static
46 {
48 if (info)
49 {
50 return info.m_LiquidClassName;
51 }
52
53 return "";
54 }
Definition Liquid.c:3

Перекрестные ссылки m_LiquidInfosByType.

◆ GetLiquidConfigProperty()

static string GetLiquidConfigProperty ( int liquid_type,
string property_name,
bool is_nutrition_property = false )
staticprivate
274 {
275 string cfg_classname = "cfgLiquidDefinitions";
276 string property_value = "NULL_PROPERTY";
277 int cfg_item_count = g_Game.ConfigGetChildrenCount(cfg_classname);
278
279 for (int i = 0; i < cfg_item_count; i++)
280 {
281 string liquid_class_name;
282 GetGame().ConfigGetChildName(cfg_classname, i, liquid_class_name);
283 string liquid_full_path = string.Format("%1 %2", cfg_classname, liquid_class_name);
284 int config_liquid_type = GetGame().ConfigGetInt(string.Format("%1 type", liquid_full_path));
285
286 if (config_liquid_type == liquid_type)// found the specific class, now lets extract the values
287 {
289 {
290 GetGame().ConfigGetText(string.Format("%1 %2", liquid_full_path, property_name), property_value);
291 return property_value;
292 }
293 else
294 {
295 GetGame().ConfigGetText(string.Format("%1 Nutrition %2", liquid_full_path, property_name), property_value);
296 return property_value;
297 }
298 }
299 }
300 return property_value;
301 }
DayZGame g_Game
Definition DayZGame.c:3815
proto native CGame GetGame()

Перекрестные ссылки g_Game и GetGame().

◆ GetLiquidTypeEnviroTemperature()

static float GetLiquidTypeEnviroTemperature ( int liquidType)
static

Gets liquid temperature from the enviroment.

Аргументы
[in]liquidTypeType of liquid.
266 {
267 float ret = GetGame().GetMission().GetWorldData().GetLiquidTypeEnviroTemperature(liquidType);
268 //ret = Math.Max(ret,GetLiquidFreezeThreshold(liquidType));
269
270 return ret;
271 }

Перекрестные ссылки GetGame().

Используется в FillContainerEnviro().

◆ GetName()

static string GetName ( int liquid_type)
staticprivate
399 {
400 return Liquid.GetLiquidConfigProperty(liquid_type, "name");
401 }

◆ GetNutritionalIndex()

static float GetNutritionalIndex ( int liquid_type)
staticprivate
356 {
357 return m_LiquidInfosByType.Get(liquid_type).m_NutriProfile.GetNutritionalIndex();
358 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetNutritionalProfileByName()

static NutritionalProfile GetNutritionalProfileByName ( string class_name)
staticprivate
313 {
315 if (info && info.m_NutriProfile)
316 return info.m_NutriProfile;
317
318 return null;
319 }
static ref map< string, ref LiquidInfo > m_LiquidInfosByName
Definition Liquid.c:42
class OptionSelectorMultistate extends OptionSelector class_name

Перекрестные ссылки class_name и m_LiquidInfosByName.

◆ GetNutritionalProfileByType()

static NutritionalProfile GetNutritionalProfileByType ( int liquid_type)
staticprivate
304 {
306 if (info && info.m_NutriProfile)
307 return info.m_NutriProfile;
308
309 return null;
310 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetThawThreshold()

static float GetThawThreshold ( int liquid_type)
staticprivate
386 {
387 return m_LiquidInfosByType.Get(liquid_type).m_TemperatureLiquidThawThreshold;
388 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetToxicity()

static float GetToxicity ( int liquid_type)
staticprivate
341 {
342 return m_LiquidInfosByType.Get(liquid_type).m_NutriProfile.GetToxicity();
343 }

Перекрестные ссылки m_LiquidInfosByType.

◆ GetWaterContent()

static float GetWaterContent ( int liquid_type)
staticprivate
346 {
347 return m_LiquidInfosByType.Get(liquid_type).m_NutriProfile.GetWaterContent();
348 }

Перекрестные ссылки m_LiquidInfosByType.

◆ InitAllLiquids()

static bool InitAllLiquids ( )
static
57 {
58 string cfg_classname = "cfgLiquidDefinitions";
59 string property_value = "NULL_PROPERTY";
60 int cfg_item_count = g_Game.ConfigGetChildrenCount(cfg_classname);
61
62 for (int i = 0; i < cfg_item_count; i++)
63 {
64 string liquid_class_name;
65 GetGame().ConfigGetChildName(cfg_classname, i, liquid_class_name);
66 string liquid_full_path = string.Format("%1 %2",cfg_classname, liquid_class_name);
67 int config_liquid_type = GetGame().ConfigGetInt(string.Format("%1 type", liquid_full_path));
68
73
74 //legacy stuff
77 }
78 return true;
79 }
class LiquidInfo m_AllLiquidsByType
static NutritionalProfile SetUpNutritionalProfile(int liquid_type, string liquid_class_name)
Definition Liquid.c:321
static ref map< string, ref NutritionalProfile > m_AllLiquidsByName
Definition Liquid.c:40
Definition NutritionalProfile.c:2

Перекрестные ссылки g_Game, GetGame(), m_AllLiquidsByName, m_AllLiquidsByType, m_LiquidInfosByName, m_LiquidInfosByType и SetUpNutritionalProfile().

◆ IsLiquidDrinkWater()

static bool IsLiquidDrinkWater ( int liquidType)
static
207 {
209 return true;
210 return false;
211 }
const int LIQUID_GROUP_DRINKWATER
Definition constants.c:533

Перекрестные ссылки LIQUID_GROUP_DRINKWATER.

Используется в TranslateLiquidType().

◆ SetUpNutritionalProfile()

static NutritionalProfile SetUpNutritionalProfile ( int liquid_type,
string liquid_class_name )
staticprivate
322 {
323 float energy = Liquid.GetLiquidConfigProperty(liquid_type, "energy", true).ToFloat();
324 float nutritional_index = Liquid.GetLiquidConfigProperty(liquid_type, "nutritionalIndex", true).ToFloat();
325 float volume = Liquid.GetLiquidConfigProperty(liquid_type, "fullnessIndex", true).ToFloat();
326 float water_content = Liquid.GetLiquidConfigProperty(liquid_type, "water", true).ToFloat();
327 float toxicity = Liquid.GetLiquidConfigProperty(liquid_type, "toxicity", true).ToFloat();
328 int agents = Liquid.GetLiquidConfigProperty(liquid_type, "agents", true).ToInt();
329 float digest = Liquid.GetLiquidConfigProperty(liquid_type, "digestibility", true).ToFloat();
332 return profile;
333 }

Используется в InitAllLiquids().

◆ Transfer()

static void Transfer ( ItemBase source_ent,
ItemBase target_ent,
float quantity = -1 )
static
83 {
84 if (!Liquid.CanTransfer(source_ent, target_ent))
85 return;
86
87 float source_quantity = source_ent.GetQuantity();
88 float target_quantity = target_ent.GetQuantity();
89 float targetCfgWeight = target_ent.m_ConfigWeight;
90 int source_liquid_type = source_ent.GetLiquidType();
91
92 float available_capacity = target_ent.GetQuantityMax() - target_quantity;
94 //transfers all
95 if (quantity == -1)
96 {
98 }
99 //transfers exact ammount
100 else
101 {
103 }
104
105 PluginTransmissionAgents m_mta = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
107
108 source_ent.AddQuantity(-quantity_to_transfer);
109
111 target_ent.SetTemperature(retultTemp);
112
114 }
Definition EnMath.c:7
const int AGT_TRANSFER_COPY
Definition constants.c:477
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float Min(float x, float y)
Returns smaller of two given values.

Перекрестные ссылки AGT_TRANSFER_COPY, Math::Clamp(), GetPlugin() и Math::Min().

◆ TranslateLiquidType()

static int TranslateLiquidType ( int liquidType)
static

Translates 'administrative' liquid types into liquid types with valid config class.

215 {
217 return LIQUID_WATER;
218 else
219 return liquidType;
220 }
static bool IsLiquidDrinkWater(int liquidType)
Definition Liquid.c:206
const int LIQUID_WATER
Definition constants.c:518

Перекрестные ссылки IsLiquidDrinkWater() и LIQUID_WATER.

Используется в FillContainerEnviro().

Переменные

◆ int

◆ m_AllLiquidsByName

Используется в InitAllLiquids().

◆ m_AllLiquidsByType

class LiquidInfo m_AllLiquidsByType = new map<int, ref NutritionalProfile>

Используется в InitAllLiquids().

◆ m_Init

bool m_Init = InitAllLiquids()
static

◆ m_LiquidInfosByName

ref map<string, ref LiquidInfo> m_LiquidInfosByName = new map<string, ref LiquidInfo>
static

Используется в GetNutritionalProfileByName() и InitAllLiquids().

◆ m_LiquidInfosByType