Index: binaries/data/mods/public/simulation/components/Health.js =================================================================== --- binaries/data/mods/public/simulation/components/Health.js +++ binaries/data/mods/public/simulation/components/Health.js @@ -171,8 +171,11 @@ }; /** - * Reduces entity's health by amount HP. Kill if required. - * @return {{ "killed": boolean, "change": Number }} the status change of the entity. + * @typedef {Object} HealthStatusChange + * @property {boolean} killed Whether the entity was killed. + * @property {number} change The amount of health was removed before reaching 0. + * @param {number} amount The amount of hitpoints to substract. Kills the entity if required. + * @return {HealthStatusChange} the status change of the entity. */ Health.prototype.Reduce = function(amount) { @@ -181,7 +184,7 @@ // might get called multiple times) // Likewise if the amount is 0. if (!amount || !this.hitpoints) - return {"killed": false, "change": 0}; + return { "killed": false, "change": 0 }; // Before changing the value, activate Fogging if necessary to hide changes let cmpFogging = Engine.QueryInterface(this.entity, IID_Fogging); @@ -195,7 +198,7 @@ this.hitpoints = 0; this.RegisterHealthChanged(oldHitpoints); this.HandleDeath(); - return {"killed": true, "change": -oldHitpoints}; + return { "killed": true, "change": -oldHitpoints }; } // If we are not marked as injured, do it now @@ -208,7 +211,7 @@ this.hitpoints -= amount; this.RegisterHealthChanged(oldHitpoints); - return {"killed": false, "change": (this.hitpoints - oldHitpoints)}; + return { "killed": false, "change": this.hitpoints - oldHitpoints }; }; /** @@ -247,7 +250,7 @@ } Engine.DestroyEntity(this.entity); -} +}; Health.prototype.Increase = function(amount) {