From 0ad8fac9c57d54e3fab5d4da598760dfae3ae263 Mon Sep 17 00:00:00 2001
From: S34N <12197162+S34NW@users.noreply.github.com>
Date: Fri, 17 Dec 2021 09:45:07 +0000
Subject: [PATCH] Checks contents of storage items for restrictions (#17236)
Co-authored-by: warriorstar-orion <59303604+warriorstar-orion@users.noreply.github.com>
---
code/game/objects/items/weapons/storage/storage.dm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm
index fc0fc143249..0ad8439d123 100644
--- a/code/game/objects/items/weapons/storage/storage.dm
+++ b/code/game/objects/items/weapons/storage/storage.dm
@@ -43,7 +43,7 @@
var/foldable_amt = 0
/// Lazy list of mobs which are currently viewing the storage inventory.
- var/list/mobs_viewing
+ var/list/mobs_viewing
/obj/item/storage/Initialize(mapload)
. = ..()
@@ -353,6 +353,14 @@
to_chat(usr, "[src] cannot hold [I].")
return FALSE
+ if(length(cant_hold) && istype(I, /obj/item/storage)) //Checks nested storage contents for restricted objects, we don't want people sneaking the NAD in via boxes now, do we?
+ var/obj/item/storage/S = I
+ for(var/obj/A in S.return_inv())
+ if(is_type_in_typecache(A, cant_hold))
+ if(!stop_messages)
+ to_chat(usr, "[src] rejects [I] because of its contents.")
+ return FALSE
+
if(I.w_class > max_w_class)
if(!stop_messages)
to_chat(usr, "[I] is too big for [src].")