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

@@ -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()

View File

@@ -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>")

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