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 || ""; | ||||
}; | }; | ||||
/** | |||||
* Whether this entity can heal the target. | |||||
* | |||||
* @param {number} target - The target's entity ID. | |||||
Stan: number
Maybe
```
The target's entity ID.
``` | |||||
* @return {boolean} - Whether the target can be healed. | |||||
Done Inline ActionsWhy can we heal formations? Stan: Why can we heal formations? | |||||
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 | |||||
*/ | |||||
Heal.prototype.CanHeal = function(target) | |||||
{ | |||||
let cmpHealth = Engine.QueryInterface(target, IID_Health); | |||||
if (!cmpHealth || cmpHealth.IsUnhealable()) | |||||
bbUnsubmitted 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); | |||||
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) | |||||
return false; | |||||
let owner = cmpOwnership.GetOwner(); | |||||
if (!(IsOwnedByPlayer(owner, target) || IsOwnedByAllyOfPlayer(owner, target))) | |||||
bbUnsubmitted 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) | |||||
return false; | |||||
Done Inline ActionsNo cmp Identity = not healable? Stan: No cmp Identity = not healable? | |||||
Done Inline ActionsYep :) Freagarach: Yep :) | |||||
// Verify that the target has the right class. | |||||
let cmpIdentity = Engine.QueryInterface(target, IID_Identity); | |||||
if (!cmpIdentity) | |||||
return false; | |||||
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… | |||||
return !MatchesClassList(cmpIdentity.GetClassesList(), this.GetUnhealableClasses()) && | |||||
bbUnsubmitted 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… | |||||
MatchesClassList(cmpIdentity.GetClassesList(), this.GetHealableClasses()); | |||||
}; | |||||
Heal.prototype.GetRangeOverlays = function() | Heal.prototype.GetRangeOverlays = function() | ||||
{ | { | ||||
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, | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |
number
Maybe