Index: ps/trunk/binaries/data/mods/public/simulation/components/Health.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/Health.js +++ ps/trunk/binaries/data/mods/public/simulation/components/Health.js @@ -409,11 +409,8 @@ cmpVisual.SetVariant("health", newDamageVariant); }; -Health.prototype.OnValueModification = function(msg) +Health.prototype.RecalculateValues = function() { - if (msg.component != "Health") - return; - let oldMaxHitpoints = this.GetMaxHitpoints(); let newMaxHitpoints = ApplyValueModificationsToEntity("Health/Max", +this.template.Max, this.entity); if (oldMaxHitpoints != newMaxHitpoints) @@ -431,8 +428,20 @@ if (this.regenRate != oldRegenRate || this.idleRegenRate != oldIdleRegenRate) this.CheckRegenTimer(); +} + +Health.prototype.OnValueModification = function(msg) +{ + if (msg.component == "Health") + this.RecalculateValues(); }; +Health.prototype.OnOwnershipChanged = function(msg) +{ + if (msg.to != INVALID_PLAYER) + this.RecalculateValues(); +} + Health.prototype.RegisterHealthChanged = function(from) { this.CheckRegenTimer();