diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index a9fb4e8fcc4..297753c372d 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -118,8 +118,8 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect var/tip_timer = 0 /// item hover FX - var/in_storage = FALSE - var/outline_filter + var/in_storage = FALSE //is this item inside a storage object? + var/outline_filter //holder var for the item outline filter, null when no outline filter on the item. /obj/item/New() ..() @@ -135,6 +135,11 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect if(!move_resist) determine_move_resist() +/obj/item/Initialize(mapload) + . = ..() + if(istype(loc, /obj/item/storage)) //marks all items in storage as being such + in_storage = TRUE + /obj/item/proc/determine_move_resist() switch(w_class) if(WEIGHT_CLASS_TINY) @@ -699,15 +704,17 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect /obj/item/MouseEntered(location, control, params) if(in_inventory || in_storage) var/timedelay = 8 - var/user = usr + var/mob/user = usr tip_timer = addtimer(CALLBACK(src, .proc/openTip, location, control, params, user), timedelay, TIMER_STOPPABLE) - if(!QDELETED(src)) - var/mob/living/L = usr - if(usr.client.prefs.toggles2 & PREFTOGGLE_2_SEE_ITEM_OUTLINES) - if(istype(L) && L.incapacitated(ignore_lying = TRUE)) - apply_outline(COLOR_RED_GRAY) //if they're dead or handcuffed, let's show the outline as red to indicate that they can't interact with that right now - else - apply_outline() //if the player's alive and well we send the command with no color set, so it uses the theme's color + if(QDELETED(src)) + return + var/mob/living/L = user + if(!(user.client.prefs.toggles2 & PREFTOGGLE_2_SEE_ITEM_OUTLINES)) + return + if(istype(L) && L.incapacitated(ignore_lying = TRUE)) + apply_outline(L, COLOR_RED_GRAY) //if they're dead or handcuffed, let's show the outline as red to indicate that they can't interact with that right now + else + apply_outline(L) //if the player's alive and well we send the command with no color set, so it uses the theme's color /obj/item/MouseExited() deltimer(tip_timer) //delete any in-progress timer if the mouse is moved off the item before it finishes @@ -723,10 +730,10 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect S.swap_items(src, I, user) 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 -/obj/item/proc/apply_outline(outline_color = null) - if(!(in_inventory || 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) +/obj/item/proc/apply_outline(mob/user, outline_color = null) + if(!(in_inventory || in_storage) || QDELETED(src) || isobserver(user)) //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) + var/theme = lowertext(user.client.prefs.UI_style) if(!outline_color) //if we weren't provided with a color, take the theme's color switch(theme) //yeah it kinda has to be this way if("midnight") @@ -749,7 +756,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect 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) + outline_filter = filter(type = "outline", size = 1, color = outline_color) filters += outline_filter /obj/item/proc/remove_outline() diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 7adb3b2a28f..9f145c5bbdb 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -59,9 +59,6 @@ populate_contents() - for(var/obj/item/L in return_inv()) //marks all items in storage as being such - L.in_storage = TRUE - boxes = new /obj/screen/storage() boxes.name = "storage" boxes.master = src