From 1e2fc585e788f612af42e0a85e95fb0ffd9dc269 Mon Sep 17 00:00:00 2001 From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Date: Fri, 31 May 2024 23:18:56 +0200 Subject: [PATCH] Fixed background inventory screens not being clickable (#19284) Fixed background inventory screens not being clickable. Clicking on a storage item that is already open now closes it. Fixes #18880 --- code/__DEFINES/layers.dm | 1 + code/_onclick/hud/screen_objects.dm | 4 +- .../objects/items/weapons/storage/storage.dm | 6 +- ...ffyghost-fixbackgroundinventoryscreens.yml | 59 +++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 html/changelogs/fluffyghost-fixbackgroundinventoryscreens.yml diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index 5eb338d4d29..59e9d394c67 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers.dm @@ -157,6 +157,7 @@ #define HUD_PLANE 7 #define UNDER_HUD_LAYER 1 #define HUD_BASE_LAYER 2 + #define HUD_BELOW_ITEM_LAYER 2.9 #define HUD_ITEM_LAYER 3 #define HUD_ABOVE_ITEM_LAYER 4 #define RADIAL_BACKGROUND_LAYER 5 diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 20ad71b9fa3..e36db9e3c23 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -139,6 +139,8 @@ /obj/screen/storage name = "storage" screen_loc = "7,7 to 10,8" + plane = HUD_PLANE + layer = HUD_BASE_LAYER /obj/screen/storage/Click() if(!usr.canClick()) @@ -153,7 +155,7 @@ /obj/screen/storage/background name = "background storage" - layer = HUD_BASE_LAYER + layer = HUD_BELOW_ITEM_LAYER /obj/screen/storage/background/Initialize(mapload, var/obj/set_master, var/set_icon_state) . = ..() diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 98daa9f63cb..0df3764626b 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -765,7 +765,11 @@ return if (src.loc == user) - src.open(user) + //If the storage is already open, close it, otherwise open it + if(user.s_active == src) + src.close(user) + else + src.open(user) else ..() for(var/mob/M in range(1, get_turf(src)) - user) diff --git a/html/changelogs/fluffyghost-fixbackgroundinventoryscreens.yml b/html/changelogs/fluffyghost-fixbackgroundinventoryscreens.yml new file mode 100644 index 00000000000..977465aa3dc --- /dev/null +++ b/html/changelogs/fluffyghost-fixbackgroundinventoryscreens.yml @@ -0,0 +1,59 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixed background inventory screens not being clickable." + - rscadd: "Clicking on a storage item that is already open now closes it."