function ResourceTrickle() {} ResourceTrickle.prototype.Schema = "Controls the resource trickle ability of the unit." + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; ResourceTrickle.prototype.Init = function() { // Call the timer var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); cmpTimer.SetInterval(this.entity, IID_ResourceTrickle, "Trickle", this.GetTimer(), this.GetTimer(), undefined); }; ResourceTrickle.prototype.GetTimer = function() { var interval = +this.template.Interval; return interval; }; ResourceTrickle.prototype.GetRates = function() { var rates = {}; for (var resource in this.template.Rates) rates[resource] = ApplyValueModificationsToEntity("ResourceTrickle/Rates/"+resource, +this.template.Rates[resource], this.entity); return rates; }; // Do the actual work here ResourceTrickle.prototype.Trickle = function(data, lateness) { var cmpPlayer = QueryOwnerInterface(this.entity); if (!cmpPlayer) return; var rates = this.GetRates(); for (var resource in rates) cmpPlayer.AddResource(resource, rates[resource]); }; Engine.RegisterComponentType(IID_ResourceTrickle, "ResourceTrickle", ResourceTrickle);