From 8c675c70e26b7eaa34fc15910b569f3dc7434fa4 Mon Sep 17 00:00:00 2001 From: mystery3525 <30960302+mystery3525@users.noreply.github.com> Date: Sat, 21 Oct 2023 04:12:07 -0400 Subject: [PATCH] Closed valves and pumps and vents now block ventcrawling and other tweaks (#9257) * rahhh * hearing dependent * no ignored_mobs * Added vent pump and scrubbers as per forums ideasguy * Requested changes and code copy-paste cleanup * reduce diffs * changes * changes --- .../atmospherics/machinery/atmosmachinery.dm | 13 ++++++++++++- .../components/binary_devices/dp_vent_pump.dm | 2 +- .../machinery/components/binary_devices/pump.dm | 3 +++ .../machinery/components/binary_devices/valve.dm | 3 +++ .../components/binary_devices/volume_pump.dm | 4 ++++ .../machinery/components/unary_devices/cryo.dm | 2 +- .../components/unary_devices/passive_vent.dm | 2 +- .../machinery/components/unary_devices/vent_pump.dm | 6 +++++- .../components/unary_devices/vent_scrubber.dm | 2 +- 9 files changed, 31 insertions(+), 6 deletions(-) diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 2a7638cd6222a..c181e80cfa435 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -316,6 +316,8 @@ if(world.time - user.last_played_vent > VENT_SOUND_DELAY) user.last_played_vent = world.time playsound(src, 'sound/machines/ventcrawl.ogg', 50, 1, -3) + if(prob(1)) + audible_message("You hear something crawling through the ducts...") else if(is_type_in_typecache(src, GLOB.ventcrawl_machinery) && can_crawl_through()) //if we move in a way the pipe can connect, but doesn't - or we're in a vent user.forceMove(loc) user.visible_message("You hear something squeezing through the ducts...", "You climb out the ventilation system.") @@ -328,8 +330,17 @@ L.handle_ventcrawl(src) return - +/// Whether ventcrawling creatures can move in or out of this machine. /obj/machinery/atmospherics/proc/can_crawl_through() + // If it's broken, nothing can pass through + if(machine_stat & BROKEN) + return FALSE + + // If it is powered on, but off, nothing can pass through + if(powered() && !on) + return FALSE + + // All else, things can pass return TRUE /obj/machinery/atmospherics/proc/returnPipenets() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm index 144e47293cd2a..c0b2039e93a19 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm @@ -202,7 +202,7 @@ . += "It seems welded shut." /obj/machinery/atmospherics/components/binary/dp_vent_pump/can_crawl_through() - return !welded + return (machine_stat & ~BROKEN) && !welded /obj/machinery/atmospherics/components/binary/dp_vent_pump/attack_alien(mob/user) if(!welded || !(do_after(user, 20, target = src))) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index a4152557933bd..668e74176e53a 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -177,6 +177,9 @@ to_chat(user, "You cannot unwrench [src], turn it off first!") return FALSE +/obj/machinery/atmospherics/components/binary/pump/can_crawl_through() + . = ..() + return . && on // If a pump is off, it'll block even when not powered /obj/machinery/atmospherics/components/binary/pump/layer2 piping_layer = 2 diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm index fd6d447f8c2fe..42208eb874e43 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm @@ -40,6 +40,9 @@ It's like a regular ol' straight pipe, but you can turn it on and off. flick("[valve_type]valve_[on][!on]-[set_overlay_offset(piping_layer)]", src) icon_state = "[valve_type]valve_[on ? "on" : "off"]-[set_overlay_offset(piping_layer)]" +/obj/machinery/atmospherics/components/binary/valve/can_crawl_through() + return (machine_stat & ~BROKEN) && on // valves should block whatever is trying to go through them, regardless of power + /** * Called by finish_interact(), switch between open and closed, reconcile the air between two pipelines */ diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 7d3772ef33e62..32b895423e356 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -194,6 +194,10 @@ to_chat(user, "The pump quiets down as you turn its limiters back on.") return TRUE +/obj/machinery/atmospherics/components/binary/volume_pump/can_crawl_through() + . = ..() + return . && on // If a pump is off, it'll block even when not powered + // mapping /obj/machinery/atmospherics/components/binary/volume_pump/layer2 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index b0b41bc67b8b9..13a0f189ff778 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -455,7 +455,7 @@ user.overlay_fullscreen("remote_view", /atom/movable/screen/fullscreen/impaired, 1) /obj/machinery/atmospherics/components/unary/cryo_cell/can_crawl_through() - return // can't ventcrawl in or out of cryo. + return FALSE // can't ventcrawl in or out of cryo. /obj/machinery/atmospherics/components/unary/cryo_cell/can_see_pipes() return 0 // you can't see the pipe network when inside a cryo cell. diff --git a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm index adfe8079bab1e..1fa5221e38eac 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm @@ -42,7 +42,7 @@ update_parents() /obj/machinery/atmospherics/components/unary/passive_vent/can_crawl_through() - return TRUE + return TRUE // we don't care about power or being broken /obj/machinery/atmospherics/components/unary/passive_vent/layer2 piping_layer = 2 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm index 2ca277711ec29..72d009d88b2bb 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -280,12 +280,16 @@ if(welded) . += "It seems welded shut." +/obj/machinery/atmospherics/components/unary/vent_pump/can_crawl_through() + return (machine_stat & ~BROKEN) && !welded + /obj/machinery/atmospherics/components/unary/vent_pump/power_change() . = ..() update_icon_nopipes() /obj/machinery/atmospherics/components/unary/vent_pump/can_crawl_through() - return !welded + . = ..() + return . && !welded /obj/machinery/atmospherics/components/unary/vent_pump/attack_alien(mob/user) if(!welded || !(do_after(user, 20, target = src))) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index 3d52054cab9c0..0a25bb3478e48 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -256,7 +256,7 @@ . += "It seems welded shut." /obj/machinery/atmospherics/components/unary/vent_scrubber/can_crawl_through() - return !welded + return (machine_stat & ~BROKEN) && !welded /obj/machinery/atmospherics/components/unary/vent_scrubber/attack_alien(mob/user) if(!welded || !(do_after(user, 20, target = src)))