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,12 @@ }; /** + * @typedef {Object} HealthStatusChange + * @property {boolean} killed Whether the entity was killed. + * @property {number} change The amount of health was removed before reaching 0. * Reduces entity's health by amount HP. Kill if required. - * @return {{ "killed": boolean, "change": Number }} the status change of the entity. + * @param {number} amount the amount of HP to be substracted from the hitpoints. + * @return {HealthStatusChange} the status change of the entity. */ Health.prototype.Reduce = function(amount) { @@ -181,7 +185,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 +199,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 +212,7 @@ this.hitpoints -= amount; this.RegisterHealthChanged(oldHitpoints); - return {"killed": false, "change": (this.hitpoints - oldHitpoints)}; + return { "killed": false, "change": (this.hitpoints - oldHitpoints) }; }; /** @@ -247,7 +251,7 @@ } Engine.DestroyEntity(this.entity); -} +}; Health.prototype.Increase = function(amount) {