161 {
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;
168
169
170 if (BleedChanceData.CalculateBleedChance(damageTypeString, damage, bleed_threshold,bleedingChance))
171 {
172 float roll = Math.RandomFloat01();
173 createBleedingSource = bleedingChance != 0 && bleedingChance >= roll;
174
175 #ifdef ENABLE_LOGGING
176 if (LogManager.IsBleedingChancesLogEnable())
177 {
178 Debug.BleedingChancesLog(roll.
ToString(),
"BleedingSourcesManagerServer" ,
"n/a",
"bleeding random roll:");
179 }
180 #endif
181 }
182 else if (source && source.IsZombie())
183 {
184 int chance = Math.RandomInt(0,100);
185 if (chance <= damage)
186 {
187 createBleedingSource = true;
188 }
189 }
190 else if (damage > (dmg_max * (1 - bleed_threshold)) )
191 {
192 createBleedingSource = true;
193 }
194
195 if (createBleedingSource)
196 {
197 #ifdef ENABLE_LOGGING
198 if (LogManager.IsBleedingChancesLogEnable())
199 {
200 Debug.BleedingChancesLog(
"true",
"BleedingSourcesManagerServer" ,
"n/a",
"Attempting to create bleeding source");
201 }
202 #endif
204 }
205 }
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool AttemptAddBleedingSource(int component)
proto native float ConfigGetFloat(string path)
Get float value from config on path.
string ConfigGetTextOut(string path)
Get string value from config on path.
proto string ToString(bool simple=true)
proto native CGame GetGame()