From b18e7b222689fc9161ba8887ee579abde540a103 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 7 Jan 2010 01:02:14 +1300 Subject: [PATCH] Kill cargo on chronoshift --- OpenRa.Game/Traits/Chronoshiftable.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/OpenRa.Game/Traits/Chronoshiftable.cs b/OpenRa.Game/Traits/Chronoshiftable.cs index 98dc29d28c..7f86dca0be 100644 --- a/OpenRa.Game/Traits/Chronoshiftable.cs +++ b/OpenRa.Game/Traits/Chronoshiftable.cs @@ -53,8 +53,20 @@ namespace OpenRa.Game.Traits // Set up return-to-sender info chronoshiftOrigin = self.Location; chronoshiftReturnTicks = (int)(Rules.General.ChronoDuration * 60 * 25); - - // TODO: Kill cargo if Rules.General.ChronoKillCargo says so + + var chronosphere = Game.world.Actors.Where(a => a.Owner == order.Subject.Owner && a.traits.Contains()).FirstOrDefault(); + + // Kill cargo + if (Rules.General.ChronoKillCargo && self.traits.Contains()) + { + var cargo = self.traits.Get(); + while (!cargo.IsEmpty(self)) + { + if (chronosphere != null) + chronosphere.Owner.Kills++; + cargo.Unload(self); + } + } // Set up the teleport Game.controller.CancelInputMode(); @@ -66,7 +78,6 @@ namespace OpenRa.Game.Traits a.traits.Get().DoChronoshift(); // Play chronosphere active anim - var chronosphere = Game.world.Actors.Where(a => a.Owner == order.Subject.Owner && a.traits.Contains()).FirstOrDefault(); if (chronosphere != null) chronosphere.traits.Get().PlayCustomAnim(chronosphere, "active"); }