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 =
GetGame().
ConfigGetFloat(
"CfgAmmo " + ammo +
" DamageApplied bleedThreshold");
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))
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
static bool CalculateBleedChance(string damageType, float bloodDamage, float bleedThreshold, out float bleedChance)
returns 'false' when damageType is unhandled
Static data of bleeding chance probabilities; currently used for melee only.
void DebugActivateBleedingSource(int source)
void SetBloodLoss(bool status)
int GetBleedingSourceActiveTime(int bit)
void SetItem(ItemBase item)
void RemoveMostSignificantBleedingSource()
void OnTick(float delta_time)
void AddBleedingSource(int bit)
int GetMostSignificantBleedingSource()
void OnStoreSave(ParamsWriteContext ctx)
bool AttemptAddBleedingSource(int component)
eBleedingSourceType GetBleedingSourceType(int bit)
BleedingSourceZone GetBleedingSourceMeta(int bit)
string GetSelectionNameFromBit(int bit)
ref map< int, ref BleedingSource > m_BleedingSources
ref array< int > m_DeleteList
void SetBleedingSourceActiveTime(int bit, int time)
void ProcessHit(float damage, EntityAI source, int component, string zone, string ammo, vector modelPos)
void RemoveAnyBleedingSource()
void ~BleedingSourcesManagerServer()
const float TICK_INTERVAL_SEC
bool RemoveBleedingSource(int bit)
bool CanAddBleedingSource(int bit)
ref map< string, ref BleedingSourceZone > m_BleedingSourceZone
bool OnStoreLoad(ParamsReadContext ctx, int version)
void SetBleedingSourceType(int bit, eBleedingSourceType type)
void RequestDeletion(int bit)
void RemoveMostSignificantBleedingSourceEx(ItemBase item)
BleedingSourceZone GetBleedingSourceZone(int bit)
const int STORAGE_VERSION
bool m_ProcessSourcesRemoval
proto native float ConfigGetFloat(string path)
Get float value from config on path.
string ConfigGetTextOut(string path)
Get string value from config on path.
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_LOW_PRESSURE_MIN_MOD
static const float BLEEDING_LOW_PRESSURE_BLOOD
static const float BLEEDING_SOURCE_CLOSE_INFECTION_CHANCE
static const int BLOOD_THRESHOLD_FATAL
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
proto native CGame GetGame()
Serializer ParamsWriteContext
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
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 proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].