mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 10:33:30 +01:00
Close storage UI when item becomes inaccessible (#14536)
* add hide_from_all to storage objects, to call by something once it's locked/close * lockers call hide_from_all on stored storage items * secure storage calls hide_from_all on lock * throwing storage closes it * adding storage to a disposal chute closes it * adding storage to a crate closes it * adding storage to the destructive analyzer closes it
This commit is contained in:
@@ -147,6 +147,7 @@
|
||||
else
|
||||
if((href_list["type"] == "R") && (emagged == 0) && (!l_setshort))
|
||||
locked = 1
|
||||
hide_from_all()
|
||||
overlays = null
|
||||
code = null
|
||||
close(usr)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
var/allow_quick_gather //Set this variable to allow the object to have the 'toggle mode' verb, which quickly collects all items from a tile.
|
||||
var/collection_mode = 1; //0 = pick one at a time, 1 = pick all on tile
|
||||
var/use_sound = "rustle" //sound played when used. null for no sound.
|
||||
var/list/active_users = list() // list of ckey(user.key), who is viewing the inventory?
|
||||
|
||||
/// What kind of [/obj/item/stack] can this be folded into. (e.g. Boxes and cardboard)
|
||||
var/foldable = null
|
||||
@@ -129,6 +130,8 @@
|
||||
user.client.screen += closer
|
||||
user.client.screen += contents
|
||||
user.s_active = src
|
||||
if(user.key)
|
||||
active_users[ckey(user.key)] = TRUE
|
||||
return
|
||||
|
||||
/obj/item/storage/proc/hide_from(mob/user as mob)
|
||||
@@ -140,8 +143,19 @@
|
||||
user.client.screen -= src.contents
|
||||
if(user.s_active == src)
|
||||
user.s_active = null
|
||||
if(user.key)
|
||||
active_users.Remove(ckey(user.key))
|
||||
return
|
||||
|
||||
/obj/item/storage/proc/hide_from_all()
|
||||
for(var/K in active_users)
|
||||
var/client/C = get_client_by_ckey(K)
|
||||
if(C)
|
||||
var/mob/M = C.mob
|
||||
if(M)
|
||||
hide_from(M)
|
||||
|
||||
|
||||
/obj/item/storage/proc/open(mob/user as mob)
|
||||
if(src.use_sound)
|
||||
playsound(src.loc, src.use_sound, 50, 1, -5)
|
||||
|
||||
@@ -103,6 +103,9 @@
|
||||
if(!I.anchored)
|
||||
I.forceMove(src)
|
||||
itemcount++
|
||||
if(istype(I, /obj/item/storage))
|
||||
var/obj/item/storage/S = I
|
||||
S.hide_from_all()
|
||||
|
||||
for(var/mob/M in loc)
|
||||
if(itemcount >= storage_capacity)
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
continue
|
||||
O.forceMove(src)
|
||||
itemcount++
|
||||
if(istype(O, /obj/item/storage))
|
||||
var/obj/item/storage/S = O
|
||||
S.hide_from_all()
|
||||
|
||||
icon_state = icon_closed
|
||||
src.opened = FALSE
|
||||
|
||||
Reference in New Issue
Block a user