Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/common-api/entity.js
Show First 20 Lines • Show All 403 Lines • ▼ Show 20 Lines | m.Template = m.Class({ | ||||
"resourceDropsiteTypes": function() { | "resourceDropsiteTypes": function() { | ||||
if (!this.get("ResourceDropsite")) | if (!this.get("ResourceDropsite")) | ||||
return undefined; | return undefined; | ||||
let types = this.get("ResourceDropsite/Types"); | let types = this.get("ResourceDropsite/Types"); | ||||
return types ? types.split(/\s+/) : []; | return types ? types.split(/\s+/) : []; | ||||
}, | }, | ||||
"isResourceDropsite": function(resourceType) { | |||||
const types = this.resourceDropsiteTypes(); | |||||
return types && (!resourceType || types.indexOf(resourceType) != -1); | |||||
Stan: !== ? | |||||
}, | |||||
"isTreasure": function() { return this.get("Treasure") !== undefined; }, | "isTreasure": function() { return this.get("Treasure") !== undefined; }, | ||||
"treasureResources": function() { | "treasureResources": function() { | ||||
if (!this.get("Treasure")) | if (!this.get("Treasure")) | ||||
return undefined; | return undefined; | ||||
let ret = {}; | let ret = {}; | ||||
for (let r in this.get("Treasure/Resources")) | for (let r in this.get("Treasure/Resources")) | ||||
ret[r] = +this.get("Treasure/Resources/" + r); | ret[r] = +this.get("Treasure/Resources/" + r); | ||||
▲ Show 20 Lines • Show All 597 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
!== ?