Mop, Mop Bucket, and Janicart Refactor (#28049)

* Update mop.dm

* This... Is a bucket

* Dear god...

* Update janicart.dm

* There's more

* No!

* Finished?

* newline

* Update janicart.dm

* Update mop.dm

* Update mop.dm

* Update mop.dm
This commit is contained in:
CRUNCH
2025-02-18 11:13:05 +00:00
committed by GitHub
parent d05cc7c5cb
commit 39142470e8
4 changed files with 224 additions and 146 deletions
+44 -29
View File
@@ -1,8 +1,8 @@
#define MOP_SOUND_CD 2 SECONDS // How many seconds before the mopping sound triggers again
/obj/item/mop
desc = "The world of janitalia wouldn't be complete without a mop."
name = "mop"
desc = "The world of janitalia wouldn't be complete without a mop."
icon = 'icons/obj/janitor.dmi'
icon_state = "mop"
lefthand_file = 'icons/mob/inhands/equipment/custodial_lefthand.dmi'
@@ -14,6 +14,7 @@
w_class = WEIGHT_CLASS_NORMAL
attack_verb = list("mopped", "bashed", "bludgeoned", "whacked")
resistance_flags = FLAMMABLE
new_attack_chain = TRUE
var/mopcap = 6
var/mopspeed = 30
/// The cooldown between each mopping sound effect
@@ -28,41 +29,55 @@
GLOB.janitorial_equipment -= src
return ..()
/obj/item/mop/proc/wet_mop(obj/O, mob/user)
/obj/item/mop/proc/wet_mop(obj/O, mob/user, robot_mop)
if(O.reagents.total_volume < 1)
to_chat(user, "<span class='notice'>[O] is empty!</span>")
to_chat(user, "<span class='warning'>[O] is empty!</span>")
if(robot_mop)
return
if(istype(O, /obj/structure/mopbucket))
var/obj/structure/mopbucket/mopbucket = O
mopbucket.mopbucket_insert(user, O)
if(!mopbucket.stored_mop)
mopbucket.stored_mop = src
mopbucket.put_in_cart(user, src)
return
if(istype(O, /obj/structure/janitorialcart))
var/obj/structure/janitorialcart/janicart = O
if(!janicart.mymop)
janicart.mymop = src
var/obj/structure/janitorialcart/janicart = O
if(!janicart.my_mop)
janicart.my_mop = src
janicart.put_in_cart(user, src)
return
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, TRUE)
/obj/item/mop/afterattack__legacy__attackchain(atom/A, mob/user, proximity)
if(!proximity)
return
if(istype(A, /obj/item/reagent_containers/glass/bucket) || istype(A, /obj/structure/janitorialcart) || istype(A, /obj/structure/mopbucket))
return
/obj/item/mop/interact_with_atom(atom/target, mob/living/user, list/modifiers)
// Use the mop as a weapon.
if(user.a_intent != INTENT_HELP)
return ..()
if(istype(target, /obj/item/reagent_containers/glass/bucket/))
return ..()
if(istype(target, /obj/structure/janitorialcart/) || istype(target, /obj/structure/mopbucket))
return ITEM_INTERACT_COMPLETE
if(reagents.total_volume < 1)
to_chat(user, "<span class='warning'>Your mop is dry!</span>")
return
return ITEM_INTERACT_COMPLETE
if(world.time > mop_sound_cooldown)
playsound(loc, pick('sound/weapons/mopping1.ogg', 'sound/weapons/mopping2.ogg'), 30, TRUE, -1)
mop_sound_cooldown = world.time + MOP_SOUND_CD
A.cleaning_act(user, src, mopspeed, text_verb = "mop", text_description = ".")
target.cleaning_act(user, src, mopspeed, text_verb = "mop", text_description = ".")
return ITEM_INTERACT_COMPLETE
/obj/item/mop/can_clean()
. = FALSE
if(reagents.has_reagent("water", 1) || reagents.has_reagent("cleaner", 1) || reagents.has_reagent("holywater", 1))
return TRUE
else
return FALSE
/obj/item/mop/post_clean(atom/target, mob/user)
var/turf/T = get_turf(target)
@@ -70,21 +85,15 @@
reagents.reaction(T, REAGENT_TOUCH, 10) //10 is the multiplier for the reaction effect. probably needed to wet the floor properly.
reagents.remove_any(1) //reaction() doesn't use up the reagents
/obj/effect/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(istype(I, /obj/item/mop) || istype(I, /obj/item/soap))
return
else
return ..()
/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>")
playsound(loc, 'sound/effects/slosh.ogg', 25, 1)
return 1
return TRUE
/obj/item/mop/advanced
desc = "The most advanced tool in a custodian's arsenal. Just think of all the viscera you will clean up with this!"
name = "advanced mop"
desc = "The most advanced tool in a custodian's arsenal. Just think of all the viscera you will clean up with this!"
mopcap = 10
icon_state = "advmop"
origin_tech = "materials=3;engineering=3"
@@ -92,15 +101,21 @@
throwforce = 8
throw_range = 4
mopspeed = 20
var/refill_enabled = TRUE //Self-refill toggle for when a janitor decides to mop with something other than water.
var/refill_rate = 1 //Rate per process() tick mop refills itself
var/refill_reagent = "water" //Determins what reagent to use for refilling, just in case someone wanted to make a HOLY MOP OF PURGING
/// Self-refill toggle for when a janitor decides to mop with something other than water.
var/refill_enabled = TRUE
/// Rate per process() tick mop refills itself
var/refill_rate = 1
/// Determins what reagent to use for refilling, just in case someone wanted to make a HOLY MOP OF PURGING
var/refill_reagent = "water"
/obj/item/mop/advanced/New()
..()
START_PROCESSING(SSobj, src)
/obj/item/mop/advanced/attack_self__legacy__attackchain(mob/user)
/obj/item/mop/advanced/activate_self(mob/user)
if(..())
return
refill_enabled = !refill_enabled
if(refill_enabled)
START_PROCESSING(SSobj, src)
+1 -1
View File
@@ -952,7 +952,7 @@
for(var/obj/item/garbage in current_item_loc.contents)
if(garbage.anchored)
continue
var/obj/item/storage/bag/trash/bag = jani_vehicle?.mybag || jani_cart?.mybag
var/obj/item/storage/bag/trash/bag = jani_vehicle?.mybag || jani_cart?.my_bag
var/obj/trashed_into
if(bag?.can_be_inserted(garbage, TRUE))
bag.handle_item_insertion(garbage, user, TRUE)
+145 -98
View File
@@ -9,14 +9,15 @@
density = TRUE
face_while_pulling = FALSE
container_type = OPENCONTAINER
new_attack_chain = TRUE
//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/mop/mymop = null
var/obj/item/push_broom/mybroom = null
var/obj/item/reagent_containers/spray/cleaner/myspray = null
var/obj/item/lightreplacer/myreplacer = null
var/obj/item/storage/bag/trash/my_bag = null
var/obj/item/mop/my_mop = null
var/obj/item/push_broom/my_broom = null
var/obj/item/reagent_containers/spray/cleaner/my_spray = null
var/obj/item/lightreplacer/my_replacer = null
var/signs = 0
var/const/max_signs = 4
@@ -27,11 +28,11 @@
/obj/structure/janitorialcart/Destroy()
GLOB.janitorial_equipment -= src
QDEL_NULL(mybag)
QDEL_NULL(mymop)
QDEL_NULL(mybroom)
QDEL_NULL(myspray)
QDEL_NULL(myreplacer)
QDEL_NULL(my_bag)
QDEL_NULL(my_mop)
QDEL_NULL(my_broom)
QDEL_NULL(my_spray)
QDEL_NULL(my_replacer)
return ..()
/obj/structure/janitorialcart/proc/put_in_cart(mob/user, obj/item/I)
@@ -47,98 +48,144 @@
/obj/structure/janitorialcart/on_reagent_change()
update_icon(UPDATE_OVERLAYS)
/obj/structure/janitorialcart/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(I.is_robot_module())
to_chat(user, "<span class='warning'>You cannot interface your modules with [src]!</span>")
/obj/structure/janitorialcart/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(user.a_intent != INTENT_HELP)
return ..()
if(handle_janitorial_equipment(user, used))
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/reagent_containers))
return ITEM_INTERACT_SKIP_TO_AFTER_ATTACK
return ..()
/obj/structure/janitorialcart/proc/handle_janitorial_equipment(mob/living/user, obj/item/used)
. = TRUE
var/robot_module = used.is_robot_module()
var/item_present = FALSE
if(istype(used, /obj/item/mop))
var/obj/item/mop/attacking_mop = used
if(attacking_mop.reagents.total_volume < attacking_mop.reagents.maximum_volume)
attacking_mop.wet_mop(src, user, robot_module)
return
if(robot_module)
to_chat(user, "<span class='warning'>You cannot store [used] in [src]!</span>")
return
if(!my_mop)
my_mop = attacking_mop
put_in_cart(user, attacking_mop)
else
to_chat(user, "<span class='notice'>There is already one of those in [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>")
if(robot_module)
to_chat(user, "<span class='warning'>You cannot store [used] in [src]!</span>")
return
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(istype(used, /obj/item/caution))
if(signs < max_signs)
signs++
put_in_cart(user, I)
put_in_cart(user, used)
else
to_chat(user, "<span class='notice'>[src] can't hold any more signs.</span>")
return
if(istype(used, /obj/item/push_broom))
if(!my_broom)
my_broom = used
put_in_cart(user, used)
return
item_present = TRUE
if(istype(used, /obj/item/storage/bag/trash))
if(!my_bag)
my_bag = used
put_in_cart(user, used)
return
item_present = TRUE
if(istype(used, /obj/item/reagent_containers/spray/cleaner))
if(!my_spray)
my_spray = used
put_in_cart(user, used)
return
item_present = TRUE
if(istype(used, /obj/item/lightreplacer))
if(!my_replacer)
my_replacer = used
put_in_cart(user, used)
return
item_present = TRUE
if(item_present)
to_chat(user, "<span class='notice'>There is already one of those in [src].</span>")
return
else if(mybag)
mybag.attackby__legacy__attackchain(I, user, params)
else
to_chat(user, "<span class='notice'>There is already one of those in [src].</span>")
return FALSE
/obj/structure/janitorialcart/crowbar_act(mob/living/user, obj/item/I)
. = TRUE
user.visible_message("<span class='warning'>[user] begins to empty the contents of [src].</span>")
if(!I.use_tool(src, user, 3 SECONDS, I.tool_volume))
user.visible_message(
"<span class='warning'>[user] begins to empty the contents of [src].</span>",
"<span class='notice'>You begin to empty the contents of [src].</span>",
"<span class='warning'>You hear a prying sound.</span>"
)
if(!I.use_tool(src, user, 3 SECONDS, volume = I.tool_volume))
return
to_chat(user, "<span class='notice'>You empty the contents of [src]'s bucket onto the floor.</span>")
user.visible_message(
"<span class='warning'>[user] empties the contents of [src]'s bucket onto the floor!</span>",
"<span class='notice'>You empty the contents of [src]'s bucket onto the floor.</span>",
"<span class='warning'>You hear liquid spilling onto the floor.</span>"
)
reagents.reaction(loc)
reagents.clear_reagents()
/obj/structure/janitorialcart/wrench_act(mob/living/user, obj/item/I)
. = TRUE
if(!anchored && !isinspace())
if(!I.use_tool(src, user, I.tool_volume))
if(!I.use_tool(src, user, volume = I.tool_volume))
return
user.visible_message( \
"[user] tightens [src]'s casters.", \
"<span class='notice'>You have tightened [src]'s casters.</span>", \
"You hear ratchet.")
"<span class='notice'>[user] tightens [src]'s casters.</span>",
"<span class='notice'>You have tightened [src]'s casters.</span>",
"<span class='notice'>You hear ratcheting.</span>"
)
anchored = TRUE
return
if(anchored)
if(!I.use_tool(src, user, I.tool_volume))
if(!I.use_tool(src, user, volume = I.tool_volume))
return
user.visible_message( \
"[user] loosens [src]'s casters.", \
"<span class='notice'>You have loosened [src]'s casters.</span>", \
"You hear ratchet.")
"<span class='notice'>[user] loosens [src]'s casters.</span>",
"<span class='notice'>You have loosened [src]'s casters.</span>",
"<span class='notice'>You hear ratcheting.</span>"
)
anchored = FALSE
/obj/structure/janitorialcart/attack_hand(mob/user)
var/list/cart_items = list()
if(mybag)
cart_items["Trash Bag"] = image(icon = mybag.icon, icon_state = mybag.icon_state)
if(mymop)
cart_items["Mop"] = image(icon = mymop.icon, icon_state = mymop.icon_state)
if(mybroom)
cart_items["Broom"] = image(icon = mybroom.icon, icon_state = mybroom.icon_state)
if(myspray)
cart_items["Spray Bottle"] = image(icon = myspray.icon, icon_state = myspray.icon_state)
if(myreplacer)
cart_items["Light Replacer"] = image(icon = myreplacer.icon, icon_state = myreplacer.icon_state)
var/obj/item/caution/Sign = locate() in src
if(Sign)
cart_items["Sign"] = image(icon = Sign.icon, icon_state = Sign.icon_state)
if(my_bag)
cart_items["Trash Bag"] = image(icon = my_bag.icon, icon_state = my_bag.icon_state)
if(my_mop)
cart_items["Mop"] = image(icon = my_mop.icon, icon_state = my_mop.icon_state)
if(my_broom)
cart_items["Broom"] = image(icon = my_broom.icon, icon_state = my_broom.icon_state)
if(my_spray)
cart_items["Spray Bottle"] = image(icon = my_spray.icon, icon_state = my_spray.icon_state)
if(my_replacer)
cart_items["Light Replacer"] = image(icon = my_replacer.icon, icon_state = my_replacer.icon_state)
var/obj/item/caution/sign = locate() in src
if(sign)
cart_items["Sign"] = image(icon = sign.icon, icon_state = sign.icon_state)
if(!length(cart_items))
return
@@ -150,41 +197,41 @@
switch(pick)
if("Trash Bag")
if(!mybag)
if(!my_bag)
return
user.put_in_hands(mybag)
to_chat(user, "<span class='notice'>You take [mybag] from [src].</span>")
mybag = null
user.put_in_hands(my_bag)
to_chat(user, "<span class='notice'>You take [my_bag] from [src].</span>")
my_bag = null
if("Mop")
if(!mymop)
if(!my_mop)
return
user.put_in_hands(mymop)
to_chat(user, "<span class='notice'>You take [mymop] from [src].</span>")
mymop = null
user.put_in_hands(my_mop)
to_chat(user, "<span class='notice'>You take [my_mop] from [src].</span>")
my_mop = null
if("Broom")
if(!mybroom)
if(!my_broom)
return
user.put_in_hands(mybroom)
to_chat(user, "<span class='notice'>You take [mybroom] from [src].</span>")
mybroom = null
user.put_in_hands(my_broom)
to_chat(user, "<span class='notice'>You take [my_broom] from [src].</span>")
my_broom = null
if("Spray Bottle")
if(!myspray)
if(!my_spray)
return
user.put_in_hands(myspray)
to_chat(user, "<span class='notice'>You take [myspray] from [src].</span>")
myspray = null
user.put_in_hands(my_spray)
to_chat(user, "<span class='notice'>You take [my_spray] from [src].</span>")
my_spray = null
if("Light Replacer")
if(!myreplacer)
if(!my_replacer)
return
user.put_in_hands(myreplacer)
to_chat(user, "<span class='notice'>You take [myreplacer] from [src].</span>")
myreplacer = null
user.put_in_hands(my_replacer)
to_chat(user, "<span class='notice'>You take [my_replacer] from [src].</span>")
my_replacer = null
if("Sign")
if(!signs)
return
if(Sign)
user.put_in_hands(Sign)
to_chat(user, "<span class='notice'>You take \a [Sign] from [src].</span>")
if(sign)
user.put_in_hands(sign)
to_chat(user, "<span class='notice'>You take \a [sign] from [src].</span>")
signs--
else
WARNING("Signs ([signs]) didn't match contents")
@@ -197,15 +244,15 @@
/obj/structure/janitorialcart/update_overlays()
. = ..()
if(mybag)
if(my_bag)
. += "cart_garbage"
if(mymop)
if(my_mop)
. += "cart_mop"
if(mybroom)
if(my_broom)
. += "cart_broom"
if(myspray)
if(my_spray)
. += "cart_spray"
if(myreplacer)
if(my_replacer)
. += "cart_replacer"
if(signs)
. += "cart_sign[signs]"
+34 -18
View File
@@ -6,6 +6,7 @@
density = TRUE
container_type = OPENCONTAINER
face_while_pulling = FALSE
new_attack_chain = TRUE
var/obj/item/mop/stored_mop = null
var/maximum_volume = 150
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
@@ -23,33 +24,49 @@
GLOB.janitorial_equipment -= src
return ..()
/obj/structure/mopbucket/attackby__legacy__attackchain(obj/item/W, mob/user, params)
if(W.is_robot_module())
to_chat(user, "<span class='warning'>You cannot interface your modules with [src]!</span>")
/obj/structure/mopbucket/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(user.a_intent != INTENT_HELP)
return ..()
if(handle_mop_interaction(user, used))
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/reagent_containers))
return ITEM_INTERACT_SKIP_TO_AFTER_ATTACK
return ..()
/obj/structure/mopbucket/proc/handle_mop_interaction(mob/living/user, obj/item/used)
if(!istype(used, /obj/item/mop))
return FALSE
. = TRUE
var/robot_mop = used.is_robot_module()
var/obj/item/mop/attacking_mop = used
if(attacking_mop.reagents.total_volume < attacking_mop.reagents.maximum_volume)
attacking_mop.wet_mop(src, user, robot_mop)
return
if(istype(W, /obj/item/mop))
var/obj/item/mop/attacking_mop = W
if(attacking_mop.reagents.total_volume < attacking_mop.reagents.maximum_volume)
attacking_mop.wet_mop(src, user)
return
if(robot_mop)
to_chat(user, "<span class='warning'>You cannot store [used] in [src]!</span>")
return
if(!user.drop_item_to_ground(attacking_mop))
to_chat(user, "<span class='notice'>[attacking_mop] is stuck to your hand!</span>")
return
if(stored_mop)
to_chat(user, "<span class='notice'>There is already a mop in [src].</span>")
return
if(!stored_mop)
mopbucket_insert(user, attacking_mop)
return
if(!put_in_cart(user, attacking_mop))
to_chat(user, "<span class='notice'>[attacking_mop] is stuck to your hand!</span>")
to_chat(user, "<span class='notice'>There is already a mop in the mopbucket.</span>")
/obj/structure/mopbucket/proc/put_in_cart(mob/user, obj/item/mop/I)
if(!user.unequip(I))
return FALSE
/obj/structure/mopbucket/proc/mopbucket_insert(mob/user, obj/item/mop/I)
stored_mop = I
I.forceMove(src)
to_chat(user, "<span class='notice'>You put [I] into [src].</span>")
update_icon(UPDATE_OVERLAYS)
return
return TRUE
/obj/structure/mopbucket/on_reagent_change()
update_icon(UPDATE_OVERLAYS)
@@ -81,4 +98,3 @@
stored_mop = null
update_icon(UPDATE_OVERLAYS)
return