[MIRROR] Fix mouse hover outlines applying to other people (#4122)

* Fix mouse hover outlines applying to other people (#57659)

About The Pull Request

Instead of just checking if they're inside a bag, it will now be checked that it is your bag.

fix: Mouse hover outlines will now only show if the item is on your person.

* Fix mouse hover outlines applying to other people

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-03-13 14:41:01 +00:00
committed by GitHub
co-authored by Mothblocks
parent 58261c5d22
commit 7129599dee
+5 -15
View File
@@ -191,9 +191,6 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
var/list/juice_results
var/canMouseDown = FALSE
/// item hover FX
var/outline_filter
/obj/item/Initialize()
@@ -828,7 +825,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
/obj/item/MouseEntered(location, control, params)
. = ..()
if((item_flags & IN_INVENTORY || item_flags & IN_STORAGE) && !QDELETED(src))
if(get(src, /mob) == usr && !QDELETED(src))
var/mob/living/L = usr
if(usr.client.prefs.enable_tips)
var/timedelay = usr.client.prefs.tip_delay/100
@@ -841,15 +838,15 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
/obj/item/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
. = ..()
remove_outline() //get rid of the hover effect in case the mouse exit isn't called if someone drags and drops an item and somthing goes wrong
remove_filter("hover_outline") //get rid of the hover effect in case the mouse exit isn't called if someone drags and drops an item and somthing goes wrong
/obj/item/MouseExited()
deltimer(tip_timer) //delete any in-progress timer if the mouse is moved off the item before it finishes
closeToolTip(usr)
remove_outline()
remove_filter("hover_outline")
/obj/item/proc/apply_outline(outline_color = null)
if(!(item_flags & IN_INVENTORY || item_flags & IN_STORAGE) || QDELETED(src) || isobserver(usr)) //cancel if the item isn't in an inventory, is being deleted, or if the person hovering is a ghost (so that people spectating you don't randomly make your items glow)
if(get(src, /mob) != usr || QDELETED(src) || isobserver(usr)) //cancel if the item isn't in an inventory, is being deleted, or if the person hovering is a ghost (so that people spectating you don't randomly make your items glow)
return
var/theme = lowertext(usr.client.prefs.UI_style)
if(!outline_color) //if we weren't provided with a color, take the theme's color
@@ -872,15 +869,8 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
outline_color = COLOR_WHITE
if(color)
outline_color = COLOR_WHITE //if the item is recolored then the outline will be too, let's make the outline white so it becomes the same color instead of some ugly mix of the theme and the tint
if(outline_filter)
filters -= outline_filter
outline_filter = filter(type="outline", size=1, color=outline_color)
filters += outline_filter
/obj/item/proc/remove_outline()
if(outline_filter)
filters -= outline_filter
outline_filter = null
add_filter("hover_outline", 1, list("type" = "outline", "size" = 1, "color" = outline_color))
/// Called when a mob tries to use the item as a tool. Handles most checks.
/obj/item/proc/use_tool(atom/target, mob/living/user, delay, amount=0, volume=0, datum/callback/extra_checks)