mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-15 17:13:46 +01:00
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:
@@ -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()
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -34,8 +34,11 @@
|
||||
QDEL_NULL(myreplacer)
|
||||
return ..()
|
||||
|
||||
/obj/structure/janitorialcart/proc/put_in_cart(obj/item/I, mob/user)
|
||||
user.drop_item()
|
||||
/obj/structure/janitorialcart/proc/put_in_cart(mob/user, obj/item/I)
|
||||
if(!user.unEquip(I)) // We can do this here because everything below wants to
|
||||
to_chat(user, "<span class='warning'>[I] is stuck to your hand!</span>")
|
||||
return
|
||||
|
||||
I.forceMove(src)
|
||||
to_chat(user, "<span class='notice'>You put [I] into [src].</span>")
|
||||
update_icon(UPDATE_OVERLAYS)
|
||||
@@ -45,52 +48,51 @@
|
||||
update_icon(UPDATE_OVERLAYS)
|
||||
|
||||
/obj/structure/janitorialcart/attackby(obj/item/I, mob/user, params)
|
||||
var/fail_msg = "<span class='notice'>There is already one of those in [src].</span>"
|
||||
if(I.is_robot_module())
|
||||
to_chat(user, "<span class='warning'>You cannot interface your modules with [src]!</span>")
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/mop))
|
||||
var/obj/item/mop/M = I
|
||||
if(M.reagents.total_volume < M.reagents.maximum_volume)
|
||||
M.wet_mop(src, user)
|
||||
return
|
||||
if(!mymop)
|
||||
mymop = I
|
||||
put_in_cart(user, I)
|
||||
return
|
||||
to_chat(user, "<span class='notice'>There is already one of those in [src].</span>")
|
||||
|
||||
else if(istype(I, /obj/item/push_broom) && !mybroom)
|
||||
mybroom = I
|
||||
put_in_cart(user, I)
|
||||
|
||||
else if(istype(I, /obj/item/storage/bag/trash) && !mybag)
|
||||
mybag = I
|
||||
put_in_cart(user, I)
|
||||
|
||||
else if(istype(I, /obj/item/reagent_containers/spray/cleaner) && !myspray)
|
||||
myspray = I
|
||||
put_in_cart(user, I)
|
||||
|
||||
else if(istype(I, /obj/item/lightreplacer) && !myreplacer)
|
||||
myreplacer = I
|
||||
put_in_cart(user, I)
|
||||
|
||||
else if(istype(I, /obj/item/caution))
|
||||
if(signs < max_signs)
|
||||
signs++
|
||||
put_in_cart(user, I)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] can't hold any more signs.</span>")
|
||||
|
||||
to_chat(user, "<span class='notice'>There is already one of those in [src].</span>")
|
||||
|
||||
else if(mybag)
|
||||
mybag.attackby(I, user, params)
|
||||
|
||||
if(!I.is_robot_module())
|
||||
if(istype(I, /obj/item/mop))
|
||||
var/obj/item/mop/m=I
|
||||
if(m.reagents.total_volume < m.reagents.maximum_volume)
|
||||
m.wet_mop(src, user)
|
||||
return
|
||||
if(!mymop)
|
||||
m.janicart_insert(user, src)
|
||||
else
|
||||
to_chat(user, fail_msg)
|
||||
else if(istype(I, /obj/item/push_broom))
|
||||
if(!mybroom)
|
||||
var/obj/item/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
|
||||
t.janicart_insert(user, src)
|
||||
else
|
||||
to_chat(user, fail_msg)
|
||||
else if(istype(I, /obj/item/reagent_containers/spray/cleaner))
|
||||
if(!myspray)
|
||||
myspray = I
|
||||
put_in_cart(I, user)
|
||||
else
|
||||
to_chat(user, fail_msg)
|
||||
else if(istype(I, /obj/item/lightreplacer))
|
||||
if(!myreplacer)
|
||||
var/obj/item/lightreplacer/l=I
|
||||
l.janicart_insert(user,src)
|
||||
else
|
||||
to_chat(user, fail_msg)
|
||||
else if(istype(I, /obj/item/caution))
|
||||
if(signs < max_signs)
|
||||
signs++
|
||||
put_in_cart(I, user)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] can't hold any more signs.</span>")
|
||||
else if(mybag)
|
||||
mybag.attackby(I, user, params)
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You cannot interface your modules with [src]!</span>")
|
||||
to_chat(user, "<span class='notice'>There is already one of those in [src].</span>")
|
||||
|
||||
/obj/structure/janitorialcart/crowbar_act(mob/living/user, obj/item/I)
|
||||
. = TRUE
|
||||
|
||||
Reference in New Issue
Block a user