From 4b1ef08141ff79982ad8aacaeef261c1f54bdff1 Mon Sep 17 00:00:00 2001
From: naut <55491249+nauticall@users.noreply.github.com>
Date: Wed, 2 Aug 2023 01:44:08 +0800
Subject: [PATCH] Makes IV tank valves automatically open when strapping masks
(#16914)
* Automatically opens valves for IV masks
* tank check
* log of change
* sound removal
---
code/game/machinery/iv_drip.dm | 39 ++++++++++++--------
html/changelogs/nauticall-autovalveopen.yml | 41 +++++++++++++++++++++
2 files changed, 64 insertions(+), 16 deletions(-)
create mode 100644 html/changelogs/nauticall-autovalveopen.yml
diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm
index 2fc065ec601..1e062969aa7 100644
--- a/code/game/machinery/iv_drip.dm
+++ b/code/game/machinery/iv_drip.dm
@@ -216,7 +216,7 @@
if(!tank_active) // Activates and sets the kPa to a safe pressure. This keeps from it constantly resetting itself
tank.distribute_pressure = safe_pressure_min
- src.visible_message(SPAN_NOTICE("\The [src] chimes and adjusts \the [tank]'s release pressure"))
+ src.visible_message(SPAN_NOTICE("\The [src] chimes and adjusts \the [tank]'s release pressure."))
playsound(src, 'sound/machines/chime.ogg', 50)
tank_active = TRUE
if(L.checking_rupture == FALSE) // Safely retracts in case the lungs are about to rupture
@@ -355,6 +355,8 @@
to_chat(usr, SPAN_WARNING("You must remove \the [breather]'s [breather.wear_mask] first!"))
breather = null
return
+ if(tank)
+ tank_on()
visible_message("[usr] secures the mask over \the [breather]'s face.")
playsound(breather, 'sound/effects/buckle.ogg', 50)
breath_mask.forceMove(breather.loc)
@@ -593,6 +595,16 @@
breather = null
update_icon()
+/obj/machinery/iv_drip/proc/tank_on()
+ playsound(src, 'sound/effects/internals.ogg', 100)
+ tank.forceMove(breather)
+ breather.internal = tank
+ if(breather.internals)
+ breather.internals.icon_state = "internal1"
+ valve_open = TRUE
+ update_icon()
+ return
+
/obj/machinery/iv_drip/proc/tank_off()
tank.forceMove(src)
if(breather.internals)
@@ -642,22 +654,17 @@
if(!valve_open)
usr.visible_message("[usr] opens \the [tank]'s valve.", SPAN_NOTICE("You open \the [tank]'s valve."))
- playsound(src, 'sound/effects/internals.ogg', 100)
- tank.forceMove(breather)
- breather.internal = tank
- if(breather.internals)
- breather.internals.icon_state = "internal1"
- valve_open = TRUE
- update_icon()
+ tank_on()
+ return
+ if(valve_open)
+ if(epp_active)
+ var/response = alert(usr, "Are you sure you want to close \the [tank]'s valve? The Emergency Positive Pressure system is currently active!", "Toggle Valve", "Yes", "No")
+ if(response == "No")
+ return
+ epp_active = FALSE
+ usr.visible_message("[usr] closes \the [tank]'s valve.", SPAN_NOTICE("You close \the [tank]'s valve."))
+ tank_off()
return
- if(epp_active)
- var/response = alert(usr, "Are you sure you want to close \the [tank]'s valve? The Emergency Positive Pressure system is currently active!", "Toggle Valve", "Yes", "No")
- if(response == "No")
- return
- epp_active = FALSE
- usr.visible_message("[usr] closes \the [tank]'s valve.", SPAN_NOTICE("You close \the [tank]'s valve."))
- playsound(src, 'sound/effects/internals.ogg', 100)
- tank_off()
/obj/machinery/iv_drip/verb/toggle_epp()
set category = "Object"
diff --git a/html/changelogs/nauticall-autovalveopen.yml b/html/changelogs/nauticall-autovalveopen.yml
new file mode 100644
index 00000000000..a13168c0e4b
--- /dev/null
+++ b/html/changelogs/nauticall-autovalveopen.yml
@@ -0,0 +1,41 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+# balance
+# admin
+# backend
+# security
+# refactor
+#################################
+
+# Your name.
+author: nauticall
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - tweak: "When putting a breath mask on someone via the IV drip with an oxygen mask attached, the valve now opens automatically."