From 3de08a74e71a10d45effa80f7b8a44ec3d88eebb Mon Sep 17 00:00:00 2001 From: SandPoot Date: Thu, 7 Oct 2021 12:32:20 -0300 Subject: [PATCH] Upload files --- code/game/objects/items.dm | 14 +++++++------- code/modules/client/verbs/etips.dm | 2 +- code/modules/tooltip/tooltip.dm | 20 ++++++++++++++------ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 0d6b1231fc..53f64c57d2 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -131,7 +131,6 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb //Tooltip vars var/force_string //string form of an item's force. Edit this var only to set a custom force string var/last_force_string_check = 0 - var/tip_timer var/trigger_guard = TRIGGER_GUARD_NONE @@ -451,7 +450,8 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb A.Remove(user) if(item_flags & DROPDEL) qdel(src) - item_flags &= ~IN_INVENTORY + DISABLE_BITFIELD(item_flags, IN_INVENTORY) + DISABLE_BITFIELD(item_flags, IN_STORAGE) SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user) remove_outline() // if(!silent) @@ -529,6 +529,8 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb if(item_action_slot_check(slot, user, A)) //some items only give their actions buttons when in a specific slot. A.Grant(user) item_flags |= IN_INVENTORY + if(CHECK_BITFIELD(item_flags, IN_STORAGE)) // Left storage item but somehow has the bitfield active still. + DISABLE_BITFIELD(item_flags, IN_STORAGE) // if(!initial) // if(equip_sound && (slot_flags & slot)) // playsound(src, equip_sound, EQUIP_SOUND_VOLUME, TRUE, ignore_walls = FALSE) @@ -885,10 +887,9 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb /obj/item/MouseEntered(location, control, params) SEND_SIGNAL(src, COMSIG_ITEM_MOUSE_ENTER, location, control, params) - if((item_flags & IN_INVENTORY || item_flags & IN_STORAGE) && usr.client.prefs.enable_tips && !QDELETED(src)) - var/timedelay = usr.client.prefs.tip_delay/100 - var/user = usr - tip_timer = addtimer(CALLBACK(src, .proc/openTip, location, control, params, user), timedelay, TIMER_STOPPABLE)//timer takes delay in deciseconds, but the pref is in milliseconds. dividing by 100 converts it. + if((item_flags & IN_INVENTORY || item_flags & IN_STORAGE) && usr?.client.prefs.enable_tips && !QDELETED(src)) + 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(src, .proc/openTip, location, control, params, usr), timedelay, TIMER_STOPPABLE)//timer takes delay in deciseconds, but the pref is in milliseconds. dividing by 100 converts it. var/mob/living/L = usr if(istype(L) && (L.incapacitated() || (current_equipped_slot in L.check_obscured_slots()) || !L.canUnEquip(src))) apply_outline(_size = 3) @@ -901,7 +902,6 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb /obj/item/MouseExited(location,control,params) SEND_SIGNAL(src, COMSIG_ITEM_MOUSE_EXIT, location, control, params) - deltimer(tip_timer)//delete any in-progress timer if the mouse is moved off the item before it finishes closeToolTip(usr) remove_outline() diff --git a/code/modules/client/verbs/etips.dm b/code/modules/client/verbs/etips.dm index 27434cddc4..d4ebc899ae 100644 --- a/code/modules/client/verbs/etips.dm +++ b/code/modules/client/verbs/etips.dm @@ -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, "Tooltip delay set to [indelay] milliseconds.") diff --git a/code/modules/tooltip/tooltip.dm b/code/modules/tooltip/tooltip.dm index 65e44cfbc6..725eca89db 100644 --- a/code/modules/tooltip/tooltip.dm +++ b/code/modules/tooltip/tooltip.dm @@ -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("
") - 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