/// <summary> /// Determine if there is any blood damage (toxin, oxygen loss) or bleeding that needs to occur /// Server only! /// </summary> public void AffectBloodState(BodyPartType bodyPartType, DamageType damageType, float amount, bool isHeal = false) { BodyPartBehaviour bodyPart = livingHealthBehaviour.FindBodyPart(bodyPartType); if (isHeal) { CheckHealing(bodyPart, damageType, amount); return; } //Check if limb should start bleeding (Bleeding is only for Players, not animals) if (damageType == DamageType.Brute) { int bloodLoss = (int)(Mathf.Clamp(amount, 0f, 10f) * BleedFactor(damageType)); // start bleeding if the limb is really damaged if (bodyPart.BruteDamage > 40) { AddBloodLoss(bloodLoss, bodyPart); } } if (damageType == DamageType.Tox) { ToxinLevel += amount; } }
/// <summary> /// Determine if there is any blood damage (toxin, oxygen loss) or bleeding that needs to occur /// Server only! /// </summary> public void AffectBloodState(BodyPartType bodyPartType, DamageType damageType, float amount, bool isHeal = false) { BodyPartBehaviour bodyPart = livingHealthBehaviour.FindBodyPart(bodyPartType); if (isHeal) { CheckHealing(bodyPart, damageType, amount); return; } //Check if limb should start bleeding (Bleeding is only for Players, not animals) if (damageType == DamageType.Brute) { int bloodLoss = (int)(Mathf.Clamp(amount, 0f, 10f) * BleedFactor(damageType)); // don't start bleeding if limb is in ok condition after it received damage switch (bodyPart.Severity) { case DamageSeverity.Light: case DamageSeverity.LightModerate: case DamageSeverity.Moderate: case DamageSeverity.Bad: case DamageSeverity.Critical: LoseBlood(bloodLoss); AddBloodLoss(bloodLoss); break; default: //For particularly powerful hits when a body part is fine if (amount > 40) { LoseBlood(bloodLoss); AddBloodLoss(bloodLoss); } break; } } if (damageType == DamageType.Tox) { ToxinLevel += amount; } }