fix Tanya announcing her own death when walking over a mine

This commit is contained in:
Matthias Mailänder
2014-10-11 12:39:20 +02:00
parent 399275e5f3
commit 2e5aab332e
3 changed files with 11 additions and 3 deletions

View File

@@ -15,9 +15,15 @@ namespace OpenRA.Traits
{
public class HealthInfo : ITraitInfo, UsesInit<HealthInit>
{
[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<INotifyDamageStateChanged>())
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<INotifyAppliedDamage>()
.Concat(repairer.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
nd.AppliedDamage(repairer, self, ai);
@@ -135,7 +141,7 @@ namespace OpenRA.Traits
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
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<INotifyAppliedDamage>()
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
nd.AppliedDamage(attacker, self, ai);

View File

@@ -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);

View File

@@ -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: