Respect the inventory (#22941)

This commit is contained in:
Farie82
2023-10-17 22:02:15 +02:00
committed by GitHub
parent 335327ef24
commit 074959da06
+15 -11
View File
@@ -905,16 +905,21 @@
var/obj/vehicle/janicart/jani_vehicle = locate(/obj/vehicle/janicart) in new_item_loc.contents
var/trash_amount = 1
for(var/obj/item/garbage in current_item_loc.contents)
if(!garbage.anchored)
if(jani_vehicle?.mybag && garbage.w_class <= WEIGHT_CLASS_SMALL)
move_into_storage(user, jani_vehicle.mybag, garbage)
else if(jani_cart?.mybag && garbage.w_class <= WEIGHT_CLASS_SMALL)
move_into_storage(user, jani_cart.mybag, garbage)
else if(target_bin)
move_into_storage(user, target_bin, garbage)
else
garbage.Move(new_item_loc, user.dir)
trash_amount++
if(garbage.anchored)
continue
var/obj/item/storage/bag/trash/bag = jani_vehicle?.mybag || jani_cart?.mybag
var/obj/trashed_into
if(bag?.can_be_inserted(garbage, TRUE))
bag.handle_item_insertion(garbage, TRUE)
trashed_into = bag
else if(target_bin)
move_into_storage(user, target_bin, garbage)
trashed_into = target_bin
else
garbage.Move(new_item_loc, user.dir)
if(trashed_into)
to_chat(user, "<span class='notice'>You sweep the pile of garbage into [trashed_into].</span>")
trash_amount++
if(trash_amount > BROOM_PUSH_LIMIT)
break
if(trash_amount > 1)
@@ -923,7 +928,6 @@
/obj/item/push_broom/proc/move_into_storage(mob/user, obj/storage, obj/trash)
trash.forceMove(storage)
storage.update_icon()
to_chat(user, "<span class='notice'>You sweep the pile of garbage into [storage].</span>")
/obj/item/push_broom/proc/janicart_insert(mob/user, obj/structure/janitorialcart/cart)
cart.mybroom = src