Make INotifyKilled require explicit implementation

This commit is contained in:
reaperrr
2018-04-29 04:46:23 +02:00
committed by Paul Chote
parent 7ca9aa5e0b
commit 3a82b13093
9 changed files with 9 additions and 8 deletions

View File

@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Scripting
} }
} }
public void Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
if (world.Disposing) if (world.Disposing)
return; return;

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info; this.info = info;
} }
public void Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
if (self.Owner.WinState == WinState.Lost || !self.World.Map.Contains(self.Location)) if (self.Owner.WinState == WinState.Lost || !self.World.Map.Contains(self.Location))
return; return;

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info; this.info = info;
} }
public void Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
if (e.Attacker == null || e.Attacker.Disposed) if (e.Attacker == null || e.Attacker.Disposed)
return; return;

View File

@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits
public class UpdatesPlayerStatistics : INotifyKilled public class UpdatesPlayerStatistics : INotifyKilled
{ {
public void Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
if (self.Owner.WinState != WinState.Undefined) if (self.Owner.WinState != WinState.Undefined)
return; return;

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits.Render
rs = self.Trait<RenderSprites>(); rs = self.Trait<RenderSprites>();
} }
public void Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
// Actors with Crushable trait will spawn CrushedSequence. // Actors with Crushable trait will spawn CrushedSequence.
if (crushed || IsTraitDisabled) if (crushed || IsTraitDisabled)

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info; this.info = info;
} }
public void Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(info.Intensity, self.CenterPosition, 1); self.World.WorldActor.Trait<ScreenShaker>().AddEffect(info.Intensity, self.CenterPosition, 1);
} }

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
this.info = info; this.info = info;
} }
public void Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
var player = info.NotifyAll ? self.World.LocalPlayer : self.Owner; var player = info.NotifyAll ? self.World.LocalPlayer : self.Owner;
Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Faction.InternalName); Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Faction.InternalName);

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
public DeathSounds(DeathSoundsInfo info) public DeathSounds(DeathSoundsInfo info)
: base(info) { } : base(info) { }
public void Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
if (IsTraitDisabled) if (IsTraitDisabled)
return; return;

View File

@@ -85,6 +85,7 @@ namespace OpenRA.Mods.Common.Traits
[RequireExplicitImplementation] [RequireExplicitImplementation]
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); } public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
[RequireExplicitImplementation]
public interface INotifyKilled { void Killed(Actor self, AttackInfo e); } public interface INotifyKilled { void Killed(Actor self, AttackInfo e); }
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); } public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }