Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/GuiInterface.js
Show First 20 Lines • Show All 383 Lines • ▼ Show 20 Lines | GuiInterface.prototype.GetEntityState = function(player, ent) | ||||
{ | { | ||||
let types = cmpAttack.GetAttackTypes(); | let types = cmpAttack.GetAttackTypes(); | ||||
if (types.length) | if (types.length) | ||||
ret.attack = {}; | ret.attack = {}; | ||||
for (let type of types) | for (let type of types) | ||||
{ | { | ||||
ret.attack[type] = {}; | ret.attack[type] = {}; | ||||
if (type == "Capture") | ret.attack[type].tooltipHeader = cmpAttack.GetTooltipHeader(type); | ||||
ret.attack[type] = cmpAttack.GetAttackStrengths(type); | |||||
else | |||||
ret.attack[type].damage = cmpAttack.GetAttackStrengths(type); | ret.attack[type].damage = cmpAttack.GetAttackStrengths(type); | ||||
ret.attack[type].splash = cmpAttack.GetSplashDamage(type); | ret.attack[type].splash = cmpAttack.GetSplashDamage(type); | ||||
let range = cmpAttack.GetRange(type); | let range = cmpAttack.GetRange(type); | ||||
ret.attack[type].minRange = range.min; | ret.attack[type].minRange = range.min; | ||||
ret.attack[type].maxRange = range.max; | ret.attack[type].maxRange = range.max; | ||||
ret.attack[type].elevationBonus = range.elevationBonus; | |||||
let timers = cmpAttack.GetTimers(type); | let timers = cmpAttack.GetTimers(type); | ||||
ret.attack[type].prepareTime = timers.prepare; | ret.attack[type].prepareTime = timers.prepare; | ||||
ret.attack[type].repeatTime = timers.repeat; | ret.attack[type].repeatTime = timers.repeat; | ||||
if (type != "Ranged") | ret.attack[type].projectile = cmpAttack.HasProjectile(type); | ||||
{ | |||||
// not a ranged attack, set some defaults | |||||
ret.attack[type].elevationBonus = 0; | |||||
ret.attack[type].elevationAdaptedRange = ret.attack.maxRange; | |||||
continue; | |||||
} | |||||
ret.attack[type].elevationBonus = range.elevationBonus; | |||||
if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld()) | if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld()) | ||||
{ | { | ||||
// For units, take the range in front of it, no spread. So angle = 0 | // For units, take the range in front of it, no spread. So angle = 0 | ||||
ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | ||||
} | } | ||||
else if(cmpPosition && cmpPosition.IsInWorld()) | else if(cmpPosition && cmpPosition.IsInWorld()) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,557 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator