fix Tanya announcing her own death when walking over a mine
This commit is contained in:
@@ -15,9 +15,15 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public class HealthInfo : ITraitInfo, UsesInit<HealthInit>
|
public class HealthInfo : ITraitInfo, UsesInit<HealthInit>
|
||||||
{
|
{
|
||||||
|
[Desc("HitPoints")]
|
||||||
public readonly int HP = 0;
|
public readonly int HP = 0;
|
||||||
|
|
||||||
[Desc("Physical size of the unit used for damage calculations. Impacts within this radius apply full damage")]
|
[Desc("Physical size of the unit used for damage calculations. Impacts within this radius apply full damage")]
|
||||||
public readonly WRange Radius = new WRange(426);
|
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); }
|
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>())
|
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
|
||||||
nd.DamageStateChanged(self, ai);
|
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>()
|
foreach (var nd in repairer.TraitsImplementing<INotifyAppliedDamage>()
|
||||||
.Concat(repairer.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
.Concat(repairer.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||||
nd.AppliedDamage(repairer, self, ai);
|
nd.AppliedDamage(repairer, self, ai);
|
||||||
@@ -135,7 +141,7 @@ namespace OpenRA.Traits
|
|||||||
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
|
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
|
||||||
nd.DamageStateChanged(self, ai);
|
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>()
|
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
|
||||||
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||||
nd.AppliedDamage(attacker, self, ai);
|
nd.AppliedDamage(attacker, self, ai);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void AppliedDamage(Actor self, Actor damaged, AttackInfo e)
|
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)
|
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
|
||||||
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ MINP:
|
|||||||
Weapon: APMine
|
Weapon: APMine
|
||||||
Health:
|
Health:
|
||||||
HP: 100
|
HP: 100
|
||||||
|
NotifyAppliedDamage: false
|
||||||
Armor:
|
Armor:
|
||||||
Type: Light
|
Type: Light
|
||||||
RenderSimple:
|
RenderSimple:
|
||||||
@@ -35,6 +36,7 @@ MINV:
|
|||||||
Weapon: ATMine
|
Weapon: ATMine
|
||||||
Health:
|
Health:
|
||||||
HP: 100
|
HP: 100
|
||||||
|
NotifyAppliedDamage: false
|
||||||
Armor:
|
Armor:
|
||||||
Type: Light
|
Type: Light
|
||||||
RenderSimple:
|
RenderSimple:
|
||||||
|
|||||||
Reference in New Issue
Block a user