Changeset View
Standalone View
binaries/data/mods/public/simulation/components/Heal.js
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | Heal.prototype.GetUnhealableClasses = function() | ||||
return this.template.UnhealableClasses._string || ""; | return this.template.UnhealableClasses._string || ""; | ||||
}; | }; | ||||
Heal.prototype.GetHealableClasses = function() | Heal.prototype.GetHealableClasses = function() | ||||
{ | { | ||||
return this.template.HealableClasses._string || ""; | return this.template.HealableClasses._string || ""; | ||||
}; | }; | ||||
Heal.prototype.CanHeal = function(target) | |||||
{ | |||||
let cmpFormation = Engine.QueryInterface(target, IID_Formation); | |||||
if (cmpFormation) | |||||
Stan: number
Maybe
```
The target's entity ID.
``` | |||||
return true; | |||||
StanUnsubmitted Done Inline ActionsWhy can we heal formations? Stan: Why can we heal formations? | |||||
FreagarachAuthorUnsubmitted Done Inline ActionsThat was an error, it was part of the targetIsAlive-function, but is wrong at this place and wrong in the CanHeal-function ;) Freagarach: That was an error, it was part of the `targetIsAlive`-function, but is wrong at this place and… | |||||
Done Inline Actions-is Stan: -is | |||||
// Verify that the target is alive | |||||
// and that the target is not unhealable (or at max health). | |||||
let cmpHealth = Engine.QueryInterface(target, IID_Health); | |||||
if (!cmpHealth || cmpHealth.IsUnhealable()) | |||||
Not Done Inline ActionsOut of scope, but imo bool getters should be phrased positively bb: Out of scope, but imo bool getters should be phrased positively | |||||
return false; | |||||
// Verify that the target is owned by the same player as the entity or of an ally. | |||||
let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); | |||||
StanUnsubmitted Done Inline ActionsShouldn't that be checked before formation? As if the target is an enemy formation? Stan: Shouldn't that be checked before formation? As if the target is an enemy formation? | |||||
if (!cmpOwnership || !(IsOwnedByPlayer(cmpOwnership.GetOwner(), target) || IsOwnedByAllyOfPlayer(cmpOwnership.GetOwner(), target))) | |||||
return false; | |||||
// Verify that the target has the right class. | |||||
let cmpIdentity = Engine.QueryInterface(target, IID_Identity); | |||||
Not Done Inline Actionshmm, hang on isn't the first a subset of the second? (there is an isAllyExclusive mask too) bb: hmm, hang on isn't the first a subset of the second? (there is an `isAllyExclusive` mask too) | |||||
if (!cmpIdentity) | |||||
StanUnsubmitted Done Inline ActionsNo cmp Identity = not healable? Stan: No cmp Identity = not healable? | |||||
FreagarachAuthorUnsubmitted Done Inline ActionsYep :) Freagarach: Yep :) | |||||
return false; | |||||
return !MatchesClassList(cmpIdentity.GetClassesList(), this.GetUnhealableClasses()) && | |||||
MatchesClassList(cmpIdentity.GetClassesList(), this.GetHealableClasses()); | |||||
}; | |||||
Done Inline ActionsImplicit because of above comment no ? Stan: Implicit because of above comment no ?
Actually, I also think you can merge both statements… | |||||
Done Inline ActionsNot per se, for an entity can have a class that is neither healable nor unhealable. Freagarach: Not per se, for an entity can have a class that is neither healable nor unhealable. | |||||
Done Inline ActionsDoes one those have precedence ? As in does the unhealable class take over ? Stan: Does one those have precedence ? As in does the unhealable class take over ? | |||||
Done Inline ActionsIt will return false when the target has an unhealable class, yes. There is nothing facing the user to explain that, but it was like this before, so that did not change. Freagarach: It will return false when the target has an unhealable class, yes. There is nothing facing the… | |||||
Heal.prototype.GetRangeOverlays = function() | Heal.prototype.GetRangeOverlays = function() | ||||
Not Done Inline ActionscmpIdentity.GetClassesList() called twice I so much should write the patch, these two lines can be merged bb: cmpIdentity.GetClassesList() called twice
I so much should write the patch, these two lines… | |||||
{ | { | ||||
if (!this.template.RangeOverlay) | if (!this.template.RangeOverlay) | ||||
return []; | return []; | ||||
return [{ | return [{ | ||||
"radius": this.GetRange().max, | "radius": this.GetRange().max, | ||||
"texture": this.template.RangeOverlay.LineTexture, | "texture": this.template.RangeOverlay.LineTexture, | ||||
"textureMask": this.template.RangeOverlay.LineTextureMask, | "textureMask": this.template.RangeOverlay.LineTextureMask, | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
number
Maybe