33 super.AddBleedingSource(bit);
39 if(!super.RemoveBleedingSource(bit))
41 Error(
"Failed to remove bleeding source:" + bit);
48 int inverse_bit_mask = ~bit;
64 if (diceRoll < chanceToInfect)
76 int bleeding_sources_bits =
m_Player.GetBleedingBits();
77 int rightmost_bit = bleeding_sources_bits & (-bleeding_sources_bits);
97 int bleeding_sources_bits =
m_Player.GetBleedingBits();
100 int highest_flow_bit;
105 int bit = 1 << bit_offset;
107 if( (bit & bleeding_sources_bits) != 0 )
115 highest_flow_bit = bit;
122 return highest_flow_bit;
162 float dmg_max =
m_Player.GetMaxHealth(zone,
"Blood");
163 float bleed_threshold =
GetGame().
ConfigGetFloat(
"CfgAmmo " + ammo +
" DamageApplied bleedThreshold");
165 bleed_threshold =
Math.
Clamp(bleed_threshold,0,1);
166 float bleedingChance;
167 bool createBleedingSource =
false;
173 createBleedingSource = bleedingChance != 0 && bleedingChance >= roll;
175 #ifdef ENABLE_LOGGING
182 else if (source && source.IsZombie())
185 if (chance <= damage)
187 createBleedingSource =
true;
190 else if (damage > (dmg_max * (1 - bleed_threshold)) )
192 createBleedingSource =
true;
195 if (createBleedingSource)
197 #ifdef ENABLE_LOGGING
200 Debug.
BleedingChancesLog(
"true",
"BleedingSourcesManagerServer" ,
"n/a",
"Attempting to create bleeding source");
229 int active_bits =
m_Player.GetBleedingBits();
230 ctx.
Write(active_bits);
235 int bit = 1 << bit_offset;
236 if( (bit & active_bits) != 0 )
241 ctx.
Write(active_time);
251 if(!ctx.
Read(active_bits))
259 int bit = 1 << bit_offset;
264 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
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
void Error(string err)
Messagebox with error message.
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].