Files
Bubberstation/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
SimplyLogan d4fcf29709 Engineering & Atmos rework for Catwalk map [C.A.T] (#92830)
## About The Pull Request

**Ready for review, images below were WIP images, for final comparison
please see map diff bot or video**

https://youtu.be/rk-87JqzLe4


<img width="1616" height="1168" alt="image"
src="https://github.com/user-attachments/assets/5e564dfc-0f0f-48b1-ba25-47f10bc34666"
/>
<img width="1466" height="1166" alt="image"
src="https://github.com/user-attachments/assets/fce0b644-ed34-4ea3-ac67-3ce7c861f359"
/>
<img width="1011" height="904" alt="image"
src="https://github.com/user-attachments/assets/8ac9dbf2-bad4-42c6-a5fe-6550074e9abf"
/>
<img width="1501" height="1175" alt="image"
src="https://github.com/user-attachments/assets/23503a1d-d4c4-42be-95d3-f2988bb73c8a"
/>
<img width="1538" height="1219" alt="image"
src="https://github.com/user-attachments/assets/07e13e32-3b34-48e1-8862-17ec7c9bcd70"
/>
<img width="1417" height="942" alt="image"
src="https://github.com/user-attachments/assets/765af815-cda4-4485-a925-cb04591cdf29"
/>
<img width="1469" height="1236" alt="image"
src="https://github.com/user-attachments/assets/881e69dc-ef49-4fcd-a811-d1d604650fde"
/>
## Why It's Good For The Game

- Catwalk engineering & atmos has often been the weakest part of the
map, this overhaul helps solve some of the biggest gripes players have
with it.
- Should help with player population not dropping like a stone when it
rolls
## Changelog
🆑
map: Catwalk - Atmos and Engineering split, new access hallway, new
stairs to AI sat, HFR re-located, space for passion projects, new
lighting, So many changes to document. [C.A.T]
/🆑
2025-09-12 01:28:06 +00:00

233 lines
8.2 KiB
Plaintext

// Every cycle, the pump uses the air in air_in to try and make air_out the perfect pressure.
//
// node1, air1, network1 correspond to input
// node2, air2, network2 correspond to output
//
// Thus, the two variables affect pump operation are set in New():
// air1.volume
// This is the volume of gas available to the pump that may be transferred to the output
// air2.volume
// Higher quantities of this cause more air to be perfected later
// but overall network volume is also increased as this increases...
/obj/machinery/atmospherics/components/binary/pump
icon_state = "pump_map-3"
name = "gas pump"
desc = "A pump that moves gas by pressure."
can_unwrench = TRUE
shift_underlay_only = FALSE
construction_type = /obj/item/pipe/directional
pipe_state = "pump"
vent_movement = NONE
///Pressure that the pump will reach when on
var/target_pressure = ONE_ATMOSPHERE
/obj/machinery/atmospherics/components/binary/pump/Initialize(mapload)
. = ..()
AddComponent(/datum/component/usb_port, list(
/obj/item/circuit_component/atmos_pump,
))
register_context()
/obj/machinery/atmospherics/components/binary/pump/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
context[SCREENTIP_CONTEXT_CTRL_LMB] = "Turn [on ? "off" : "on"]"
context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize target pressure"
return CONTEXTUAL_SCREENTIP_SET
/obj/machinery/atmospherics/components/binary/pump/click_ctrl(mob/user)
if(is_operational)
set_on(!on)
balloon_alert(user, "turned [on ? "on" : "off"]")
investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
return CLICK_ACTION_SUCCESS
return CLICK_ACTION_BLOCKING
/obj/machinery/atmospherics/components/binary/pump/click_alt(mob/user)
if(target_pressure == MAX_OUTPUT_PRESSURE)
return CLICK_ACTION_BLOCKING
target_pressure = MAX_OUTPUT_PRESSURE
investigate_log("was set to [target_pressure] kPa by [key_name(user)]", INVESTIGATE_ATMOS)
balloon_alert(user, "pressure output set to [target_pressure] kPa")
update_appearance(UPDATE_ICON)
return CLICK_ACTION_SUCCESS
/obj/machinery/atmospherics/components/binary/pump/update_icon_nopipes()
icon_state = (on && is_operational) ? "pump_on-[set_overlay_offset(piping_layer)]" : "pump_off-[set_overlay_offset(piping_layer)]"
/obj/machinery/atmospherics/components/binary/pump/process_atmos()
if(!on || !is_operational)
return
var/datum/gas_mixture/input_air = airs[1]
var/datum/gas_mixture/output_air = airs[2]
var/datum/gas_mixture/output_pipenet_air = parents[2].air
if(input_air.pump_gas_to(output_air, target_pressure, output_pipenet_air = output_pipenet_air))
update_parents()
/obj/machinery/atmospherics/components/binary/pump/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AtmosPump", name)
ui.open()
/obj/machinery/atmospherics/components/binary/pump/ui_data()
var/data = list()
data["on"] = on
data["pressure"] = round(target_pressure)
data["max_pressure"] = round(MAX_OUTPUT_PRESSURE)
return data
/obj/machinery/atmospherics/components/binary/pump/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("power")
set_on(!on)
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
. = TRUE
if("pressure")
var/pressure = params["pressure"]
if(pressure == "max")
pressure = MAX_OUTPUT_PRESSURE
. = TRUE
else if(text2num(pressure) != null)
pressure = text2num(pressure)
. = TRUE
if(.)
target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS)
update_appearance(UPDATE_ICON)
/obj/machinery/atmospherics/components/binary/pump/can_unwrench(mob/user)
. = ..()
if(. && on && is_operational)
to_chat(user, span_warning("You cannot unwrench [src], turn it off first!"))
return FALSE
/obj/machinery/atmospherics/components/binary/pump/layer2
piping_layer = 2
icon_state= "pump_map-2"
/obj/machinery/atmospherics/components/binary/pump/layer4
piping_layer = 4
icon_state= "pump_map-4"
/obj/machinery/atmospherics/components/binary/pump/on
on = TRUE
icon_state = "pump_on_map-3"
/obj/machinery/atmospherics/components/binary/pump/on/layer2
piping_layer = 2
icon_state= "pump_on_map-2"
/obj/machinery/atmospherics/components/binary/pump/on/layer4
piping_layer = 4
icon_state= "pump_on_map-4"
/obj/machinery/atmospherics/components/binary/pump/on/layer5
piping_layer = 5
icon_state = "pump_on_map-5"
/obj/item/circuit_component/atmos_pump
display_name = "Atmospheric Binary Pump"
desc = "The interface for communicating with a pump."
///Set the target pressure of the pump
var/datum/port/input/pressure_value
///Activate the pump
var/datum/port/input/on
///Deactivate the pump
var/datum/port/input/off
///Signals the circuit to retrieve the pump's current pressure and temperature
var/datum/port/input/request_data
///Pressure of the input port
var/datum/port/output/input_pressure
///Pressure of the output port
var/datum/port/output/output_pressure
///Temperature of the input port
var/datum/port/output/input_temperature
///Temperature of the output port
var/datum/port/output/output_temperature
///Whether the pump is currently active
var/datum/port/output/is_active
///Send a signal when the pump is turned on
var/datum/port/output/turned_on
///Send a signal when the pump is turned off
var/datum/port/output/turned_off
///The component parent object
var/obj/machinery/atmospherics/components/binary/pump/connected_pump
/obj/item/circuit_component/atmos_pump/populate_ports()
pressure_value = add_input_port("New Pressure", PORT_TYPE_NUMBER, trigger = PROC_REF(set_pump_pressure))
on = add_input_port("Turn On", PORT_TYPE_SIGNAL, trigger = PROC_REF(set_pump_on))
off = add_input_port("Turn Off", PORT_TYPE_SIGNAL, trigger = PROC_REF(set_pump_off))
request_data = add_input_port("Request Port Data", PORT_TYPE_SIGNAL, trigger = PROC_REF(request_pump_data))
input_pressure = add_output_port("Input Pressure", PORT_TYPE_NUMBER)
output_pressure = add_output_port("Output Pressure", PORT_TYPE_NUMBER)
input_temperature = add_output_port("Input Temperature", PORT_TYPE_NUMBER)
output_temperature = add_output_port("Output Temperature", PORT_TYPE_NUMBER)
is_active = add_output_port("Active", PORT_TYPE_NUMBER)
turned_on = add_output_port("Turned On", PORT_TYPE_SIGNAL)
turned_off = add_output_port("Turned Off", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/atmos_pump/register_usb_parent(atom/movable/shell)
. = ..()
if(istype(shell, /obj/machinery/atmospherics/components/binary/pump))
connected_pump = shell
RegisterSignal(connected_pump, COMSIG_ATMOS_MACHINE_SET_ON, PROC_REF(handle_pump_activation))
/obj/item/circuit_component/atmos_pump/unregister_usb_parent(atom/movable/shell)
UnregisterSignal(connected_pump, COMSIG_ATMOS_MACHINE_SET_ON)
connected_pump = null
return ..()
/obj/item/circuit_component/atmos_pump/pre_input_received(datum/port/input/port)
pressure_value.set_value(clamp(pressure_value.value, 0, MAX_OUTPUT_PRESSURE))
/obj/item/circuit_component/atmos_pump/proc/handle_pump_activation(datum/source, active)
SIGNAL_HANDLER
is_active.set_output(active)
if(active)
turned_on.set_output(COMPONENT_SIGNAL)
else
turned_off.set_output(COMPONENT_SIGNAL)
/obj/item/circuit_component/atmos_pump/proc/set_pump_pressure()
CIRCUIT_TRIGGER
if(!connected_pump)
return
connected_pump.target_pressure = pressure_value.value
/obj/item/circuit_component/atmos_pump/proc/set_pump_on()
CIRCUIT_TRIGGER
if(!connected_pump)
return
connected_pump.set_on(TRUE)
/obj/item/circuit_component/atmos_pump/proc/set_pump_off()
CIRCUIT_TRIGGER
if(!connected_pump)
return
connected_pump.set_on(FALSE)
connected_pump.update_appearance(UPDATE_ICON)
/obj/item/circuit_component/atmos_pump/proc/request_pump_data()
CIRCUIT_TRIGGER
if(!connected_pump)
return
var/datum/gas_mixture/air_input = connected_pump.airs[1]
var/datum/gas_mixture/air_output = connected_pump.airs[2]
input_pressure.set_output(air_input.return_pressure())
output_pressure.set_output(air_output.return_pressure())
input_temperature.set_output(air_input.return_temperature())
output_temperature.set_output(air_output.return_temperature())