Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 673 Lines • ▼ Show 20 Lines | |||||
Attack.prototype.GetRangeOverlays = function() | Attack.prototype.GetRangeOverlays = function() | ||||
{ | { | ||||
if (!this.template.Ranged || !this.template.Ranged.RangeOverlay) | if (!this.template.Ranged || !this.template.Ranged.RangeOverlay) | ||||
return []; | return []; | ||||
let range = this.GetRange("Ranged"); | let range = this.GetRange("Ranged"); | ||||
let rangeOverlays = []; | let rangeOverlays = []; | ||||
let bonus = range["max"]; | |||||
Stan: Range.max ? | |||||
let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | |||||
Not Done Inline Actions\n{ elexis: \n{ | |||||
Not Done Inline ActionsWhy is there a range.elevationBonus test in the condition? Doesn't the elevationadapted range come into play even if that value above is 0? elexis: Why is there a `range.elevationBonus` test in the condition? Doesn't the elevationadapted range… | |||||
let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | |||||
let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); | |||||
StanUnsubmitted Not Done Inline ActionsNo check for range manager ? Stan: No check for range manager ? | |||||
if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld()) { | |||||
bonus = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | |||||
StanUnsubmitted Not Done Inline ActionsCould be unified in one if(cmppos && isingword) Stan: Could be unified in one if(cmppos && isingword)
Var x = cmpUnitai ? 2 PI : 0;
bonus =… | |||||
elexisUnsubmitted Not Done Inline Actionsand inline x elexis: and inline x | |||||
} | |||||
Not Done Inline ActionsSpaces for operator. 2 * PI instead of 2*PI Stan: Spaces for operator. 2 * PI instead of 2*PI
| |||||
Not Done Inline Actionsspaces around the * operator. range.max = cmpRangeManager.GetElevationAdaptedRange( cmpPosition.GetPosition(), cmpPosition.GetRotation(), ... \n before the for cmpUnitAI init only if the condition is true elexis: spaces around the * operator.
176 characters that line, how about:
```
range.max =… | |||||
else if(cmpPosition && cmpPosition.IsInWorld()) | |||||
{ | |||||
// For buildings, take the average elevation around it. So angle = 2*pi | |||||
bonus = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI); | |||||
} | |||||
range["max"] = bonus; | |||||
StanUnsubmitted Not Done Inline ActionsRange.max ? Stan: Range.max ?
Could be merged in the if after the change I guess. | |||||
for (let i in range) | for (let i in range) | ||||
if ((i == "min" || i == "max") && range[i]) | if ((i == "min" || i == "max") && range[i]) | ||||
rangeOverlays.push({ | rangeOverlays.push({ | ||||
"radius": range[i], | "radius": range[i], | ||||
"texture": this.template.Ranged.RangeOverlay.LineTexture, | "texture": this.template.Ranged.RangeOverlay.LineTexture, | ||||
"textureMask": this.template.Ranged.RangeOverlay.LineTextureMask, | "textureMask": this.template.Ranged.RangeOverlay.LineTextureMask, | ||||
"thickness": +this.template.Ranged.RangeOverlay.LineThickness, | "thickness": +this.template.Ranged.RangeOverlay.LineThickness, | ||||
}); | }); | ||||
return rangeOverlays; | return rangeOverlays; | ||||
}; | }; | ||||
Engine.RegisterComponentType(IID_Attack, "Attack", Attack); | Engine.RegisterComponentType(IID_Attack, "Attack", Attack); |
Wildfire Games · Phabricator
Range.max ?