Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/helpers/DamageTypes.js
DamageTypes.prototype.BuildSchema = function(helptext = "") | DamageTypes.prototype.BuildSchema = function(helptext = "") | ||||
{ | { | ||||
return "<interleave>" + this.GetTypes().reduce((schema, type) => | return "<interleave>" + this.GetTypes().reduce((schema, type) => | ||||
schema + "<element name='"+type+"' a:help='"+type+" "+helptext+"'><ref name='nonNegativeDecimal'/></element>", | schema + "<optional><element name='"+type+"' a:help='"+type+" "+helptext+"'><ref name='nonNegativeDecimal'/></element></optional>", | ||||
"") + "</interleave>"; | "") + "</interleave>"; | ||||
}; | }; | ||||
DamageTypes.prototype.GetComponents = function() | |||||
{ | |||||
// TODO hack less, maybe freeze | |||||
// These components are expected to have a GetMax, Reduce and CanAttack function | |||||
let componentsToID = { "health": IID_Health, "capturable": IID_Capturable }; | |||||
let components = {}; | |||||
for (let type in this.types) | |||||
components[type] = componentsToID[this.types[type].receiveComponent]; | |||||
return components; | |||||
}; | |||||
DamageTypes = new DamageTypes(); | DamageTypes = new DamageTypes(); |
Wildfire Games · Phabricator