Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/ai/common-api/entity.js
Show All 9 Lines | "_init": function(sharedAI, templateName, template) | ||||
this._template = template; | this._template = template; | ||||
// save a reference to the template tech modifications | // save a reference to the template tech modifications | ||||
if (!sharedAI._templatesModifications[this._templateName]) | if (!sharedAI._templatesModifications[this._templateName]) | ||||
sharedAI._templatesModifications[this._templateName] = {}; | sharedAI._templatesModifications[this._templateName] = {}; | ||||
this._templateModif = sharedAI._templatesModifications[this._templateName]; | this._templateModif = sharedAI._templatesModifications[this._templateName]; | ||||
this._tpCache = new Map(); | this._tpCache = new Map(); | ||||
}, | }, | ||||
// helper function to return a template value, optionally adjusting for tech. | // Helper function to return a template value, adjusting for tech. | ||||
// TODO: there's no support for "_string" values here. | |||||
"get": function(string) | "get": function(string) | ||||
{ | { | ||||
let value = this._template; | let value = this._template; | ||||
if (this._entityModif && this._entityModif.has(string)) | if (this._entityModif && this._entityModif.has(string)) | ||||
return this._entityModif.get(string); | return this._entityModif.get(string); | ||||
else if (this._templateModif) | else if (this._templateModif) | ||||
{ | { | ||||
let owner = this._entity ? this._entity.owner : PlayerID; | let owner = this._entity ? this._entity.owner : PlayerID; | ||||
▲ Show 20 Lines • Show All 949 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator