Upload files

This commit is contained in:
SandPoot
2021-10-07 12:32:20 -03:00
parent 39e63d5ac8
commit 3de08a74e7
3 changed files with 22 additions and 14 deletions

View File

@@ -119,15 +119,18 @@ Notes:
//Includes sanity checks.
/proc/closeToolTip(mob/user)
if(istype(user))
if(user.client && user.client.tooltips)
user.client.tooltips.hide()
if(user.client)
var/client/client = user.client
if(client.tooltips)
client.tooltips.hide()
deltimer(client.tip_timer) //delete any in-progress timer if the mouse is moved off the item before it finishes
client.tip_timer = null
/**
* # `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
* However, if returning `null`, the tooltip will not be shown as #14942 changed it.
*
* Though no tooltips will be created for atoms that have `tooltips = FALSE`
*/
@@ -137,11 +140,12 @@ Notes:
/atom/movable/MouseEntered(location, control, params)
. = ..()
if(tooltips)
if(!QDELETED(src) && usr.client.prefs.enable_tips)
if(!QDELETED(src) && usr?.client.prefs.enable_tips)
var/list/tooltip_data = get_tooltip_data()
if(length(tooltip_data))
var/examine_data = tooltip_data.Join("<br />")
openToolTip(usr, src, params, title = name, content = examine_data)
var/timedelay = max(usr.client.prefs.tip_delay * 0.01, 0.01) // I heard multiplying is faster, also runtimes from very low/negative numbers
usr.client.tip_timer = addtimer(CALLBACK(GLOBAL_PROC, .proc/openToolTip, usr, src, params, name, examine_data), timedelay, TIMER_STOPPABLE)
/atom/movable/MouseExited(location, control, params)
. = ..()
@@ -150,3 +154,7 @@ Notes:
/client/MouseDown(object, location, control, params)
closeToolTip(usr)
. = ..()
/client
/// Timers are now handled by clients, not by doing a mess on the item and multiple people overwriting a single timer on the object, have fun.
var/tip_timer = null