From a9cfbd9ad715a2902da57b6918fe9251c8aedd02 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 10 Mar 2017 19:34:41 +0000 Subject: [PATCH 1/2] Fix Obelisk not dropping targets when they move out of range. --- OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs b/OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs index cb13839ade..321f09513e 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackOmni.cs @@ -26,23 +26,25 @@ namespace OpenRA.Mods.Common.Traits public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove, bool forceAttack) { - return new SetTarget(this, newTarget); + return new SetTarget(this, newTarget, allowMove); } protected class SetTarget : Activity { readonly Target target; readonly AttackOmni attack; + readonly bool allowMove; - public SetTarget(AttackOmni attack, Target target) + public SetTarget(AttackOmni attack, Target target, bool allowMove) { this.target = target; this.attack = attack; + this.allowMove = allowMove; } public override Activity Tick(Actor self) { - if (IsCanceled || !target.IsValidFor(self)) + if (IsCanceled || !target.IsValidFor(self) || !attack.IsReachableTarget(target, allowMove)) return NextActivity; attack.DoAttack(self, target); From 4d2563cc118817eddef11fbda65c3b9c19bd99da Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 10 Mar 2017 19:42:18 +0000 Subject: [PATCH 2/2] Remove unnecessary AttackTesla : AttackOmni subclass. --- OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs b/OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs index 059328a342..b299acd215 100644 --- a/OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs +++ b/OpenRA.Mods.Cnc/Traits/Attack/AttackTesla.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc.Traits { [Desc("Implements the charge-then-burst attack logic specific to the RA tesla coil.")] - class AttackTeslaInfo : AttackOmniInfo + class AttackTeslaInfo : AttackBaseInfo { [Desc("How many charges this actor has to attack with, once charged.")] public readonly int MaxCharges = 1; @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Cnc.Traits public override object Create(ActorInitializer init) { return new AttackTesla(init.Self, this); } } - class AttackTesla : AttackOmni, ITick, INotifyAttack + class AttackTesla : AttackBase, ITick, INotifyAttack { readonly AttackTeslaInfo info;