Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Repairable.js
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
* Adds an array of builders. | * Adds an array of builders. | ||||
* | * | ||||
* @param {number[]} - An array containing the entity IDs of builders to assign. | * @param {number[]} - An array containing the entity IDs of builders to assign. | ||||
*/ | */ | ||||
Repairable.prototype.AddBuilders = function(builders) | Repairable.prototype.AddBuilders = function(builders) | ||||
{ | { | ||||
for (let builder of builders) | for (let builder of builders) | ||||
this.AddBuilder(builder); | this.AddBuilder(builder); | ||||
} | }; | ||||
Repairable.prototype.AddBuilder = function(builderEnt) | Repairable.prototype.AddBuilder = function(builderEnt) | ||||
{ | { | ||||
if (this.builders.has(builderEnt)) | if (this.builders.has(builderEnt)) | ||||
return; | return; | ||||
this.builders.set(builderEnt, Engine.QueryInterface(builderEnt, IID_Builder).GetRate()); | this.builders.set(builderEnt, Engine.QueryInterface(builderEnt, IID_Builder).GetRate()); | ||||
this.totalBuilderRate += this.builders.get(builderEnt); | this.totalBuilderRate += this.builders.get(builderEnt); | ||||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator