From 94b2055eb2113a0024683fa2bb33117a065c7e96 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 2 May 2010 13:31:56 +1200 Subject: [PATCH] added tracking of deaths as well as kills --- OpenRA.Game/Actor.cs | 5 +++-- OpenRA.Game/Player.cs | 1 + OpenRA.Mods.Aftermath/DemoTruck.cs | 1 + OpenRA.Mods.RA/Chronoshiftable.cs | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 14a7ae115f..329e24aad3 100755 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -185,8 +185,9 @@ namespace OpenRA if (Health <= 0) { Health = 0; - if (attacker.Owner != null) - attacker.Owner.Kills++; + + attacker.Owner.Kills++; + Owner.Deaths++; if (RemoveOnDeath) World.AddFrameEndTask(w => w.Remove(this)); diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index b30ab049b3..af4dc78838 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -33,6 +33,7 @@ namespace OpenRA { public Actor PlayerActor; public int Kills; + public int Deaths; public readonly string Palette; public readonly Color Color; diff --git a/OpenRA.Mods.Aftermath/DemoTruck.cs b/OpenRA.Mods.Aftermath/DemoTruck.cs index 35868f998f..42a8220f01 100644 --- a/OpenRA.Mods.Aftermath/DemoTruck.cs +++ b/OpenRA.Mods.Aftermath/DemoTruck.cs @@ -64,6 +64,7 @@ namespace OpenRA.Mods.Aftermath // Remove from world self.Health = 0; detonatedBy.Owner.Kills++; + self.Owner.Deaths++; w.Remove(self); } ); } diff --git a/OpenRA.Mods.RA/Chronoshiftable.cs b/OpenRA.Mods.RA/Chronoshiftable.cs index 03e7a3f42a..d5bf028aa8 100755 --- a/OpenRA.Mods.RA/Chronoshiftable.cs +++ b/OpenRA.Mods.RA/Chronoshiftable.cs @@ -68,7 +68,8 @@ namespace OpenRA.Mods.RA while (!cargo.IsEmpty(self)) { chronosphere.Owner.Kills++; - cargo.Unload(self); + var a = cargo.Unload(self); + a.Owner.Deaths++; } }