Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/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); | |||||
}, | |||||
"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 606 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator