Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/ai/petra/worker.js
Show First 20 Lines • Show All 667 Lines • ▼ Show 20 Lines | PETRA.Worker.prototype.startGathering = function(gameState) | ||||
// Still nothing, we look now for faraway resources, first in the accessible ones, then in the others | // Still nothing, we look now for faraway resources, first in the accessible ones, then in the others | ||||
// except for food when farms or corrals can be used | // except for food when farms or corrals can be used | ||||
let allowDistant = true; | let allowDistant = true; | ||||
if (resource == "food") | if (resource == "food") | ||||
{ | { | ||||
if (gameState.ai.HQ.turnCache.allowDistantFood === undefined) | if (gameState.ai.HQ.turnCache.allowDistantFood === undefined) | ||||
gameState.ai.HQ.turnCache.allowDistantFood = | gameState.ai.HQ.turnCache.allowDistantFood = | ||||
!gameState.ai.HQ.canBuild(gameState, "structures/{civ}_field") && | !gameState.ai.HQ.canBuild(gameState, "structures/{civ}/field") && | ||||
!gameState.ai.HQ.canBuild(gameState, "structures/{civ}_corral"); | !gameState.ai.HQ.canBuild(gameState, "structures/{civ}/corral"); | ||||
allowDistant = gameState.ai.HQ.turnCache.allowDistantFood; | allowDistant = gameState.ai.HQ.turnCache.allowDistantFood; | ||||
} | } | ||||
if (allowDistant) | if (allowDistant) | ||||
{ | { | ||||
if (this.baseAccess == this.entAccess) | if (this.baseAccess == this.entAccess) | ||||
{ | { | ||||
supply = findSupply(this.ent, this.base.dropsiteSupplies[resource].faraway); | supply = findSupply(this.ent, this.base.dropsiteSupplies[resource].faraway); | ||||
if (supply) | if (supply) | ||||
▲ Show 20 Lines • Show All 419 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator