Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Repairable.js
Show All 12 Lines | |||||
{ | { | ||||
this.builders = new Map(); // Map of builder entities to their work per second | this.builders = new Map(); // Map of builder entities to their work per second | ||||
this.totalBuilderRate = 0; // Total amount of work the builders do each second | this.totalBuilderRate = 0; // Total amount of work the builders do each second | ||||
this.buildMultiplier = 1; // Multiplier for the amount of work builders do | this.buildMultiplier = 1; // Multiplier for the amount of work builders do | ||||
this.buildTimePenalty = 0.7; // Penalty for having multiple builders | this.buildTimePenalty = 0.7; // Penalty for having multiple builders | ||||
this.repairTimeRatio = +this.template.RepairTimeRatio; | this.repairTimeRatio = +this.template.RepairTimeRatio; | ||||
}; | }; | ||||
Repairable.prototype.Update = function(newTemplate) | |||||
{ | |||||
this.template = newTemplate; | |||||
this.repairTimeRatio = +this.template.RepairTimeRatio; | |||||
}; | |||||
/** | /** | ||||
* Returns the current build progress in a [0,1] range. | * Returns the current build progress in a [0,1] range. | ||||
*/ | */ | ||||
Repairable.prototype.GetBuildProgress = function() | Repairable.prototype.GetBuildProgress = function() | ||||
{ | { | ||||
var cmpHealth = Engine.QueryInterface(this.entity, IID_Health); | var cmpHealth = Engine.QueryInterface(this.entity, IID_Health); | ||||
if (!cmpHealth) | if (!cmpHealth) | ||||
return 0; | return 0; | ||||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator