Adds extended tooltip information to observables in the orbit ui (#70547)

A continuation of #68389 which addresses an issue that still bothers me to this day:

The orbit menu displays a player's name as a combo of name id transform. It can get lengthy to a point where the names clip the entire screen (as buttons do not multiline).

This PR shortens excessively long player names on the orbit menu and adds a tooltip that will show extended info like full name, health and job titles.

Mostly drawn from concerns brought up in the original.
This commit is contained in:
Jeremiah
2022-10-16 11:05:39 -07:00
committed by GitHub
parent a672a6d294
commit 9ecf77ca28
2 changed files with 166 additions and 57 deletions
+29 -1
View File
@@ -57,7 +57,7 @@ GLOBAL_DATUM_INIT(orbit_menu, /datum/orbit_menu, new)
var/poi_ref = REF(mob_poi)
serialized["ref"] = poi_ref
serialized["name"] = name
serialized["full_name"] = name
if(isobserver(mob_poi))
var/number_of_orbiters = length(mob_poi.get_all_orbiters())
@@ -81,6 +81,15 @@ GLOBAL_DATUM_INIT(orbit_menu, /datum/orbit_menu, new)
var/datum/mind/mind = mob_poi.mind
var/was_antagonist = FALSE
serialized["job"] = mind?.assigned_role?.title
serialized["name"] = mob_poi.real_name
serialized["health"] = null
// Cast the mob so we can get health
var/mob/living/player
if(isliving(mob_poi)) // Kind of silly here since we've already checked for dead mobs
player = mob_poi
serialized["health"] = FLOOR((player.health / player.maxHealth * 100), 1)
for(var/datum/antagonist/antag_datum as anything in mind.antag_datums)
if (antag_datum.show_to_ghosts)
was_antagonist = TRUE
@@ -97,8 +106,27 @@ GLOBAL_DATUM_INIT(orbit_menu, /datum/orbit_menu, new)
misc += list(list(
"ref" = REF(atom_poi),
"name" = name,
"extra" = null, // Just in case you want to add anything
))
// Display the supermatter crystal integrity
if(istype(atom_poi, /obj/machinery/power/supermatter_crystal))
var/obj/machinery/power/supermatter_crystal/crystal = atom_poi
misc[length(misc)]["extra"] = "Integrity: [crystal.get_integrity_percent()]%"
continue
// Display the nuke timer
if(istype(atom_poi, /obj/machinery/nuclearbomb))
var/obj/machinery/nuclearbomb/bomb = atom_poi
if(bomb.timing)
misc[length(misc)]["extra"] = "Timer: [bomb.countdown?.displayed_text]s"
continue
// Display the holder if its a nuke disk
if(istype(atom_poi, /obj/item/disk/nuclear))
var/obj/item/disk/nuclear/disk = atom_poi
var/mob/holder = disk.pulledby || get(disk, /mob)
misc[length(misc)]["extra"] = "Location: [holder?.real_name || "Unsecured"]"
continue
return list(
"alive" = alive,
"antagonists" = antagonists,