Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Trainer.js
Show All 16 Lines | "<optional>" + | ||||
"<element name='Entities' a:help='Space-separated list of entity template names that this entity can train. The special string \"{civ}\" will be automatically replaced by the civ code of the entity's owner, while the string \"{native}\" will be automatically replaced by the entity's civ code.'>" + | "<element name='Entities' a:help='Space-separated list of entity template names that this entity can train. The special string \"{civ}\" will be automatically replaced by the civ code of the entity's owner, while the string \"{native}\" will be automatically replaced by the entity's civ code.'>" + | ||||
"<attribute name='datatype'>" + | "<attribute name='datatype'>" + | ||||
"<value>tokens</value>" + | "<value>tokens</value>" + | ||||
"</attribute>" + | "</attribute>" + | ||||
"<text/>" + | "<text/>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>"; | "</optional>"; | ||||
Trainer.prototype.Update = function(newTemplate) { | |||||
this.template = newTemplate; | |||||
// This also updates the queued production if necessary. | |||||
this.CalculateEntitiesMap(); | |||||
// Inform the GUI that it'll need to recompute the selection panel. | |||||
// TODO: it would be better to only send the message if something actually changing | |||||
// for the current training queue. | |||||
const cmpPlayer = QueryOwnerInterface(this.entity); | |||||
if (cmpPlayer) | |||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface).SetSelectionDirty(cmpPlayer.GetPlayerID()); | |||||
} | |||||
/** | /** | ||||
* This object represents a batch of entities being trained. | * This object represents a batch of entities being trained. | ||||
* @param {string} templateName - The name of the template we ought to train. | * @param {string} templateName - The name of the template we ought to train. | ||||
* @param {number} count - The size of the batch to train. | * @param {number} count - The size of the batch to train. | ||||
* @param {number} trainer - The entity ID of our trainer. | * @param {number} trainer - The entity ID of our trainer. | ||||
* @param {string} metadata - Optionally any metadata to attach to us. | * @param {string} metadata - Optionally any metadata to attach to us. | ||||
*/ | */ | ||||
Trainer.prototype.Item = function(templateName, count, trainer, metadata) | Trainer.prototype.Item = function(templateName, count, trainer, metadata) | ||||
▲ Show 20 Lines • Show All 674 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator