Upload files
This commit is contained in:
@@ -15,6 +15,6 @@
|
||||
var/indelay = stripped_input(usr, "Enter the tooltip delay in milliseconds (default: 500)", "Enter tooltip delay", "", 10)
|
||||
indelay = text2num(indelay)
|
||||
if(usr)//is this what you mean?
|
||||
prefs.tip_delay = indelay
|
||||
prefs.tip_delay = max(indelay, 0.01)
|
||||
prefs.save_preferences()
|
||||
to_chat(usr, "<span class='danger'>Tooltip delay set to [indelay] milliseconds.</span>")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user