From 074959da0649ef44679e708b3581ef6f8a02e528 Mon Sep 17 00:00:00 2001 From: Farie82 Date: Tue, 17 Oct 2023 22:02:15 +0200 Subject: [PATCH] Respect the inventory (#22941) --- code/game/objects/items/weapons/twohanded.dm | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index c2058389579..f5632d29db9 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -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, "You sweep the pile of garbage into [trashed_into].") + 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, "You sweep the pile of garbage into [storage].") /obj/item/push_broom/proc/janicart_insert(mob/user, obj/structure/janitorialcart/cart) cart.mybroom = src