Refactors janitorialcart/attackby and removes a very duplicated proc on mops, lightreplacers and more (#26255)

* Wohooo refactor

* Whoops

* Adds unequip

* Fixes

* Update code/game/objects/items/weapons/mop.dm

Co-authored-by: Adrer <erwin@lombok.demon.nl>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Update code/game/objects/items/weapons/mop.dm

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

---------

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Adrer <erwin@lombok.demon.nl>
This commit is contained in:
DGamerL
2024-08-02 18:08:06 +00:00
committed by GitHub
co-authored by Adrer
parent 54b0c33144
commit 4787bf65e0
5 changed files with 62 additions and 86 deletions
@@ -240,7 +240,7 @@
var/turf/replace_turf = get_turf(target)
if(!istype(replace_turf))
return
if(get_dist(src, target) >= (U.client.maxview() + 2)) // To prevent people from using it over cameras
return
@@ -258,13 +258,6 @@
if(!used)
to_chat(U, "[src]'s refill light blinks red.")
/obj/item/lightreplacer/proc/janicart_insert(mob/user, obj/structure/janitorialcart/J)
J.myreplacer = src
J.put_in_cart(src, user)
/obj/item/lightreplacer/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J)
return
/obj/item/lightreplacer/cyborg/cyborg_recharge(coeff, emagged)
for(var/I in 1 to coeff)
Charge()
+13 -18
View File
@@ -28,19 +28,21 @@
GLOB.janitorial_equipment -= src
return ..()
/obj/item/mop/proc/wet_mop(obj/o, mob/user)
if(o.reagents.total_volume < 1)
to_chat(user, "[o] is out of water!</span>")
if(istype(o, /obj/structure/mopbucket))
var/obj/structure/mopbucket/mopbucket = o
mopbucket.mopbucket_insert(user, o)
if(istype(o, /obj/structure/janitorialcart))
janicart_insert(user, o)
/obj/item/mop/proc/wet_mop(obj/O, mob/user)
if(O.reagents.total_volume < 1)
to_chat(user, "<span class='notice'>[O] is empty!</span>")
if(istype(O, /obj/structure/mopbucket))
var/obj/structure/mopbucket/mopbucket = O
mopbucket.mopbucket_insert(user, O)
if(istype(O, /obj/structure/janitorialcart))
var/obj/structure/janitorialcart/janicart = O
if(!janicart.mymop)
janicart.put_in_cart(user, src)
return
o.reagents.trans_to(src, 6)
to_chat(user, "<span class='notice'>You wet [src] in [o].</span>")
playsound(loc, 'sound/effects/slosh.ogg', 25, 1)
O.reagents.trans_to(src, 6)
to_chat(user, "<span class='notice'>You wet [src] in [O].</span>")
playsound(loc, 'sound/effects/slosh.ogg', 25, TRUE)
/obj/item/mop/afterattack(atom/A, mob/user, proximity)
if(!proximity)
@@ -73,10 +75,6 @@
else
return ..()
/obj/item/mop/proc/janicart_insert(mob/user, obj/structure/janitorialcart/J)
J.mymop = src
J.put_in_cart(src, user)
/obj/item/mop/wash(mob/user, atom/source)
reagents.add_reagent("water", 5)
to_chat(user, "<span class='notice'>You wet [src] in [source].</span>")
@@ -126,7 +124,4 @@
/obj/item/mop/advanced/cyborg
/obj/item/mop/advanced/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J)
return
#undef MOP_SOUND_CD
@@ -96,13 +96,6 @@
/obj/item/storage/bag/trash/cyborg
/obj/item/storage/bag/trash/proc/janicart_insert(mob/user, obj/structure/janitorialcart/J)
J.mybag = src
J.put_in_cart(src, user)
/obj/item/storage/bag/trash/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J)
return
/obj/item/storage/bag/trash/bluespace
name = "trash bag of holding"
desc = "The latest and greatest in custodial convenience, a trashbag that is capable of holding vast quantities of garbage."
@@ -115,9 +108,6 @@
/obj/item/storage/bag/trash/bluespace/cyborg
/obj/item/storage/bag/trash/bluespace/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J)
return
////////////////////////////////////////
// MARK: Plastic bag
////////////////////////////////////////
@@ -946,10 +946,6 @@
trash.forceMove(storage)
storage.update_icon()
/obj/item/push_broom/proc/janicart_insert(mob/user, obj/structure/janitorialcart/cart)
cart.mybroom = src
cart.put_in_cart(src, user)
/obj/item/push_broom/traitor
name = "titanium push broom"
desc = "This is my BROOMSTICK! All of the functionality of a normal broom, but at least half again more robust."