Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 581 Lines • ▼ Show 20 Lines | if (this.MustKillGatherTarget(this.order.data.target)) | ||||
else | else | ||||
{ | { | ||||
// We couldn't move there, or the target moved away | // We couldn't move there, or the target moved away | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
this.PushOrderFront("Attack", { "target": this.order.data.target, "force": false, "hunting": true, "allowCapture": false }); | this.PushOrderFront("Attack", { "target": this.order.data.target, "force": !!this.order.data.force, "hunting": true, "allowCapture": false }); | ||||
return; | return; | ||||
} | } | ||||
// Try to move within range | // Try to move within range | ||||
if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer)) | if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer)) | ||||
{ | { | ||||
// We've started walking to the given point | // We've started walking to the given point | ||||
this.SetNextState("INDIVIDUAL.GATHER.APPROACHING"); | this.SetNextState("INDIVIDUAL.GATHER.APPROACHING"); | ||||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | "Order.Gather": function(msg) { | ||||
else | else | ||||
{ | { | ||||
// We couldn't move there, or the target moved away | // We couldn't move there, or the target moved away | ||||
this.FinishOrder(); | this.FinishOrder(); | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
this.PushOrderFront("Attack", { "target": msg.data.target, "hunting": true, "allowCapture": false }); | this.PushOrderFront("Attack", { "target": msg.data.target, "force": !!msg.data.force, "hunting": true, "allowCapture": false }); | ||||
return; | return; | ||||
} | } | ||||
// TODO: on what should we base this range? | // TODO: on what should we base this range? | ||||
// Check if we are already in range, otherwise walk there | // Check if we are already in range, otherwise walk there | ||||
if (!this.CheckTargetRangeExplicit(msg.data.target, 0, 10)) | if (!this.CheckTargetRangeExplicit(msg.data.target, 0, 10)) | ||||
{ | { | ||||
if (!this.CanGather(msg.data.target) || !this.CheckTargetVisible(msg.data.target)) | if (!this.CanGather(msg.data.target) || !this.CheckTargetVisible(msg.data.target)) | ||||
▲ Show 20 Lines • Show All 5,049 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator