39 super.AddBleedingSource(bit);
45 if (super.RemoveBleedingSource(bit))
59 if (diceRoll < chanceToInfect)
69 int inverse_bit_mask = ~bit;
78 int bleeding_sources_bits =
m_Player.GetBleedingBits();
79 int rightmost_bit = bleeding_sources_bits & (-bleeding_sources_bits);
99 int bleeding_sources_bits =
m_Player.GetBleedingBits();
102 int highest_flow_bit;
107 int bit = 1 << bit_offset;
109 if ((bit & bleeding_sources_bits) != 0)
117 highest_flow_bit = bit;
124 return highest_flow_bit;
169 float dmg_max =
m_Player.GetMaxHealth(zone,
"Blood");
170 float bleed_threshold =
g_Game.ConfigGetFloat(
"CfgAmmo " + ammo +
" DamageApplied bleedThreshold");
171 string damageTypeString =
g_Game.ConfigGetTextOut(
"CfgAmmo " + ammo +
" DamageApplied type");
172 bleed_threshold =
Math.
Clamp(bleed_threshold,0,1);
173 float bleedingChance;
174 bool createBleedingSource =
false;
180 createBleedingSource = bleedingChance != 0 && bleedingChance >= roll;
182 #ifdef ENABLE_LOGGING
189 else if (source && source.IsZombie())
192 if (chance <= damage)
194 createBleedingSource =
true;
197 else if (damage > (dmg_max * (1 - bleed_threshold)))
199 createBleedingSource =
true;
202 if (createBleedingSource)
204 #ifdef ENABLE_LOGGING
207 Debug.
BleedingChancesLog(
"true",
"BleedingSourcesManagerServer" ,
"n/a",
"Attempting to create bleeding source");
236 int active_bits =
m_Player.GetBleedingBits();
237 ctx.
Write(active_bits);
242 int bit = 1 << bit_offset;
243 if ((bit & active_bits) != 0)
248 ctx.
Write(active_time);
258 if (!ctx.
Read(active_bits))
266 int bit = 1 << bit_offset;
271 if (!ctx.
Read(active_time))
Static data of bleeding chance probabilities; currently used for melee only.
static bool CalculateBleedChance(string damageType, float bloodDamage, float bleedThreshold, out float bleedChance)
returns 'false' when damageType is unhandled
void ProcessHit(float damage, EntityAI source, int component, string zone, string ammo, vector modelPos)
int GetMostSignificantBleedingSource()
void SetBleedingSourceActiveTime(int bit, int time)
void SetItem(ItemBase item)
void ~BleedingSourcesManagerServer()
const int STORAGE_VERSION
ref map< int, ref BleedingSource > m_BleedingSources
void RequestDeletion(int bit)
void SetBloodLoss(bool status)
void SetBleedingSourceType(int bit, eBleedingSourceType type)
bool CanAddBleedingSource(int bit)
string GetSelectionNameFromBit(int bit)
bool m_ProcessSourcesRemoval
eBleedingSourceType GetBleedingSourceType(int bit)
int GetBleedingSourceActiveTime(int bit)
BleedingSourceZone GetBleedingSourceZone(int bit)
ref map< string, ref BleedingSourceZone > m_BleedingSourceZone
ref array< int > m_DeleteList
bool RemoveBleedingSource(int bit)
void RemoveAnyBleedingSource()
bool OnStoreLoad(ParamsReadContext ctx, int version)
const float TICK_INTERVAL_SEC
BleedingSourceZone GetBleedingSourceMeta(int bit)
void OnTick(float delta_time)
void AddBleedingSource(int bit)
void OnStoreSave(ParamsWriteContext ctx)
bool AttemptAddBleedingSource(int component)
void DebugActivateBleedingSource(int source)
void RemoveMostSignificantBleedingSource()
void RemoveMostSignificantBleedingSourceEx(ItemBase item)
static ref Param1< bool > PARAM1_BOOL
static void BleedingChancesLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
static bool IsBleedingChancesLogEnable()
static const float BLEEDING_SOURCE_CLOSE_INFECTION_CHANCE
static const float BLEEDING_LOW_PRESSURE_MIN_MOD
static const int BLOOD_THRESHOLD_FATAL
static const float BLEEDING_LOW_PRESSURE_BLOOD
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
Serializer ParamsReadContext
Serializer ParamsWriteContext
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
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 InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.