Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 2,212 Lines • ▼ Show 20 Lines | "GATHER": { | ||||
else | else | ||||
{ | { | ||||
// Try to follow the target | // Try to follow the target | ||||
if (this.MoveToTargetRange(this.gatheringTarget, IID_ResourceGatherer)) | if (this.MoveToTargetRange(this.gatheringTarget, IID_ResourceGatherer)) | ||||
{ | { | ||||
this.SetNextState("APPROACHING"); | this.SetNextState("APPROACHING"); | ||||
return; | return; | ||||
} | } | ||||
// Our target is no longer visible - go to its last known position first | |||||
// and then hopefully it will become visible. | |||||
if (!this.CheckTargetVisible(target) && this.order.data.lastPos) | |||||
{ | |||||
this.PushOrderFront("Walk", { | |||||
"x": this.order.data.lastPos.x, | |||||
"z": this.order.data.lastPos.z, | |||||
"force": this.order.data.force | |||||
}); | |||||
return; | |||||
} | |||||
} | } | ||||
} | } | ||||
// We're already in range, can't get anywhere near it or the target is exhausted. | // We're already in range, can't get anywhere near it or the target is exhausted. | ||||
var herdPos = this.order.data.initPos; | var herdPos = this.order.data.initPos; | ||||
// Give up on this order and try our next queued order | // Give up on this order and try our next queued order | ||||
▲ Show 20 Lines • Show All 3,650 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator