Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds toggling shower's refills #55895

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 40 additions & 15 deletions code/game/objects/structures/shower.dm
Expand Up @@ -4,7 +4,7 @@
#define SHOWER_NORMAL_TEMP 300
#define SHOWER_BOILING "boiling"
#define SHOWER_BOILING_TEMP 400
#define SHOWER_REACTION_MULTIPLIER 0.05
#define SHOWER_REACTION_MULTIPLIER 0.025


/obj/machinery/shower
Expand All @@ -23,12 +23,18 @@
///What reagent should the shower be filled with when initially built.
var/reagent_id = /datum/reagent/water
///How much reagent capacity should the shower begin with when built.
var/reaction_volume = 200
var/reagent_capacity = 200
///How many units the shower refills every second.
var/refill_rate = 0.5
/// Whether or not the shower's water reclaimer is operating.
var/can_refill = TRUE
/// Whether to allow players to toggle the water reclaimer.
var/can_toggle_refill = TRUE

/obj/machinery/shower/Initialize()
. = ..()
create_reagents(reaction_volume)
reagents.add_reagent(reagent_id, reaction_volume)
create_reagents(reagent_capacity)
reagents.add_reagent(reagent_id, reagent_capacity)
soundloop = new(list(src), FALSE)
AddComponent(/datum/component/plumbing/simple_demand)

Expand Down Expand Up @@ -65,6 +71,17 @@
else
return ..()

/obj/machinery/shower/multitool_act(mob/living/user, obj/item/I)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be wrong, but aren't we moving towards using .tool_behaviour and TOOL_MULTITOOL? (Putting aside how it's weird you're using a multitool on a shower, you'd think it'd be just another option when using a wrench?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that we were moving in the other direction honestly. Also, the wrench is currently being used for adjusting the temperature of the shower. I don't want to stick an input or radial menu between people and their intended operation when they try to adjust the shower.

. = ..()
if(. || !can_toggle_refill)
return

can_refill = !can_refill
to_chat(user, "<span class=notice>You [can_refill ? "en" : "dis"]able the shower's water recycler.</span>")
playsound(src, 'sound/machines/click.ogg', 20, TRUE)
return TRUE


/obj/machinery/shower/wrench_act(mob/living/user, obj/item/I)
..()
to_chat(user, "<span class='notice'>You begin to adjust the temperature valve with \the [I]...</span>")
Expand Down Expand Up @@ -114,7 +131,7 @@

/obj/machinery/shower/Crossed(atom/movable/AM)
..()
if(on)
if(on && reagents.total_volume)
wash_atom(AM)

/obj/machinery/shower/proc/wash_atom(atom/A)
Expand All @@ -125,21 +142,23 @@
if(isliving(A))
check_heat(A)

/obj/machinery/shower/process()
if(on && reagents.total_volume >= 5)
reagents.remove_any(5)
/obj/machinery/shower/process(delta_time)
if(on && reagents.total_volume)
reagents.remove_any(2.5 * delta_time)
wash_atom(loc)
for(var/am in loc)
var/atom/movable/movable_content = am
reagents.expose(movable_content, TOUCH, SHOWER_REACTION_MULTIPLIER) //There's not many reagents leaving the sink at once! This should make for a 10 unit reaction
reagents.expose(movable_content, TOUCH, SHOWER_REACTION_MULTIPLIER * delta_time) //There's not many reagents leaving the sink at once! This should make for a 10 unit reaction
if(!ismopable(movable_content)) // Mopables will be cleaned anyways by the turf wash above
wash_atom(movable_content)
else
reagents.add_reagent(reagent_id, 1)
on = FALSE
soundloop.stop()
handle_mist()
update_icon()
return

on = FALSE
soundloop.stop()
handle_mist()
if(can_refill)
reagents.add_reagent(reagent_id, refill_rate * delta_time)
update_icon()
if(reagents.total_volume == reagents.maximum_volume)
return PROCESS_KILL

Expand Down Expand Up @@ -195,3 +214,9 @@
mouse_opacity = MOUSE_OPACITY_TRANSPARENT

#undef SHOWER_REACTION_MULTIPLIER
#undef SHOWER_BOILING_TEMP
#undef SHOWER_BOILING
#undef SHOWER_NORMAL_TEMP
#undef SHOWER_NORMAL
#undef SHOWER_FREEZING_TEMP
#undef SHOWER_FREEZING