Files
Bubberstation/code/game/objects/structures/water_structures/water_source.dm
John Willard 7d6adad613 Toilet and urinal updates (flushing dead fish included) (#83490)
## About The Pull Request

I split the water closets file into a folder for all the different
structures and also did a few other things
1. Remakes https://github.com/tgstation/tgstation/pull/81914
2. Reworks toilets, it’s now Alt Click to open/close the cover, left
click takes things out of the toilet and cistern, right click flushes
3. You can now put dead fish in the toilet to flush it
4. Adds context tips to toilets. 

## Why It's Good For The Game

When I was a 7 year old boy, I had a friend goldfish named Jeremy. He
was my greatest friend until one day when my brother told me it’s for
babies and flushed him alive down the toilet, and I’ve never seen it
again.

Closes https://github.com/tgstation/tgstation/issues/81903
Lets you flush down people’s fish in the toilet, and re-experience their
loss.

This was inspired by my lawyer fish PR, to add things more on the
non-fishing side of fish.

## Changelog

🆑
add: You can now flush toilets. You can also put fish in the toilet. And
flush them.
fix: Urinals can no longer be used to delete items.
fix: Urinals no longer grant infinite urinal cakes. 
/🆑

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
2024-06-01 17:49:33 +00:00

150 lines
5.3 KiB
Plaintext

//Water source, use the type water_source for unlimited water sources like classic sinks.
/obj/structure/water_source
name = "Water Source"
icon = 'icons/obj/watercloset.dmi'
icon_state = "sink"
desc = "A sink used for washing one's hands and face. This one seems to be infinite!"
anchored = TRUE
///Boolean on whether something is currently being washed, preventing multiple people from cleaning at once.
var/busy = FALSE
///The reagent that is dispensed from this source, by default it's water.
var/datum/reagent/dispensedreagent = /datum/reagent/water
/obj/structure/water_source/Initialize(mapload)
. = ..()
create_reagents(INFINITY, NO_REACT)
reagents.add_reagent(dispensedreagent, INFINITY)
/obj/structure/water_source/attack_hand(mob/living/user, list/modifiers)
. = ..()
if(.)
return
if(!iscarbon(user))
return
if(!Adjacent(user))
return
if(busy)
to_chat(user, span_warning("Someone's already washing here!"))
return
var/selected_area = user.parse_zone_with_bodypart(user.zone_selected)
var/washing_face = FALSE
if(selected_area in list(BODY_ZONE_HEAD, BODY_ZONE_PRECISE_MOUTH, BODY_ZONE_PRECISE_EYES))
washing_face = TRUE
user.visible_message(
span_notice("[user] starts washing [user.p_their()] [washing_face ? "face" : "hands"]..."),
span_notice("You start washing your [washing_face ? "face" : "hands"]..."))
busy = TRUE
if(!do_after(user, 4 SECONDS, target = src))
busy = FALSE
return
busy = FALSE
if(washing_face)
SEND_SIGNAL(user, COMSIG_COMPONENT_CLEAN_FACE_ACT, CLEAN_WASH)
else if(ishuman(user))
var/mob/living/carbon/human/human_user = user
if(!human_user.wash_hands(CLEAN_WASH))
to_chat(user, span_warning("Your hands are covered by something!"))
return
else
user.wash(CLEAN_WASH)
user.visible_message(
span_notice("[user] washes [user.p_their()] [washing_face ? "face" : "hands"] using [src]."),
span_notice("You wash your [washing_face ? "face" : "hands"] using [src]."),
)
/obj/structure/water_source/attackby(obj/item/attacking_item, mob/living/user, params)
if(busy)
to_chat(user, span_warning("Someone's already washing here!"))
return
if(attacking_item.item_flags & ABSTRACT) //Abstract items like grabs won't wash. No-drop items will though because it's still technically an item in your hand.
return
if(is_reagent_container(attacking_item))
var/obj/item/reagent_containers/container = attacking_item
if(container.is_refillable())
if(!container.reagents.holder_full())
container.reagents.add_reagent(dispensedreagent, min(container.volume - container.reagents.total_volume, container.amount_per_transfer_from_this))
to_chat(user, span_notice("You fill [container] from [src]."))
return TRUE
to_chat(user, span_notice("\The [container] is full."))
return FALSE
if(istype(attacking_item, /obj/item/melee/baton/security))
var/obj/item/melee/baton/security/baton = attacking_item
if(baton.cell?.charge && baton.active)
flick("baton_active", src)
user.Paralyze(baton.knockdown_time)
user.set_stutter(baton.knockdown_time)
baton.cell.use(baton.cell_hit_cost)
user.visible_message(
span_warning("[user] shocks [user.p_them()]self while attempting to wash the active [baton.name]!"),
span_userdanger("You unwisely attempt to wash [baton] while it's still on."))
playsound(src, baton.on_stun_sound, 50, TRUE)
return
if(istype(attacking_item, /obj/item/mop))
attacking_item.reagents.add_reagent(dispensedreagent, 5)
to_chat(user, span_notice("You wet [attacking_item] in [src]."))
playsound(loc, 'sound/effects/slosh.ogg', 25, TRUE)
return
if(istype(attacking_item, /obj/item/stack/medical/gauze))
var/obj/item/stack/medical/gauze/G = attacking_item
new /obj/item/reagent_containers/cup/rag(loc)
to_chat(user, span_notice("You tear off a strip of gauze and make a rag."))
G.use(1)
return
if(istype(attacking_item, /obj/item/stack/sheet/cloth))
var/obj/item/stack/sheet/cloth/cloth = attacking_item
new /obj/item/reagent_containers/cup/rag(loc)
to_chat(user, span_notice("You tear off a strip of cloth and make a rag."))
cloth.use(1)
return
if(istype(attacking_item, /obj/item/stack/ore/glass))
new /obj/item/stack/sheet/sandblock(loc)
to_chat(user, span_notice("You wet the sand and form it into a block."))
attacking_item.use(1)
return
if(!user.combat_mode)
to_chat(user, span_notice("You start washing [attacking_item]..."))
busy = TRUE
if(!do_after(user, 4 SECONDS, target = src))
busy = FALSE
return TRUE
busy = FALSE
attacking_item.wash(CLEAN_WASH)
reagents.expose(attacking_item, TOUCH, 5 / max(reagents.total_volume, 5))
user.visible_message(
span_notice("[user] washes [attacking_item] using [src]."),
span_notice("You wash [attacking_item] using [src]."))
return TRUE
return ..()
/obj/structure/water_source/puddle //splishy splashy ^_^
name = "puddle"
desc = "A puddle used for washing one's hands and face."
icon_state = "puddle"
base_icon_state = "puddle"
resistance_flags = UNACIDABLE
//ATTACK HAND IGNORING PARENT RETURN VALUE
/obj/structure/water_source/puddle/attack_hand(mob/user, list/modifiers)
icon_state = "[base_icon_state]-splash"
. = ..()
icon_state = base_icon_state
/obj/structure/water_source/puddle/attackby(obj/item/attacking_item, mob/user, params)
icon_state = "[base_icon_state]-splash"
. = ..()
icon_state = base_icon_state