From c596e415dee88bf0fa3363d597de8d8489c9b300 Mon Sep 17 00:00:00 2001 From: Henri215 <77684085+Henri215@users.noreply.github.com> Date: Sat, 25 Mar 2023 09:38:49 -0300 Subject: [PATCH] You can now sweep into janicarts trash bags (#20629) * You can now sweep into janicarts trash bags * farie review * Apply suggestions from code review Co-authored-by: Farie82 --------- Co-authored-by: Farie82 --- code/game/objects/items/weapons/twohanded.dm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 952b4286429..49e2c0cf9e8 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -1004,22 +1004,30 @@ return var/turf/new_item_loc = get_step(current_item_loc, user.dir) var/obj/machinery/disposal/target_bin = locate(/obj/machinery/disposal) in new_item_loc.contents + var/obj/structure/janitorialcart/jani_cart = locate(/obj/structure/janitorialcart) in new_item_loc.contents + 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(target_bin) - garbage.forceMove(target_bin) + 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(trash_amount > BROOM_PUSH_LIMIT) break if(trash_amount > 1) - if(target_bin) - target_bin.update_icon() - to_chat(user, "You sweep the pile of garbage into [target_bin].") playsound(loc, 'sound/weapons/thudswoosh.ogg', 10, TRUE, -1) +/obj/item/twohanded/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/twohanded/push_broom/proc/janicart_insert(mob/user, obj/structure/janitorialcart/cart) cart.mybroom = src cart.put_in_cart(src, user)