forked from 0ad/0ad
Fix building contstruction, but still don't allow positive regenrate for unhealable entities
This was SVN commit r14086.
This commit is contained in:
parent
24bc451852
commit
68fa9f4631
@ -208,13 +208,13 @@ Health.prototype.Reduce = function(amount)
|
||||
|
||||
Health.prototype.Increase = function(amount)
|
||||
{
|
||||
if (this.hitpoints == this.GetMaxHitpoints())
|
||||
return {"old": this.hitpoints, "new":this.hitpoints};
|
||||
|
||||
// If we're already dead, don't allow resurrection
|
||||
if (this.hitpoints == 0)
|
||||
return undefined;
|
||||
|
||||
if (this.IsUnhealable())
|
||||
return {"old": this.hitpoints, "new":this.hitpoints};
|
||||
|
||||
var old = this.hitpoints;
|
||||
this.hitpoints = Math.min(this.hitpoints + amount, this.GetMaxHitpoints());
|
||||
|
||||
@ -343,6 +343,9 @@ Health.prototype.OnValueModification = function(msg)
|
||||
|
||||
var oldRegenRate = this.regenRate;
|
||||
this.regenRate = ApplyValueModificationsToEntity("Health/RegenRate", +this.template.RegenRate, this.entity);
|
||||
|
||||
if (this.IsUnhealable())
|
||||
this.regenRate = Math.min(0,this.regenRate);
|
||||
|
||||
if (this.regenRate != oldRegenRate)
|
||||
this.CheckRegenTimer();
|
||||
|
Loading…
Reference in New Issue
Block a user