diff --git a/code/modules/mod/modules/modules_maint.dm b/code/modules/mod/modules/modules_maint.dm index f59076fa4b5..d2f1ceaef74 100644 --- a/code/modules/mod/modules/modules_maint.dm +++ b/code/modules/mod/modules/modules_maint.dm @@ -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