mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 02:54:41 +01:00
Ports TG push broom (#20367)
* Ports TG push broom * Update code/game/objects/items/weapons/twohanded.dm Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> * Lewc review and twohanded autodoc * Steelslayer review --------- Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
@@ -438,7 +438,8 @@
|
||||
/obj/item/soap,
|
||||
/obj/item/holosign_creator/janitor,
|
||||
/obj/item/melee/flyswatter,
|
||||
/obj/item/storage/bag/trash
|
||||
/obj/item/storage/bag/trash,
|
||||
/obj/item/twohanded/push_broom
|
||||
)
|
||||
|
||||
/obj/item/storage/belt/janitor/full/populate_contents()
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* Mjolnnir
|
||||
* Knighthammer
|
||||
* Pyro Claws
|
||||
* Push Broom
|
||||
*/
|
||||
|
||||
/*##################################################################
|
||||
@@ -953,3 +954,70 @@
|
||||
on_cooldown = FALSE
|
||||
flags &= ~NODROP
|
||||
atom_say("Internal plasma canisters recharged. Gloves sufficiently cooled")
|
||||
|
||||
/// Max number of atoms a broom can sweep at once
|
||||
#define BROOM_PUSH_LIMIT 20
|
||||
|
||||
/obj/item/twohanded/push_broom
|
||||
name = "push broom"
|
||||
desc = "This is my BROOMSTICK! It can be used manually or braced with two hands to sweep items as you move. It has a telescopic handle for compact storage."
|
||||
icon = 'icons/obj/janitor.dmi'
|
||||
icon_state = "broom0"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/custodial_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/custodial_righthand.dmi'
|
||||
force = 8
|
||||
throwforce = 10
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
force_unwielded = 8
|
||||
force_wielded = 12
|
||||
attack_verb = list("swept", "brushed off", "bludgeoned", "whacked")
|
||||
resistance_flags = FLAMMABLE
|
||||
|
||||
/obj/item/twohanded/push_broom/update_icon_state()
|
||||
icon_state = "broom[wielded]"
|
||||
|
||||
/obj/item/twohanded/push_broom/wield(mob/user)
|
||||
. = ..()
|
||||
to_chat(user, "<span class='notice'>You brace [src] against the ground in a firm sweeping stance.</span>")
|
||||
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(sweep))
|
||||
|
||||
/obj/item/twohanded/push_broom/unwield(mob/user)
|
||||
. = ..()
|
||||
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)
|
||||
|
||||
/obj/item/twohanded/push_broom/afterattack(atom/A, mob/user, proximity)
|
||||
. = ..()
|
||||
if(!proximity)
|
||||
return
|
||||
sweep(user, A, FALSE)
|
||||
|
||||
/obj/item/twohanded/push_broom/proc/sweep(mob/user, atom/A, moving = TRUE)
|
||||
SIGNAL_HANDLER
|
||||
var/turf/current_item_loc = moving ? user.loc : (isturf(A) ? A : A.loc)
|
||||
if(!isturf(current_item_loc))
|
||||
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/trash_amount = 1
|
||||
for(var/obj/item/garbage in current_item_loc.contents)
|
||||
if(!garbage.anchored)
|
||||
if(target_bin)
|
||||
garbage.forceMove(target_bin)
|
||||
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, "<span class='notice'>You sweep the pile of garbage into [target_bin].</span>")
|
||||
playsound(loc, 'sound/weapons/thudswoosh.ogg', 10, TRUE, -1)
|
||||
|
||||
/obj/item/twohanded/push_broom/proc/janicart_insert(mob/user, obj/structure/janitorialcart/cart)
|
||||
cart.mybroom = src
|
||||
cart.put_in_cart(src, user)
|
||||
|
||||
#undef BROOM_PUSH_LIMIT
|
||||
|
||||
Reference in New Issue
Block a user