Ticket #1785: AttackIcons.patch
File AttackIcons.patch, 5.1 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/gui/session/selection_details.js
191 191 attack = "[font=\"serif-bold-13\"]"+type+"Attack:[/font] " + damageTypeDetails(entState.attack); 192 192 // Show max attack range if ranged attack, also convert to tiles (4m per tile) 193 193 if (entState.attack && entState.attack.type == "Ranged") 194 attack += " , [font=\"serif-bold-13\"]Range:[/font] " + Math.round(entState.attack.maxRange/4);194 attack += " " + Math.round(entState.attack.maxRange/4) + getAtkComponentDisplayName("range"); 195 195 getGUIObjectByName("attackAndArmorStats").tooltip = attack + "\n[font=\"serif-bold-13\"]Armor:[/font] " + damageTypeDetails(entState.armour); 196 196 197 197 // Icon Tooltip -
binaries/data/mods/public/gui/session/setup.xml
26 26 sprite="stretched:session/icons/resources/time_small.png" 27 27 size="16 16" 28 28 /> 29 <icon name="iconHack" 30 sprite="stretched:session/icons/damagetypes/hack.png" 31 size="16 16" 32 /> 33 <icon name="iconPierce" 34 sprite="stretched:session/icons/damagetypes/pierce.png" 35 size="16 16" 36 /> 37 <icon name="iconCrush" 38 sprite="stretched:session/icons/damagetypes/crush.png" 39 size="16 16" 40 /> 41 <icon name="iconRange" 42 sprite="stretched:session/icons/damagetypes/range.png" 43 size="16 16" 44 /> 29 45 </setup> -
binaries/data/mods/public/gui/session/utility_functions.js
12 12 "time": "[icon=\"iconTime\"]" 13 13 }; 14 14 15 const ATTACK_DISPLAY_NAMES = { 16 "hack": "[icon=\"iconHack\"]", 17 "pierce": "[icon=\"iconPierce\"]", 18 "crush": "[icon=\"iconCrush\"]", 19 "range": "[icon=\"iconRange\"]" 20 }; 15 21 //-------------------------------- -------------------------------- -------------------------------- 16 22 // Utility functions 17 23 //-------------------------------- -------------------------------- -------------------------------- … … 164 170 if (dmg) 165 171 { 166 172 var dmgArray = []; 167 if (dmg.hack) dmgArray.push(dmg.hack + "[font=\"sans-10\"][color=\"orange\"] Hack[/color][/font]");168 if (dmg.pierce) dmgArray.push(dmg.pierce + "[font=\"sans-10\"][color=\"orange\"] Pierce[/color][/font]");169 if (dmg.crush) dmgArray.push(dmg.crush + "[font=\"sans-10\"][color=\"orange\"] Crush[/color][/font]");173 if (dmg.hack) dmgArray.push(dmg.hack + getAtkComponentDisplayName("hack"));//"[font=\"sans-10\"][color=\"orange\"] Hack[/color][/font]"); 174 if (dmg.pierce) dmgArray.push(dmg.pierce + getAtkComponentDisplayName("pierce")); //"[font=\"sans-10\"][color=\"orange\"] Pierce[/color][/font]"); 175 if (dmg.crush) dmgArray.push(dmg.crush + getAtkComponentDisplayName("crush")); //"[font=\"sans-10\"][color=\"orange\"] Crush[/color][/font]"); 170 176 171 return dmgArray.join(" ,");177 return dmgArray.join(" "); 172 178 } 173 179 else 174 180 { … … 182 188 if (!dmg) 183 189 return "[font=\"serif-12\"](None)[/font]"; 184 190 185 var hackLabel = "[font=\"serif-12\"] Hack[/font]";186 var pierceLabel = "[font=\"serif-12\"] Pierce[/font]";187 var crushLabel = "[font=\"serif-12\"] Crush[/font]";191 var hackLabel = getAtkComponentDisplayName("hack"); 192 var pierceLabel = getAtkComponentDisplayName("pierce"); 193 var crushLabel = getAtkComponentDisplayName("crush"); 188 194 var hackDamage = dmg.hack; 189 195 var pierceDamage = dmg.pierce; 190 196 var crushDamage = dmg.crush; … … 194 200 if (pierceDamage) dmgArray.push(pierceDamage + pierceLabel); 195 201 if (crushDamage) dmgArray.push(crushDamage + crushLabel); 196 202 197 return dmgArray.join("[font=\"serif-12\"] ,[/font]");203 return dmgArray.join("[font=\"serif-12\"] [/font]"); 198 204 } 199 205 200 206 function getEntityCommandsList(entState) … … 260 266 } 261 267 262 268 /** 269 * Translates an attack identifier as they are used internally (e.g. "hack", "pierce", etc.) to proper 270 * display names. 271 */ 272 function getAtkComponentDisplayName(attackComponentName) 273 { 274 return ATTACK_DISPLAY_NAMES[attackComponentName]; 275 } 276 /** 263 277 * Helper function for getEntityCostTooltip. 264 278 */ 265 279 function getEntityCostComponentsTooltipString(template, trainNum, entity) … … 425 439 var attack = "[font=\"serif-bold-13\"]" + type + " Attack:[/font] " + damageTypesToText(template.attack[type]); 426 440 // Show max attack range if ranged attack, also convert to tiles (4m per tile) 427 441 if (type == "Ranged") 428 attack += " , [font=\"serif-bold-13\"]Range:[/font] "+Math.round(template.attack[type].maxRange/4);442 attack += " " + Math.round(template.attack[type].maxRange/4) + getAtkComponentDisplayName("range"); 429 443 attacks.push(attack); 430 444 } 431 445 }