From e80d59e851f706046f0dbe5458e7a075e5033fc4 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 28 Dec 2009 20:06:10 +1300 Subject: [PATCH] oops; forgot about the mouse buttons --- .../Traits/Activities/CaptureBuilding.cs | 19 +++++++++++++------ OpenRa.Game/Traits/C4Demolition.cs | 1 + OpenRa.Game/Traits/EngineerCapture.cs | 7 +++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/OpenRa.Game/Traits/Activities/CaptureBuilding.cs b/OpenRa.Game/Traits/Activities/CaptureBuilding.cs index 4df1009190..f074284346 100644 --- a/OpenRa.Game/Traits/Activities/CaptureBuilding.cs +++ b/OpenRa.Game/Traits/Activities/CaptureBuilding.cs @@ -16,14 +16,21 @@ namespace OpenRa.Game.Traits.Activities public IActivity Tick(Actor self) { if (target == null || target.IsDead) return NextActivity; - // todo: don't waste engineers on things that have been captured - // between order issue time and the time we hit the building. - target.Health -= EngineerCapture.EngineerDamage; - if (target.Health <= 0) + if (target.Owner == self.Owner) { - target.Owner = self.Owner; - target.Health = EngineerCapture.EngineerDamage; + if (target.Health == target.Info.Strength) + return NextActivity; + target.Health += EngineerCapture.EngineerDamage; + } + else + { + target.Health -= EngineerCapture.EngineerDamage; + if (target.Health <= 0) + { + target.Owner = self.Owner; + target.Health = EngineerCapture.EngineerDamage; + } } // the engineer is sacrificed. diff --git a/OpenRa.Game/Traits/C4Demolition.cs b/OpenRa.Game/Traits/C4Demolition.cs index 552d57cdbe..59dd65b68c 100644 --- a/OpenRa.Game/Traits/C4Demolition.cs +++ b/OpenRa.Game/Traits/C4Demolition.cs @@ -12,6 +12,7 @@ namespace OpenRa.Game.Traits public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor) { + if (mi.Button != MouseButton.Right) return null; if (underCursor == null) return null; if (underCursor.Owner == self.Owner && !mi.Modifiers.HasModifier(Modifiers.Ctrl)) return null; if (!underCursor.traits.Contains()) return null; diff --git a/OpenRa.Game/Traits/EngineerCapture.cs b/OpenRa.Game/Traits/EngineerCapture.cs index 31e9b8eaac..764983b4ac 100644 --- a/OpenRa.Game/Traits/EngineerCapture.cs +++ b/OpenRa.Game/Traits/EngineerCapture.cs @@ -8,10 +8,13 @@ namespace OpenRa.Game.Traits { class EngineerCapture : IOrder { - public const int EngineerDamage = 300; + public const int EngineerDamage = 300; // todo: push into rules, as a weapon + + public EngineerCapture(Actor self) { } public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor) { + if (mi.Button != MouseButton.Right) return null; if (underCursor == null) return null; if (!underCursor.traits.Contains()) return null; @@ -26,7 +29,7 @@ namespace OpenRa.Game.Traits if (order.OrderString == "Enter" || order.OrderString == "Capture") { self.CancelActivity(); - self.QueueActivity(new Move(order.TargetActor, 2)); + self.QueueActivity(new Move(order.TargetActor, 1)); self.QueueActivity(new CaptureBuilding(order.TargetActor)); } }