Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Population.js
function Population() {} | function Population() {} | ||||
Population.prototype.Schema = | Population.prototype.Schema = | ||||
"<a:help>Specifies the Population cap increase generated by this entity.</a:help>" + | "<a:help>Specifies the Population cap increase generated by this entity.</a:help>" + | ||||
"<a:example>" + | "<a:example>" + | ||||
"<Bonus>15</Bonus>" + | "<Bonus>15</Bonus>" + | ||||
"</a:example>" + | "</a:example>" + | ||||
"<element name='Bonus' a:help='Population cap increase while this entity exists.'>" + | "<element name='Bonus' a:help='Population cap increase while this entity exists.'>" + | ||||
"<data type='nonNegativeInteger'/>" + | "<data type='nonNegativeInteger'/>" + | ||||
"</element>"; | "</element>"; | ||||
Population.prototype.Init = function() | Population.prototype.Init = function() | ||||
{ | { | ||||
this.bonus = +this.template.Bonus; | this.bonus = +this.template.Bonus; | ||||
}; | }; | ||||
Population.prototype.Update = function(newTemplate) | |||||
{ | |||||
this.template = newTemplate; | |||||
this.RecalculateValues(); | |||||
}; | |||||
/** | /** | ||||
* @return {number} - The population space provided by this entity. | * @return {number} - The population space provided by this entity. | ||||
*/ | */ | ||||
Population.prototype.GetPopBonus = function() | Population.prototype.GetPopBonus = function() | ||||
{ | { | ||||
return this.bonus; | return this.bonus; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator