mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 12:04:48 +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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user