diff --git a/OpenRA.Game/Traits/Health.cs b/OpenRA.Game/Traits/Health.cs index bddc9c9c74..2d18176c1f 100755 --- a/OpenRA.Game/Traits/Health.cs +++ b/OpenRA.Game/Traits/Health.cs @@ -15,9 +15,15 @@ namespace OpenRA.Traits { public class HealthInfo : ITraitInfo, UsesInit { + [Desc("HitPoints")] public readonly int HP = 0; + [Desc("Physical size of the unit used for damage calculations. Impacts within this radius apply full damage")] public readonly WRange Radius = new WRange(426); + + [Desc("Don't trigger interfaces such as AnnounceOnKill.")] + public readonly bool NotifyAppliedDamage = true; + public virtual object Create(ActorInitializer init) { return new Health(init, this); } } @@ -92,7 +98,7 @@ namespace OpenRA.Traits foreach (var nd in self.TraitsImplementing()) nd.DamageStateChanged(self, ai); - if (repairer != null && repairer.IsInWorld && !repairer.IsDead()) + if (Info.NotifyAppliedDamage && repairer != null && repairer.IsInWorld && !repairer.IsDead()) foreach (var nd in repairer.TraitsImplementing() .Concat(repairer.Owner.PlayerActor.TraitsImplementing())) nd.AppliedDamage(repairer, self, ai); @@ -135,7 +141,7 @@ namespace OpenRA.Traits foreach (var nd in self.TraitsImplementing()) nd.DamageStateChanged(self, ai); - if (attacker != null && attacker.IsInWorld && !attacker.IsDead()) + if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead()) foreach (var nd in attacker.TraitsImplementing() .Concat(attacker.Owner.PlayerActor.TraitsImplementing())) nd.AppliedDamage(attacker, self, ai); diff --git a/OpenRA.Mods.RA/AnnounceOnKill.cs b/OpenRA.Mods.RA/AnnounceOnKill.cs index c45b19e7ce..fc5ef1c245 100644 --- a/OpenRA.Mods.RA/AnnounceOnKill.cs +++ b/OpenRA.Mods.RA/AnnounceOnKill.cs @@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA public void AppliedDamage(Actor self, Actor damaged, AttackInfo e) { - if (e.DamageState == DamageState.Dead) + if (e.DamageState == DamageState.Dead && damaged != e.Attacker) // don't notify suicides { if (self.World.WorldTick - lastAnnounce > info.Interval * 25) Sound.PlayVoice("Kill", self, self.Owner.Country.Race); diff --git a/mods/ra/rules/misc.yaml b/mods/ra/rules/misc.yaml index 08bbc5973b..db63c0f944 100644 --- a/mods/ra/rules/misc.yaml +++ b/mods/ra/rules/misc.yaml @@ -7,6 +7,7 @@ MINP: Weapon: APMine Health: HP: 100 + NotifyAppliedDamage: false Armor: Type: Light RenderSimple: @@ -35,6 +36,7 @@ MINV: Weapon: ATMine Health: HP: 100 + NotifyAppliedDamage: false Armor: Type: Light RenderSimple: