From 6fd629564429dbbf47aa896c9a4897d91b4e5cd1 Mon Sep 17 00:00:00 2001 From: leper Date: Mon, 10 Dec 2012 23:35:09 +0000 Subject: [PATCH] Check whether the attack/gather target is visible and if not abort. Fixes #1662 and #1753. This was SVN commit r12975. --- .../data/mods/public/simulation/components/UnitAI.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js index ce6ffea4e3..462c584068 100644 --- a/binaries/data/mods/public/simulation/components/UnitAI.js +++ b/binaries/data/mods/public/simulation/components/UnitAI.js @@ -649,8 +649,8 @@ var UnitFsmSpec = { // Check if we are already in range, otherwise walk there if (!this.CheckTargetRangeExplicit(msg.data.target, 0, maxRange)) { - if (!this.TargetIsAlive(msg.data.target)) - // The target was destroyed + if (!this.TargetIsAlive(msg.data.target) || !this.CheckTargetVisible(msg.data.target)) + // The target was destroyed or isn't visible any more. this.FinishOrder(); else // Out of range; move there in formation @@ -700,8 +700,8 @@ var UnitFsmSpec = { // Check if we are already in range, otherwise walk there if (!this.CheckTargetRangeExplicit(msg.data.target, 0, 10)) { - if (!this.CanGather(msg.data.target)) - // The target isn't gatherable + if (!this.CanGather(msg.data.target) || !this.CheckTargetVisible(msg.data.target)) + // The target isn't gatherable or not visible any more. this.FinishOrder(); // TODO: Should we issue a gather-near-position order // if the target isn't gatherable/doesn't exist anymore? @@ -851,7 +851,7 @@ var UnitFsmSpec = { cmpFormation.Disband(); }, }, - + "FORMING": { "MoveStarted": function(msg) { var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation);