mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-15 12:11:45 +00:00
3591 individual conflicts Update build.js Update install_node.sh Update byond.js oh my fucking god hat slow huh holy shit we all fall down 2 more I missed 2900 individual conflicts 2700 Individual conflicts replaces yarn file with tg version, bumping us down to 2200-ish Down to 2000 individual conflicts 140 down mmm aaaaaaaaaaaaaaaaaaa not yt 575 soon 900 individual conflicts 600 individual conflicts, 121 file conflicts im not okay 160 across 19 files 29 in 4 files 0 conflicts, compiletime fix time some minor incap stuff missed ticks weird dupe definition stuff missed ticks 2 incap fixes undefs and pie fix Radio update and some extra minor stuff returns a single override no more dupe definitions, 175 compiletime errors Unticked file fix sound and emote stuff honk and more radio stuff
231 lines
8.1 KiB
Plaintext
231 lines
8.1 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)
|
|
update_appearance()
|
|
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()
|
|
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()
|
|
|
|
/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/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)
|
|
connected_pump.update_appearance()
|
|
|
|
/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()
|
|
|
|
/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())
|