Added a Character.AddDamage override method that does damage to a specific limb instead of the limb closest to the source of the damage. Projectiles and melee weapons now always do damage to the limb they hit, even if the center point of some other limb happens to be closer.
Also refactored the IDamageable interface to make more sense; now the attacker has to be a character instead of an IDamageable and damageable classes don't need to have an AiTarget. Closes #69
This commit is contained in:
@@ -53,7 +53,7 @@ namespace Barotrauma
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
public virtual void OnAttacked(IDamageable attacker, float amount) { }
|
||||
public virtual void OnAttacked(Character attacker, float amount) { }
|
||||
|
||||
public virtual void SelectTarget(AITarget target) { }
|
||||
|
||||
|
||||
@@ -445,7 +445,7 @@ namespace Barotrauma
|
||||
targetEntity = closestBody.UserData as IDamageable;
|
||||
}
|
||||
|
||||
public override void OnAttacked(IDamageable attacker, float amount)
|
||||
public override void OnAttacked(Character attacker, float amount)
|
||||
{
|
||||
updateTargetsTimer = Math.Min(updateTargetsTimer, 0.1f);
|
||||
coolDownTimer *= 0.1f;
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAttacked(IDamageable attacker, float amount)
|
||||
public override void OnAttacked(Character attacker, float amount)
|
||||
{
|
||||
if (amount <= 0.0f) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user