Differential D2492 Diff 11431 ps/trunk/binaries/data/mods/public/simulation/components/Foundation.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/Foundation.js
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | |||||
* @param {number} builderEnt - The entity to add. | * @param {number} builderEnt - The entity to add. | ||||
* @return {boolean} - Whether the addition was successful. | * @return {boolean} - Whether the addition was successful. | ||||
*/ | */ | ||||
Foundation.prototype.AddBuilderHelper = function(builderEnt) | Foundation.prototype.AddBuilderHelper = function(builderEnt) | ||||
{ | { | ||||
if (this.builders.has(builderEnt)) | if (this.builders.has(builderEnt)) | ||||
return false; | return false; | ||||
let buildRate = Engine.QueryInterface(builderEnt, IID_Builder).GetRate(); | let cmpBuilder = Engine.QueryInterface(builderEnt, IID_Builder) || | ||||
Engine.QueryInterface(this.entity, IID_AutoBuildable); | |||||
if (!cmpBuilder) | |||||
return false; | |||||
let buildRate = cmpBuilder.GetRate(); | |||||
this.builders.set(builderEnt, buildRate); | this.builders.set(builderEnt, buildRate); | ||||
this.totalBuilderRate += buildRate; | this.totalBuilderRate += buildRate; | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Adds a builder to the counter. | * Adds a builder to the counter. | ||||
▲ Show 20 Lines • Show All 305 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator