Changeset View
Standalone View
binaries/data/mods/public/simulation/components/Foundation.js
function Foundation() {} | function Foundation() {} | ||||
Foundation.prototype.Schema = | Foundation.prototype.Schema = | ||||
"<empty/>"; | "<element name='DiminishingReturns' a:help='Effect for having multiple builders.'>" + | ||||
"<ref name='nonNegativeDecimal'/>" + | |||||
"</element>"; | |||||
Foundation.prototype.Init = function() | Foundation.prototype.Init = function() | ||||
{ | { | ||||
// Foundations are initially 'uncommitted' and do not block unit movement at all | // Foundations are initially 'uncommitted' and do not block unit movement at all | ||||
// (to prevent players exploiting free foundations to confuse enemy units). | // (to prevent players exploiting free foundations to confuse enemy units). | ||||
// The first builder to reach the uncommitted foundation will tell friendly units | // The first builder to reach the uncommitted foundation will tell friendly units | ||||
// and animals to move out of the way, then will commit the foundation and enable | // and animals to move out of the way, then will commit the foundation and enable | ||||
// its obstruction once there's nothing in the way. | // its obstruction once there's nothing in the way. | ||||
this.committed = false; | this.committed = false; | ||||
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 = +this.template.DiminishingReturns; | |||||
Freagarach: I would love to have better names for this. @Nescio, suggestions? | |||||
SilierUnsubmitted Done Inline Actionswhy not to call it like variable ? Silier: why not to call it like variable ?
also caching is kind of useless, I would say inline it where… | |||||
FreagarachAuthorUnsubmitted Done Inline ActionsBecause it need not to be a penalty, one can let it be a bonus as well. Freagarach: Because it need not to be a penalty, one can let it be a bonus as well.
It saves very frequent… | |||||
NescioUnsubmitted Done Inline ActionsWhat is it and what does it do? Nescio: What is it and what does it do? | |||||
FreagarachAuthorUnsubmitted Done Inline Actions* The build multiplier is a penalty that is applied to each builder. * For example, ten women build at a combined rate of 10^0.7 = 5.01 instead of 10. Freagarach: ```
* The build multiplier is a penalty that is applied to each builder.
* For example, ten… | |||||
NescioUnsubmitted Done Inline ActionsIf the multiplier is greater than 1, it's no longer a penalty, right? (That also applies to the “diminishing returns” of resources.) Nescio: If the multiplier is greater than 1, it's no longer a penalty, right? (That also applies to the… | |||||
FreagarachAuthorUnsubmitted Done Inline ActionsHence I ditched the penalty :) Freagarach: Hence I ditched the penalty :)
But as said, suggestions are welcome. | |||||
NescioUnsubmitted Done Inline Actionsmultiplier → power Nescio: multiplier → power | |||||
FreagarachAuthorUnsubmitted Done Inline Actions
Is that clear? For me it isn't really actually. Freagarach: > multiplier → power
Is that clear? For me it isn't really actually. | |||||
NescioUnsubmitted Done Inline Actions10 isn't multiplied by 0.7, therefore “multiplier” or “factor” is incorrect and misleading. Nescio: 10 isn't multiplied by 0.7, therefore “multiplier” or “factor” is incorrect and misleading.
10… | |||||
NescioUnsubmitted Done Inline ActionsYou can also have a look at the ProductionQueue BatchTimeModifier. Nescio: You can also have a look at the ProductionQueue BatchTimeModifier. | |||||
this.previewEntity = INVALID_ENTITY; | this.previewEntity = INVALID_ENTITY; | ||||
}; | }; | ||||
Foundation.prototype.Serialize = function() | Foundation.prototype.Serialize = function() | ||||
{ | { | ||||
let ret = Object.assign({}, this); | let ret = Object.assign({}, this); | ||||
ret.previewEntity = INVALID_ENTITY; | ret.previewEntity = INVALID_ENTITY; | ||||
▲ Show 20 Lines • Show All 525 Lines • Show Last 20 Lines |
I would love to have better names for this. @Nescio, suggestions?