Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/queueplanBuilding.js
Show All 22 Lines | |||||
m.ConstructionPlan.prototype.canStart = function(gameState) | m.ConstructionPlan.prototype.canStart = function(gameState) | ||||
{ | { | ||||
if (gameState.ai.HQ.turnCache.buildingBuilt) // do not start another building if already one this turn | if (gameState.ai.HQ.turnCache.buildingBuilt) // do not start another building if already one this turn | ||||
return false; | return false; | ||||
if (!this.isGo(gameState)) | if (!this.isGo(gameState)) | ||||
return false; | return false; | ||||
if (this.template.requiredTech() && !gameState.isResearched(this.template.requiredTech())) | if (this.template.requiredTechs() && !gameState.areResearched(this.template.requiredTechs())) | ||||
lyv: Notice that `[]` is considered truthy. Use `.length` here and wherever this check maybe used. | |||||
return false; | return false; | ||||
return gameState.ai.HQ.buildManager.hasBuilder(this.type); | return gameState.ai.HQ.buildManager.hasBuilder(this.type); | ||||
}; | }; | ||||
m.ConstructionPlan.prototype.start = function(gameState) | m.ConstructionPlan.prototype.start = function(gameState) | ||||
{ | { | ||||
Engine.ProfileStart("Building construction start"); | Engine.ProfileStart("Building construction start"); | ||||
▲ Show 20 Lines • Show All 912 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Notice that [] is considered truthy. Use .length here and wherever this check maybe used.