Ticket #4279: vision_range_tooltip.diff
File vision_range_tooltip.diff, 2.5 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/components/GuiInterface.js
GuiInterface.prototype.GetEntityState = 248 248 "trader": null, 249 249 "unitAI": null, 250 250 "visibility": null, 251 251 }; 252 252 253 let cmpVision = Engine.QueryInterface(ent, IID_Vision); 254 if (cmpVision) 255 ret.vision = { 256 "range": cmpVision.GetRange() 257 }; 258 253 259 let cmpMirage = Engine.QueryInterface(ent, IID_Mirage); 254 260 if (cmpMirage) 255 261 ret.mirage = true; 256 262 257 263 let cmpIdentity = Engine.QueryInterface(ent, IID_Identity); -
binaries/data/mods/public/gui/session/selection_details.js
function displaySingle(entState) 281 281 282 282 // TODO: we should require all entities to have icons 283 283 Engine.GetGUIObjectByName("icon").sprite = template.icon ? ("stretched:session/portraits/" + template.icon) : "BackgroundBlack"; 284 284 285 285 Engine.GetGUIObjectByName("attackAndArmorStats").tooltip = [ 286 getVisionTooltip, 286 287 getAttackTooltip, 287 288 getSplashDamageTooltip, 288 289 getHealerTooltip, 289 290 getArmorTooltip, 290 291 getRepairRateTooltip, -
binaries/data/mods/public/gui/common/tooltips.js
function damageTypesToText(dmg) 130 130 "damage": dmg[dmgType].toFixed(1), 131 131 "damageType": unitFont(g_DamageTypes[dmgType]) 132 132 })).join(commaFont(translate(", "))); 133 133 } 134 134 135 function getVisionTooltip(template) 136 { 137 if (!template.vision) 138 return ""; 139 140 let range = template.vision.range; 141 142 return sprintf(translate("%(label)s %(details)s"), { 143 "label": translate("Vision Range"), 144 "details": sprintf(translatePlural("%(range)s %(meters)s", "%(range)s %(meters)s", range), { 145 "range": range, 146 "meters": unitFont(translatePlural("meter", "meters", range)) 147 }) 148 }); 149 } 150 135 151 // TODO: should also show minRange 136 152 function getAttackTooltip(template) 137 153 { 138 154 if (!template.attack) 139 155 return "";