Fixes oversight of the Springlock MOD module and its interaction with water vapor (#87169)

## About The Pull Request
Adds the interaction between the Springlock MOD module and the Gas Water
Vapor so that it snaps shut upon being exposed to the Gas.
Fixes #85666.
Specifically the oversight mentioned in the comments.
## Why It's Good For The Game
Adds consistency to the Springlock MOD module so it properly interacts
with water as intended.
## Changelog
🆑
fix: Springlock MOD module properly interacts with Water Vapor
/🆑
This commit is contained in:
Soupy
2024-10-15 20:02:06 +02:00
committed by GitHub
parent 3d9f4be03f
commit 151449ed99
+27 -6
View File
@@ -11,6 +11,9 @@
complexity = 3 // it is inside every part of your suit, so
incompatible_modules = list(/obj/item/mod/module/springlock)
var/set_off = FALSE
var/static/list/gas_connections = list(
COMSIG_TURF_EXPOSE = PROC_REF(on_wearer_exposed_gas),
)
/obj/item/mod/module/springlock/on_install()
mod.activation_step_time *= 0.5
@@ -20,22 +23,40 @@
/obj/item/mod/module/springlock/on_suit_activation()
RegisterSignal(mod.wearer, COMSIG_ATOM_EXPOSE_REAGENTS, PROC_REF(on_wearer_exposed))
AddComponent(/datum/component/connect_loc_behalf, mod.wearer, gas_connections)
/obj/item/mod/module/springlock/on_suit_deactivation(deleting = FALSE)
UnregisterSignal(mod.wearer, COMSIG_ATOM_EXPOSE_REAGENTS)
qdel(GetComponent(/datum/component/connect_loc_behalf))
///Signal fired when wearer is exposed to reagents
/obj/item/mod/module/springlock/proc/on_wearer_exposed(atom/source, list/reagents, datum/reagents/source_reagents, methods, volume_modifier, show_message)
SIGNAL_HANDLER
if(!(methods & (VAPOR|PATCH|TOUCH)) || set_off || mod.wearer.stat == DEAD)
return //remove non-touch reagent exposure
///Registers the signal COMSIG_MOD_ACTIVATE and calls the proc snap_shut() after a timer
/obj/item/mod/module/springlock/proc/snap_signal()
if(set_off || mod.wearer.stat == DEAD)
return
to_chat(mod.wearer, span_danger("[src] makes an ominous click sound..."))
playsound(src, 'sound/items/modsuit/springlock.ogg', 75, TRUE)
addtimer(CALLBACK(src, PROC_REF(snap_shut)), rand(3 SECONDS, 5 SECONDS))
RegisterSignal(mod, COMSIG_MOD_ACTIVATE, PROC_REF(on_activate_spring_block))
set_off = TRUE
///Calls snap_signal() when exposed to a reagent via VAPOR, PATCH or TOUCH
/obj/item/mod/module/springlock/proc/on_wearer_exposed(atom/source, list/reagents, datum/reagents/source_reagents, methods, volume_modifier, show_message)
SIGNAL_HANDLER
if(!(methods & (VAPOR|PATCH|TOUCH)))
return //remove non-touch reagent exposure
snap_signal()
///Calls snap_signal() when exposed to water vapor
/obj/item/mod/module/springlock/proc/on_wearer_exposed_gas()
SIGNAL_HANDLER
var/turf/wearer_turf = get_turf(src)
var/datum/gas_mixture/air = wearer_turf.return_air()
if(!(air.gases[/datum/gas/water_vapor] && (air.gases[/datum/gas/water_vapor][MOLES]) >= 5))
return //return if there aren't more than 5 Moles of Water Vapor in the air
snap_signal()
///Signal fired when wearer attempts to activate/deactivate suits
/obj/item/mod/module/springlock/proc/on_activate_spring_block(datum/source, user)
SIGNAL_HANDLER