Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Health.js
Show First 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
Health.prototype.ExecuteRegeneration = function() | Health.prototype.ExecuteRegeneration = function() | ||||
{ | { | ||||
let regen = this.GetRegenRate(); | let regen = this.GetRegenRate(); | ||||
if (this.GetIdleRegenRate() != 0) | if (this.GetIdleRegenRate() != 0) | ||||
{ | { | ||||
let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | ||||
if (cmpUnitAI && (cmpUnitAI.IsIdle() || cmpUnitAI.IsGarrisoned() && !cmpUnitAI.IsTurret())) | if (cmpUnitAI && (cmpUnitAI.IsIdle() || | ||||
cmpUnitAI.GetGarrisonHolder() != INVALID_ENTITY && !cmpUnitAI.IsTurret())) | |||||
Stan: Nesting would allow for one engine query interface save. Not sure if worth it
EDIT:maybe not | |||||
regen += this.GetIdleRegenRate(); | regen += this.GetIdleRegenRate(); | ||||
Done Inline ActionsCache it above and reuse it ? Stan: Cache it above and reuse it ? | |||||
} | } | ||||
if (regen > 0) | if (regen > 0) | ||||
this.Increase(regen); | this.Increase(regen); | ||||
else | else | ||||
this.Reduce(-regen); | this.Reduce(-regen); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 339 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Nesting would allow for one engine query interface save. Not sure if worth it
EDIT:maybe not