From d5461d38c8757126421c8d4d31f1c199557e9583 Mon Sep 17 00:00:00 2001 From: Charlie Nolan Date: Sun, 10 Mar 2024 13:20:09 -0700 Subject: [PATCH] Improved storage UX of labcoats and similar. (#24404) * Improved storage UX of labcoats and similar. * Don't runtime when forceMove is called during initializtion. * Update code/modules/clothing/suits/suit_storage.dm Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * Update code/modules/clothing/suits/suit_storage.dm Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> * Update code/modules/clothing/suits/suit_storage.dm Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> --- .../items/weapons/storage/storage_base.dm | 2 ++ code/modules/clothing/suits/suit_storage.dm | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/code/game/objects/items/weapons/storage/storage_base.dm b/code/game/objects/items/weapons/storage/storage_base.dm index d929b202cc8..4c4ca27a58f 100644 --- a/code/game/objects/items/weapons/storage/storage_base.dm +++ b/code/game/objects/items/weapons/storage/storage_base.dm @@ -430,6 +430,8 @@ if(!istype(I)) return FALSE if(usr) + if(!Adjacent(usr)) + return FALSE if(!usr.unEquip(I, silent = TRUE)) return FALSE usr.update_icons() //update our overlays diff --git a/code/modules/clothing/suits/suit_storage.dm b/code/modules/clothing/suits/suit_storage.dm index a203f26f3f4..cdab79f4ae5 100644 --- a/code/modules/clothing/suits/suit_storage.dm +++ b/code/modules/clothing/suits/suit_storage.dm @@ -21,6 +21,28 @@ if(pockets.handle_mousedrop(usr, over_object)) ..(over_object) +/obj/item/clothing/suit/storage/equipped(mob/user, slot) + ..() + pockets.update_viewers() + +/obj/item/clothing/suit/storage/forceMove(atom/destination) + . = ..() + if(ismob(destination.loc) || isnull(pockets)) + return + + for(var/mob/player in pockets.mobs_viewing) + if(player == destination) + continue + pockets.hide_from(player) + +/obj/item/clothing/suit/storage/AltClick(mob/user) + if(ishuman(user) && Adjacent(user) && !user.incapacitated(FALSE, TRUE)) + pockets.open(user) + add_fingerprint(user) + return + if(isobserver(user)) + pockets.show_to(user) + /obj/item/clothing/suit/storage/attackby(obj/item/W as obj, mob/user as mob, params) ..() return pockets.attackby(W, user, params)