Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/common-api/entity.js
Show First 20 Lines • Show All 340 Lines • ▼ Show 20 Lines | m.Template = m.Class({ | ||||
"trainableEntities": function(civ) { | "trainableEntities": function(civ) { | ||||
const templates = this.get("Trainer/Entities/_string"); | const templates = this.get("Trainer/Entities/_string"); | ||||
if (!templates) | if (!templates) | ||||
return undefined; | return undefined; | ||||
return templates.replace(/\{native\}/g, this.civ()).replace(/\{civ\}/g, civ).split(/\s+/); | return templates.replace(/\{native\}/g, this.civ()).replace(/\{civ\}/g, civ).split(/\s+/); | ||||
}, | }, | ||||
"upgradableEntities": function(civ) { | |||||
const choices = this.get("Upgrade"); | |||||
if (!choices) | |||||
return undefined; | |||||
return choices; | |||||
Freagarach: `choices` would already be undefined, so one might or might not just return `this.get… | |||||
Done Inline ActionsMatter of consistency within the file. lyv: Matter of consistency within the file. | |||||
Not Done Inline Actions^what Freagarach said Silier: ^what Freagarach said
still consistant with the file when with value is nothing done, just… | |||||
Done Inline ActionsMeant more as in syntax. The whole file uses a !x return undefined syntax. But it can be changed of course. lyv: Meant more as in syntax.
The whole file uses a `!x return undefined` syntax.
But it can be… | |||||
Not Done Inline ActionsNot the whole file. ;) (L427 onwards.) Anyway, no big deal. Freagarach: Not the whole file. ;) (L427 onwards.) Anyway, no big deal. | |||||
}, | |||||
"researchableTechs": function(gameState, civ) { | "researchableTechs": function(gameState, civ) { | ||||
const templates = this.get("Researcher/Technologies/_string"); | const templates = this.get("Researcher/Technologies/_string"); | ||||
if (!templates) | if (!templates) | ||||
return undefined; | return undefined; | ||||
let techs = templates.split(/\s+/); | let techs = templates.split(/\s+/); | ||||
for (let i = 0; i < techs.length; ++i) | for (let i = 0; i < techs.length; ++i) | ||||
{ | { | ||||
let tech = techs[i]; | let tech = techs[i]; | ||||
▲ Show 20 Lines • Show All 664 Lines • ▼ Show 20 Lines | m.Entity = m.Class({ | ||||
"removeGuard": function() { | "removeGuard": function() { | ||||
Engine.PostCommand(PlayerID, { "type": "remove-guard", "entities": [this.id()] }); | Engine.PostCommand(PlayerID, { "type": "remove-guard", "entities": [this.id()] }); | ||||
return this; | return this; | ||||
} | } | ||||
}); | }); | ||||
return m; | return m; | ||||
}(API3); | }(API3); | ||||
Lint: no-use-before-define 'API3' was used before it was defined. Lint: no-use-before-define: 'API3' was used before it was defined. |
Wildfire Games · Phabricator
choices would already be undefined, so one might or might not just return this.get("Upgrade");