From deeac2355a73c588a9765e87cbb9cabf28208c35 Mon Sep 17 00:00:00 2001 From: PKPenguin321 Date: Sun, 13 Oct 2019 22:05:06 -0700 Subject: [PATCH] Big storage containers (like bags) in smaller ones (like boxes) can't have items placed in them (#46983) * Bags in boxes can't have items placed in them Untested webedit Fixes https://github.com/tgstation/tgstation/issues/46345 * smooths a redundant check * more squishing --- code/datums/components/storage/storage.dm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 5068e0806e3..f6b33f7326c 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -614,6 +614,11 @@ if(!stop_messages) to_chat(M, "[I] is too big for [host]!") return FALSE + var/datum/component/storage/biggerfish = real_location.loc.GetComponent(/datum/component/storage) + if(biggerfish && biggerfish.max_w_class < max_w_class)//return false if we are inside of another container, and that container has a smaller max_w_class than us (like if we're a bag in a box) + if(!stop_messages) + to_chat(M, "[I] can't fit in [host] while [real_location.loc] is in the way!") + return FALSE var/sum_w_class = I.w_class for(var/obj/item/_I in real_location) sum_w_class += _I.w_class //Adds up the combined w_classes which will be in the storage item if the item is added to it.