wesnoth.interface.game_display.unit_status with limited space
Moderator: Forum Moderators
-
- Posts: 1308
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
wesnoth.interface.game_display.unit_status with limited space
When the status field in the right panel contains too much to fit on the screen, an ellipsis (...) is created and you can hover the mouse over the area to get a full list of the tooltips. At least, it does so when something like slowed or poisoned (presumedly statuses which are built-in) is added. It does not seem to work if you simply add "too much" using wesnoth.interface.game_display.unit_status.
It's kind of hard to explain, so I'll try an example. Use the code below to add icons for unpoisonable, unplagueable, and undrainable. Only unpoisonable and undrainable will show, there will be no ellipsis, and hovering will show only the tooltips for the two visible items.
Now add slowed (via :unit status=slowed). You get the snail, the ellipsis, and you can hover to see tooltips for unpoisonable, unplagueable, and undrainable. Remove slowed and it's back to just the two being visible/available.
I'm wondering if this is just a limitation of the way the "ellipsis code" works, or if something is missing on the UMC side?
It's kind of hard to explain, so I'll try an example. Use the code below to add icons for unpoisonable, unplagueable, and undrainable. Only unpoisonable and undrainable will show, there will be no ellipsis, and hovering will show only the tooltips for the two visible items.
Now add slowed (via :unit status=slowed). You get the snail, the ellipsis, and you can hover to see tooltips for unpoisonable, unplagueable, and undrainable. Remove slowed and it's back to just the two being visible/available.
I'm wondering if this is just a limitation of the way the "ellipsis code" works, or if something is missing on the UMC side?
Code: Select all
local old_unit_status = wesnoth.interface.game_display.unit_status
function wesnoth.interface.game_display.unit_status()
local u = wesnoth.interface.get_displayed_unit()
if not u then return {} end
local s = old_unit_status()
if u.status.infected then
table.insert(s, { "element", {
image = "misc/infected.png",
tooltip = _"infected: This unit is infected. It will become undead after death, unless cured by a healer or by standing on a village."
} })
end
if u.status.incinerated then
table.insert(s, { "element", {
image = "misc/incinerated.png",
tooltip = _"in flames: This unit is in flames. It will lose 16 HP per turn, unless cured by a healer or by standing on a village."
} })
end
if u.status.unslowable then
table.insert(s, { "element", {
image = "misc/unslowable.png",
tooltip = _"unslowable: This unit cannot be affected by slow."
} })
end
if u.status.unpoisonable then
table.insert(s, { "element", {
image = "misc/unpoisonable.png",
tooltip = _"unpoisonable: This unit cannot be affected by poison."
} })
end
if u.status.undrainable then
table.insert(s, { "element", {
image = "misc/undrainable.png",
tooltip = _"undrainable: This unit cannot be drained."
} })
end
if u.status.unplagueable then
table.insert(s, { "element", {
image = "misc/unplagueable.png",
tooltip = _"unplagueable: This unit will not return as undead when killed by a plague weapon special."
} })
end
return s
end
Speak softly, and carry Doombringer.