Merge pull request #14688 from SandPoot/good-tooltips

Makes tooltips good and creates a base for adding more.
This commit is contained in:
silicons
2021-05-07 18:41:22 -06:00
committed by GitHub
11 changed files with 72 additions and 9 deletions
-1
View File
@@ -13,7 +13,6 @@ GLOBAL_LIST_EMPTY(radial_menus)
icon_state = "radial_slice"
var/choice
var/next_page = FALSE
var/tooltips = FALSE
/obj/screen/radial/slice/MouseEntered(location, control, params)
. = ..()
+3
View File
@@ -55,6 +55,9 @@
///Internal holder for emissive blocker object, do not use directly use blocks_emissive
var/atom/movable/emissive_blocker/em_block
/// Should we use tooltips, if the thing does not have the code implemented `get_tooltip_data()`, it will default to examine(src)
var/tooltips = FALSE
/atom/movable/Initialize(mapload)
. = ..()
@@ -1083,6 +1083,17 @@
. = ..()
set_species(race)
/mob/living/carbon/human/get_tooltip_data()
var/t_He = p_they(TRUE)
var/t_is = p_are()
. = list()
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
if(skipface || get_visible_name() == "Unknown")
. += "You can't make out what species they are."
else
. += "[t_He] [t_is] a [dna.custom_species ? dna.custom_species : dna.species.name]"
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, usr, .)
/mob/living/carbon/human/species/abductor
race = /datum/species/abductor
@@ -77,6 +77,8 @@
var/last_fire_update
var/hardcore_survival_score = 0
tooltips = TRUE
/// Unarmed parry data for human
/datum/block_parry_data/unarmed/human
parry_respect_clickdelay = TRUE
@@ -1,5 +1,4 @@
/mob/living/silicon/examine(mob/user) //Displays a silicon's laws to ghosts
. = ..()
if(laws && isobserver(user))
. += "<b>[src] has the following laws:</b>"
for(var/law in laws.get_law_list(include_zeroth = TRUE))
@@ -48,6 +48,9 @@
. += "<span class='warning'>It doesn't seem to be responding.</span>"
if(DEAD)
. += "<span class='deadsay'>It looks like its system is corrupted and requires a reset.</span>"
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, usr, .)
. += "*---------*</span>"
. += ..()
@@ -1326,3 +1326,18 @@
var/datum/computer_file/program/robotact/program = modularInterface.get_robotact()
if(program)
program.force_full_update()
/mob/living/silicon/robot/get_tooltip_data()
var/t_He = p_they(TRUE)
var/t_is = p_are()
. = list()
var/borg_type = module ? module : "Default"
//This isn't even used normally, but if that ever changes, just uncomment this
/* var/obj/item/borg_chameleon/chameleon = locate() in src
if(!chameleon)
chameleon = locate() in src.module
if(chameleon?.active)
borg_type = "Engineering"
*/
. += "[t_He] [t_is] a [borg_type] unit"
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, usr, .)
@@ -125,3 +125,5 @@
var/sleeper_g
var/sleeper_r
var/sleeper_nv
tooltips = TRUE
+2 -2
View File
@@ -59,8 +59,8 @@
/mob/living/silicon/ComponentInitialize()
. = ..()
AddElement(/datum/element/flavor_text, _name = "Silicon Flavor Text", _save_key = "silicon_flavor_text")
AddElement(/datum/element/flavor_text, "", "Temporary Flavor Text", "This should be used only for things pertaining to the current round!")
AddElement(/datum/element/flavor_text, _name = "Silicon Flavor Text", _always_show = TRUE, _save_key = "silicon_flavor_text")
AddElement(/datum/element/flavor_text, "", "Temporary Flavor Text", "This should be used only for things pertaining to the current round!", _always_show = TRUE)
AddElement(/datum/element/flavor_text, _name = "OOC Notes", _addendum = "Put information on ERP/vore/lewd-related preferences here. THIS SHOULD NOT CONTAIN REGULAR FLAVORTEXT!!", _always_show = TRUE, _save_key = "ooc_notes", _examine_no_preview = TRUE)
/mob/living/silicon/med_hud_set_health()
+31 -2
View File
@@ -51,7 +51,7 @@ Notes:
/datum/tooltip/proc/show(atom/movable/thing, params = null, title = null, content = null, theme = "default", special = "none")
if (!thing || !params || (!title && !content) || !owner || !isnum(world.icon_size))
return 0
return FALSE
if (!init)
//Initialize some vars
init = 1
@@ -83,7 +83,7 @@ Notes:
if (queueHide)
hide()
return 1
return TRUE
/datum/tooltip/proc/hide()
@@ -122,4 +122,33 @@ Notes:
if(user.client && user.client.tooltips)
user.client.tooltips.hide()
/**
* # `get_tooltip_data()`
*
* If set, will return a list for the tooltip (that will also be put together in a `Join()`)
* However, if returning `null`, falls back to default behavior, which is `examine(src)`, and it will definitely include
* images since it is the default behavior
*
* Though no tooltips will be created for atoms that have `tooltips = FALSE`
*/
/atom/movable/proc/get_tooltip_data()
return
/atom/movable/MouseEntered(location, control, params)
. = ..()
if(tooltips)
if(!QDELETED(src))
var/list/examine_list = examine(src)
var/get_tooltip_data = get_tooltip_data()
if(length(get_tooltip_data))
examine_list = get_tooltip_data
var/examine_data = examine_list.Join("<br />")
openToolTip(usr, src, params, title = name, content = examine_data)
/atom/movable/MouseExited(location, control, params)
. = ..()
closeToolTip(usr)
/client/MouseDown(object, location, control, params)
closeToolTip(usr)
. = ..()
+3 -3
View File
@@ -65,12 +65,12 @@
.hisgrace .wrap {border-color: #7C1414;}
.hisgrace .content {color: #15D512; border-color: #9D1414; background-color: #861414;}
/* TG: Themes */
/* ScreenUI */
.midnight .wrap {border-color: #2B2B33;}
.midnight .content {color: #6087A0; border-color: #2B2B33; background-color: #36363C;}
.plasmafire .wrap {border-color: #21213D;}
.plasmafire .content {color: #FFA800 ; border-color: #21213D; background-color:#1D1D36;}
@@ -85,7 +85,7 @@
.clockwork .wrap {border-color: #170800;}
.clockwork .content {color: #B18B25; border-color: #000000; background-color: #5F380E;}
</style>
</head>