Skip to content

Commit

Permalink
Compact Airlock Pump (tgstation#84365)
Browse files Browse the repository at this point in the history
## About The Pull Request

Adds a craftable airlock pump that is an atmos device with distro &
waste nodes on a single side.

When wrenched down, looks for airlocks and sets up a cycling airlock
chamber.

A more compact and flexible alternative to the current binary DP Vent
Pumps.


https://github.com/tgstation/tgstation/assets/3625094/a799b3e8-3425-43fc-9c17-2bdde63ec194

Can also skip cycling when a shuttle is docked with one of the external
airlocks:


https://github.com/tgstation/tgstation/assets/3625094/37054bc0-b8c5-4556-aa2c-0fa5bc3c7c5b

**Set up from scratch**: https://youtu.be/22PDfmJKC7g

## Why It's Good For The Game

Provides an easy to map and setup alternative to DP Vents that doesn't
require any map helpers, var editing and can even be crafted in the
game.


![image](https://github.com/tgstation/tgstation/assets/3625094/6925dc0a-882a-48da-8387-e6a50cb4c514)

You just need to extend the disto/waste pipes to the place where you
want your airlock to be.

When built, it automatically considers the first found airlock in the
direction of incoming pipes as an internal one, and the opposite -
external.

Cycling is controlled by the airlocks. When you click/bump an internal
airlock, it starts pressurizing. When external one - depressurizing.

When unable to complete the cycle in 10 seconds, unbolts the door
automatically to avoid stucking due to issues with pipes or slow atmos.

TODO:
- [x] Hook up to the power and figure out the logic when unpowered
- [x] ~Make it work with a directly connected layer manifold~
- [x] Make unwrenching require unpowered state and forbid mapspawn pump
unwrenching
- [x] Support airlock arrays and double airlocks
- [x] An option to open airlocks instead of just bolts
- [x] Check for the presence of airlocks and crash if not set up
properly on map

## Changelog

:cl:
add: Added airlock pump atmos device to create cycling airlocks
/:cl:

---------

Co-authored-by: Ghom <[email protected]>
  • Loading branch information
MTandi and Ghommie authored Jul 13, 2024
1 parent 15bb0d5 commit 5ce9482
Show file tree
Hide file tree
Showing 12 changed files with 1,735 additions and 1,243 deletions.
2,465 changes: 1,223 additions & 1,242 deletions _maps/map_files/debug/runtimestation.dmm

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions code/__DEFINES/atmospherics/atmos_piping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
#define PIPING_ALL_COLORS (1<<4)
/// can bridge over pipenets
#define PIPING_BRIDGE (1<<5)
/// intended to connect with layers 2 and 4 only
#define PIPING_DISTRO_AND_WASTE_LAYERS (1<<6)

// Ventcrawling bitflags, handled in var/vent_movement
///Allows for ventcrawling to occur. All atmospheric machines have this flag on by default. Cryo is the exception
Expand Down
23 changes: 23 additions & 0 deletions code/datums/components/crafting/atmospheric.dm
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,26 @@
/obj/item/stack/sheet/iron = 30,
)
category = CAT_STRUCTURE

/datum/crafting_recipe/airlock_pump
name = "External Airlock Pump"
tool_behaviors = list(TOOL_WRENCH, TOOL_WELDER)
result = /obj/item/pipe/directional/airlock_pump
reqs = list(
/obj/item/pipe = 1,
/obj/item/stack/sheet/iron = 5,
/obj/item/stack/cable_coil = 5,
/obj/item/analyzer = 1,
)
time = 2 SECONDS
category = CAT_ATMOSPHERIC

/datum/crafting_recipe/airlock_pump/check_requirements(mob/user, list/collected_requirements)
return atmos_pipe_check(user, collected_requirements)

/datum/crafting_recipe/airlock_pump/on_craft_completion(mob/user, atom/result)
var/obj/item/pipe/crafted_pipe = result
crafted_pipe.pipe_type = /obj/machinery/atmospherics/components/unary/airlock_pump
crafted_pipe.pipe_color = COLOR_VERY_LIGHT_GRAY
crafted_pipe.setDir(user.dir)
crafted_pipe.update()
18 changes: 18 additions & 0 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
/// Used for papers and photos pinned to the airlock
var/note_overlay_file = 'icons/obj/doors/airlocks/station/overlays.dmi'

/// Airlock pump that overrides airlock controlls when set up for cycling
var/obj/machinery/atmospherics/components/unary/airlock_pump/cycle_pump

var/cyclelinkeddir = 0
var/obj/machinery/door/airlock/cyclelinkedairlock
var/shuttledocked = 0
Expand Down Expand Up @@ -1222,6 +1225,10 @@
INVOKE_ASYNC(src, density ? PROC_REF(open) : PROC_REF(close), BYPASS_DOOR_CHECKS)

/obj/machinery/door/airlock/open(forced = DEFAULT_DOOR_CHECKS)
if(cycle_pump && !operating && !welded && !seal && locked && density)
cycle_pump.airlock_act(src)
return FALSE // The rest will be handled by the pump

if( operating || welded || locked || seal )
return FALSE

Expand Down Expand Up @@ -1822,6 +1829,17 @@
/obj/structure/fluff/airlock_filler/singularity_pull(S, current_size)
return

/obj/machinery/door/airlock/proc/set_cycle_pump(obj/machinery/atmospherics/components/unary/airlock_pump/pump)
RegisterSignal(pump, COMSIG_QDELETING, PROC_REF(unset_cycle_pump))
cycle_pump = pump

/obj/machinery/door/airlock/proc/unset_cycle_pump()
SIGNAL_HANDLER
if(locked)
unbolt()
say("Link broken, unbolting.")
cycle_pump = null

// Station Airlocks Regular

/obj/machinery/door/airlock/command
Expand Down
3 changes: 3 additions & 0 deletions code/game/machinery/pipe/construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ Buildable meters
/obj/item/pipe/directional/he_exchanger
icon_state_preview = "heunary"
pipe_type = /obj/machinery/atmospherics/components/unary/heat_exchanger
/obj/item/pipe/directional/airlock_pump
icon_state_preview = "airlock_pump"
pipe_type = /obj/machinery/atmospherics/components/unary/airlock_pump
/obj/item/pipe/binary
RPD_type = PIPE_STRAIGHT
/obj/item/pipe/binary/layer_adapter
Expand Down
5 changes: 4 additions & 1 deletion code/modules/atmospherics/machinery/atmosmachinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@
return FALSE

//if the target is not in the same piping layer & it does not have the all layer connection flag[which allows it to be connected regardless of layer] then we are out
if(target.piping_layer != given_layer && !(target.pipe_flags & PIPING_ALL_LAYER))
if(target.pipe_flags & PIPING_DISTRO_AND_WASTE_LAYERS)
if(ISODD(given_layer))
return FALSE
else if(target.piping_layer != given_layer && !(target.pipe_flags & PIPING_ALL_LAYER))
return FALSE

//if the target does not have the same color and it does not have all color connection flag[which allows it to be connected regardless of color] & one of the pipes is not gray[allowing for connection regardless] then we are out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@

if(!showpipe)
return ..()
if(pipe_flags & PIPING_DISTRO_AND_WASTE_LAYERS)
return ..()

var/connected = 0 //Direction bitset

Expand Down
Loading

0 comments on commit 5ce9482

Please sign in to comment.