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
This commit is contained in:
PKPenguin321
2019-10-14 07:05:06 +02:00
committed by AnturK
parent 6178743ed4
commit deeac2355a
@@ -614,6 +614,11 @@
if(!stop_messages)
to_chat(M, "<span class='warning'>[I] is too big for [host]!</span>")
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, "<span class='warning'>[I] can't fit in [host] while [real_location.loc] is in the way!</span>")
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.