Line data Source code
1 : function Loot() {} 2 : 3 0 : Loot.prototype.Schema = 4 : "<a:help>Specifies the loot credited when this entity is killed.</a:help>" + 5 : "<a:example>" + 6 : "<xp>35</xp>" + 7 : "<metal>10</metal>" + 8 : "</a:example>" + 9 : Resources.BuildSchema("nonNegativeInteger", ["xp"]); 10 : 11 0 : Loot.prototype.Serialize = null; // we have no dynamic state to save 12 : 13 0 : Loot.prototype.GetXp = function() 14 : { 15 0 : return Math.floor(ApplyValueModificationsToEntity("Loot/xp", +(this.template.xp || 0), this.entity)); 16 : }; 17 : 18 0 : Loot.prototype.GetResources = function() 19 : { 20 0 : let ret = {}; 21 0 : for (let res of Resources.GetCodes()) 22 0 : ret[res] = Math.floor(ApplyValueModificationsToEntity("Loot/" + res, +(this.template[res] || 0), this.entity)); 23 0 : return ret; 24 : }; 25 : 26 0 : Engine.RegisterComponentType(IID_Loot, "Loot", Loot);