From 17ef6efefc554e4e71dca43dac2ef99e031f436a Mon Sep 17 00:00:00 2001 From: Pavel Penev Date: Sat, 13 Feb 2016 19:49:43 +0200 Subject: [PATCH] Fix AttackFollow (and consequently AttackTurreted) firing at old target when the trait is reenabled Most noticeable by ordering a deployed Tick Tank to fire at the ground, then undeploying it and deploying it again. --- OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs b/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs index c9686ff459..d6611aba38 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs @@ -30,6 +30,12 @@ namespace OpenRA.Mods.Common.Traits public virtual void Tick(Actor self) { + if (IsTraitDisabled) + { + Target = Target.Invalid; + return; + } + DoAttack(self, Target); IsAttacking = Target.IsValidFor(self); }