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:
Henri215
2023-02-25 15:15:21 -03:00
committed by GitHub
parent e491aa9c2e
commit 1ce593b9a2
9 changed files with 92 additions and 3 deletions
@@ -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
@@ -85,6 +85,8 @@
new /obj/item/caution(src)
new /obj/item/caution(src)
new /obj/item/caution(src)
new /obj/item/twohanded/push_broom(src)
new /obj/item/twohanded/push_broom(src)
new /obj/item/storage/bag/trash(src)
new /obj/item/storage/bag/trash(src)
new /obj/item/lightreplacer(src)
+18 -2
View File
@@ -12,8 +12,9 @@
//copypaste sorry
var/maximum_volume = 150
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
var/obj/item/storage/bag/trash/mybag = null
var/obj/item/storage/bag/trash/mybag = null
var/obj/item/mop/mymop = null
var/obj/item/twohanded/push_broom/mybroom = null
var/obj/item/reagent_containers/spray/cleaner/myspray = null
var/obj/item/lightreplacer/myreplacer = null
var/signs = 0
@@ -28,6 +29,7 @@
GLOB.janitorial_equipment -= src
QDEL_NULL(mybag)
QDEL_NULL(mymop)
QDEL_NULL(mybroom)
QDEL_NULL(myspray)
QDEL_NULL(myreplacer)
return ..()
@@ -56,7 +58,12 @@
m.janicart_insert(user, src)
else
to_chat(user, fail_msg)
else if(istype(I, /obj/item/twohanded/push_broom))
if(!mybroom)
var/obj/item/twohanded/push_broom/B = I
B.janicart_insert(user, src)
else
to_chat(user, fail_msg)
else if(istype(I, /obj/item/storage/bag/trash))
if(!mybag)
var/obj/item/storage/bag/trash/t=I
@@ -114,6 +121,8 @@
dat += "<a href='?src=[UID()];garbage=1'>[mybag.name]</a><br>"
if(mymop)
dat += "<a href='?src=[UID()];mop=1'>[mymop.name]</a><br>"
if(mybroom)
dat += "<a href='?src=[UID()];broom=1'>[mybroom.name]</a><br>"
if(myspray)
dat += "<a href='?src=[UID()];spray=1'>[myspray.name]</a><br>"
if(myreplacer)
@@ -140,6 +149,11 @@
user.put_in_hands(mymop)
to_chat(user, "<span class='notice'>You take [mymop] from [src].</span>")
mymop = null
if(href_list["broom"])
if(mybroom)
user.put_in_hands(mybroom)
to_chat(user, "<span class='notice'>You take [mybroom] from [src].</span>")
mybroom = null
if(href_list["spray"])
if(myspray)
user.put_in_hands(myspray)
@@ -170,6 +184,8 @@
. += "cart_garbage"
if(mymop)
. += "cart_mop"
if(mybroom)
. += "cart_broom"
if(myspray)
. += "cart_spray"
if(myreplacer)
@@ -493,6 +493,7 @@
/obj/item/grenade/chem_grenade/antiweed = 2,
/obj/item/reagent_containers/spray/cleaner/advanced = 1,
/obj/item/storage/bag/trash = 1,
/obj/item/twohanded/push_broom,
/obj/item/storage/box/lights/mixed = 1,
/obj/item/melee/flyswatter = 1)
@@ -143,6 +143,7 @@
/obj/item/reagent_containers/glass/bucket,
/obj/item/reagent_containers/glass/bucket,
/obj/item/mop,
/obj/item/twohanded/push_broom,
/obj/item/caution,
/obj/item/caution,
/obj/item/caution,
Binary file not shown.

Before

Width:  |  Height:  |  Size: 560 B

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 B

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 17 KiB