Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/UnitAI.js
Show First 20 Lines • Show All 2,230 Lines • ▼ Show 20 Lines | "GATHER": { | ||||
this.gatheringTarget = this.order.data.target || INVALID_ENTITY; // deleted in "leave". | this.gatheringTarget = this.order.data.target || INVALID_ENTITY; // deleted in "leave". | ||||
// Check if the resource is full. | // Check if the resource is full. | ||||
// Will only be added if we're not already in. | // Will only be added if we're not already in. | ||||
let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); | let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); | ||||
let cmpSupply; | let cmpSupply; | ||||
if (cmpOwnership) | if (cmpOwnership) | ||||
cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply); | cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply); | ||||
if (!cmpSupply || !cmpSupply.AddGatherer(cmpOwnership.GetOwner(), this.entity)) | if (!cmpSupply || !cmpSupply.AddActiveGatherer(cmpOwnership.GetOwner(), this.entity)) | ||||
{ | { | ||||
this.SetNextState("FINDINGNEWTARGET"); | this.SetNextState("FINDINGNEWTARGET"); | ||||
return true; | return true; | ||||
} | } | ||||
// If this order was forced, the player probably gave it, but now we've reached the target | // If this order was forced, the player probably gave it, but now we've reached the target | ||||
// switch to an unforced order (can be interrupted by attacks) | // switch to an unforced order (can be interrupted by attacks) | ||||
this.order.data.force = false; | this.order.data.force = false; | ||||
▲ Show 20 Lines • Show All 4,019 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator