Check whether the attack/gather target is visible and if not abort. Fixes #1662 and #1753.

This was SVN commit r12975.
This commit is contained in:
leper 2012-12-10 23:35:09 +00:00
parent 03e10011ad
commit 6fd6295644

View file

@ -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);