Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 2,550 Lines • ▼ Show 20 Lines | "GATHER": { | ||||
if (nearbyResource) | if (nearbyResource) | ||||
{ | { | ||||
this.PerformGather(nearbyResource, false, false); | this.PerformGather(nearbyResource, false, false); | ||||
return true; | return true; | ||||
} | } | ||||
// Failing that, try to move there and se if we are more lucky: maybe there are resources in FOW. | // Failing that, try to move there and se if we are more lucky: maybe there are resources in FOW. | ||||
// Only move if we are some distance away (TODO: pick the distance better?) | // Only move if we are some distance away (TODO: pick the distance better?). | ||||
if (!this.CheckPointRangeExplicit(initPos.x, initPos.z, 0, 10)) | // Using the default relaxed range check since that is used in the WALKING-state. | ||||
if (!this.CheckPointRangeExplicit(initPos.x, initPos.z, 0, this.DefaultRelaxedMaxRange)) | |||||
{ | { | ||||
this.GatherNearPosition(initPos.x, initPos.z, resourceType, resourceTemplate); | this.GatherNearPosition(initPos.x, initPos.z, resourceType, resourceTemplate); | ||||
return true; | return true; | ||||
} | } | ||||
// Nothing else to gather - if we're carrying anything then we should | // Nothing else to gather - if we're carrying anything then we should | ||||
// drop it off, and if not then we might as well head to the dropsite | // drop it off, and if not then we might as well head to the dropsite | ||||
// anyway because that's a nice enough place to congregate and idle | // anyway because that's a nice enough place to congregate and idle | ||||
▲ Show 20 Lines • Show All 3,819 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator