Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/globalscripts/Templates.js
Show First 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | if (template.Attack) | ||||
ret.attack = {}; | ret.attack = {}; | ||||
for (let type in template.Attack) | for (let type in template.Attack) | ||||
{ | { | ||||
let getAttackStat = function(stat) { | let getAttackStat = function(stat) { | ||||
return getEntityValue("Attack/" + type + "/" + stat); | return getEntityValue("Attack/" + type + "/" + stat); | ||||
}; | }; | ||||
ret.attack[type] = { | ret.attack[type] = { | ||||
"attackName": { "name": template.Attack[type].AttackName._string || template.Attack[type].AttackName, "context": template.Attack[type].AttackName["@context"] }, | |||||
Freagarach: Perhaps `weaponName`/`WeaponName`? To avoid confusion with something that affects simulation or… | |||||
Done Inline ActionsThis can be split over multiple lines as well. (Sorry that I didn't note that earlier.) Freagarach: This can be split over multiple lines as well. (Sorry that I didn't note that earlier.) | |||||
"minRange": getAttackStat("MinRange"), | "minRange": getAttackStat("MinRange"), | ||||
"maxRange": getAttackStat("MaxRange"), | "maxRange": getAttackStat("MaxRange"), | ||||
"elevationBonus": getAttackStat("ElevationBonus"), | "elevationBonus": getAttackStat("ElevationBonus") | ||||
}; | }; | ||||
ret.attack[type].elevationAdaptedRange = Math.sqrt(ret.attack[type].maxRange * | ret.attack[type].elevationAdaptedRange = Math.sqrt(ret.attack[type].maxRange * | ||||
(2 * ret.attack[type].elevationBonus + ret.attack[type].maxRange)); | (2 * ret.attack[type].elevationBonus + ret.attack[type].maxRange)); | ||||
ret.attack[type].repeatTime = getAttackStat("RepeatTime"); | ret.attack[type].repeatTime = getAttackStat("RepeatTime"); | ||||
if (template.Attack[type].Projectile) | if (template.Attack[type].Projectile) | ||||
ret.attack[type].friendlyFire = template.Attack[type].Projectile.FriendlyFire == "true"; | ret.attack[type].friendlyFire = template.Attack[type].Projectile.FriendlyFire == "true"; | ||||
▲ Show 20 Lines • Show All 348 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Perhaps weaponName/WeaponName? To avoid confusion with something that affects simulation or visuals?
(Also in templates.)