This commit is contained in:
Putnam
2020-01-17 21:33:13 -08:00
1321 changed files with 199799 additions and 200267 deletions
@@ -1,31 +1,31 @@
/obj/machinery/atmospherics/components/binary
icon = 'icons/obj/atmospherics/components/binary_devices.dmi'
dir = SOUTH
initialize_directions = SOUTH|NORTH
use_power = IDLE_POWER_USE
device_type = BINARY
layer = GAS_PUMP_LAYER
/obj/machinery/atmospherics/components/binary/SetInitDirections()
switch(dir)
if(NORTH)
initialize_directions = NORTH|SOUTH
if(SOUTH)
initialize_directions = NORTH|SOUTH
if(EAST)
initialize_directions = EAST|WEST
if(WEST)
initialize_directions = EAST|WEST
/*
Iconnery
*/
/obj/machinery/atmospherics/components/binary/hide(intact)
update_icon()
..(intact)
/*
Housekeeping and pipe network stuff
*/
/obj/machinery/atmospherics/components/binary/getNodeConnects()
return list(turn(dir, 180), dir)
/obj/machinery/atmospherics/components/binary
icon = 'icons/obj/atmospherics/components/binary_devices.dmi'
dir = SOUTH
initialize_directions = SOUTH|NORTH
use_power = IDLE_POWER_USE
device_type = BINARY
layer = GAS_PUMP_LAYER
/obj/machinery/atmospherics/components/binary/SetInitDirections()
switch(dir)
if(NORTH)
initialize_directions = NORTH|SOUTH
if(SOUTH)
initialize_directions = NORTH|SOUTH
if(EAST)
initialize_directions = EAST|WEST
if(WEST)
initialize_directions = EAST|WEST
/*
Iconnery
*/
/obj/machinery/atmospherics/components/binary/hide(intact)
update_icon()
..(intact)
/*
Housekeeping and pipe network stuff
*/
/obj/machinery/atmospherics/components/binary/getNodeConnects()
return list(turn(dir, 180), dir)
@@ -1,190 +1,190 @@
//node2, air2, network2 correspond to input
//node1, air1, network1 correspond to output
#define CIRCULATOR_HOT 0
#define CIRCULATOR_COLD 1
/obj/machinery/atmospherics/components/binary/circulator
name = "circulator/heat exchanger"
desc = "A gas circulator pump and heat exchanger."
icon_state = "circ-off-0"
var/active = FALSE
var/last_pressure_delta = 0
pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
density = TRUE
var/flipped = 0
var/mode = CIRCULATOR_HOT
var/obj/machinery/power/generator/generator
//default cold circ for mappers
/obj/machinery/atmospherics/components/binary/circulator/cold
mode = CIRCULATOR_COLD
/obj/machinery/atmospherics/components/binary/circulator/Initialize(mapload)
.=..()
component_parts = list(new /obj/item/circuitboard/machine/circulator)
/obj/machinery/atmospherics/components/binary/circulator/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
/obj/machinery/atmospherics/components/binary/circulator/Destroy()
if(generator)
disconnectFromGenerator()
return ..()
/obj/machinery/atmospherics/components/binary/circulator/proc/return_transfer_air()
var/datum/gas_mixture/air1 = airs[1]
var/datum/gas_mixture/air2 = airs[2]
var/output_starting_pressure = air1.return_pressure()
var/input_starting_pressure = air2.return_pressure()
if(output_starting_pressure >= input_starting_pressure-10)
//Need at least 10 KPa difference to overcome friction in the mechanism
last_pressure_delta = 0
return null
//Calculate necessary moles to transfer using PV = nRT
if(air2.temperature>0)
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2
var/transfer_moles = pressure_delta*air1.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
last_pressure_delta = pressure_delta
//Actually transfer the gas
var/datum/gas_mixture/removed = air2.remove(transfer_moles)
update_parents()
return removed
else
last_pressure_delta = 0
/obj/machinery/atmospherics/components/binary/circulator/process_atmos()
..()
update_icon()
/obj/machinery/atmospherics/components/binary/circulator/update_icon()
if(!is_operational())
icon_state = "circ-p-[flipped]"
else if(last_pressure_delta > 0)
if(last_pressure_delta > ONE_ATMOSPHERE)
icon_state = "circ-run-[flipped]"
else
icon_state = "circ-slow-[flipped]"
else
icon_state = "circ-off-[flipped]"
/obj/machinery/atmospherics/components/binary/circulator/wrench_act(mob/living/user, obj/item/I)
if(!panel_open)
return
anchored = !anchored
I.play_tool_sound(src)
if(generator)
disconnectFromGenerator()
to_chat(user, "<span class='notice'>You [anchored?"secure":"unsecure"] [src].</span>")
var/obj/machinery/atmospherics/node1 = nodes[1]
var/obj/machinery/atmospherics/node2 = nodes[2]
if(node1)
node1.disconnect(src)
nodes[1] = null
nullifyPipenet(parents[1])
if(node2)
node2.disconnect(src)
nodes[2] = null
nullifyPipenet(parents[2])
if(anchored)
SetInitDirections()
atmosinit()
node1 = nodes[1]
if(node1)
node1.atmosinit()
node1.addMember(src)
node2 = nodes[2]
if(node2)
node2.atmosinit()
node2.addMember(src)
build_network()
return TRUE
/obj/machinery/atmospherics/components/binary/circulator/SetInitDirections()
switch(dir)
if(NORTH, SOUTH)
initialize_directions = EAST|WEST
if(EAST, WEST)
initialize_directions = NORTH|SOUTH
/obj/machinery/atmospherics/components/binary/circulator/getNodeConnects()
if(flipped)
return list(turn(dir, 270), turn(dir, 90))
return list(turn(dir, 90), turn(dir, 270))
/obj/machinery/atmospherics/components/binary/circulator/can_be_node(obj/machinery/atmospherics/target)
if(anchored)
return ..(target)
return FALSE
/obj/machinery/atmospherics/components/binary/circulator/multitool_act(mob/living/user, obj/item/I)
if(generator)
disconnectFromGenerator()
mode = !mode
to_chat(user, "<span class='notice'>You set [src] to [mode?"cold":"hot"] mode.</span>")
return TRUE
/obj/machinery/atmospherics/components/binary/circulator/screwdriver_act(mob/user, obj/item/I)
if(..())
return TRUE
panel_open = !panel_open
I.play_tool_sound(src)
to_chat(user, "<span class='notice'>You [panel_open?"open":"close"] the panel on [src].</span>")
return TRUE
/obj/machinery/atmospherics/components/binary/circulator/crowbar_act(mob/user, obj/item/I)
default_deconstruction_crowbar(I)
return TRUE
/obj/machinery/atmospherics/components/binary/circulator/on_deconstruction()
if(generator)
disconnectFromGenerator()
/obj/machinery/atmospherics/components/binary/circulator/proc/disconnectFromGenerator()
if(mode)
generator.cold_circ = null
else
generator.hot_circ = null
generator.update_icon()
generator = null
/obj/machinery/atmospherics/components/binary/circulator/setPipingLayer(new_layer)
..()
pixel_x = 0
pixel_y = 0
/obj/machinery/atmospherics/components/binary/circulator/verb/circulator_flip()
set name = "Flip"
set category = "Object"
set src in oview(1)
if(!ishuman(usr))
return
if(anchored)
to_chat(usr, "<span class='danger'>[src] is anchored!</span>")
return
flipped = !flipped
to_chat(usr, "<span class='notice'>You flip [src].</span>")
update_icon()
//node2, air2, network2 correspond to input
//node1, air1, network1 correspond to output
#define CIRCULATOR_HOT 0
#define CIRCULATOR_COLD 1
/obj/machinery/atmospherics/components/binary/circulator
name = "circulator/heat exchanger"
desc = "A gas circulator pump and heat exchanger."
icon_state = "circ-off-0"
var/active = FALSE
var/last_pressure_delta = 0
pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
density = TRUE
var/flipped = 0
var/mode = CIRCULATOR_HOT
var/obj/machinery/power/generator/generator
//default cold circ for mappers
/obj/machinery/atmospherics/components/binary/circulator/cold
mode = CIRCULATOR_COLD
/obj/machinery/atmospherics/components/binary/circulator/Initialize(mapload)
.=..()
component_parts = list(new /obj/item/circuitboard/machine/circulator)
/obj/machinery/atmospherics/components/binary/circulator/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
/obj/machinery/atmospherics/components/binary/circulator/Destroy()
if(generator)
disconnectFromGenerator()
return ..()
/obj/machinery/atmospherics/components/binary/circulator/proc/return_transfer_air()
var/datum/gas_mixture/air1 = airs[1]
var/datum/gas_mixture/air2 = airs[2]
var/output_starting_pressure = air1.return_pressure()
var/input_starting_pressure = air2.return_pressure()
if(output_starting_pressure >= input_starting_pressure-10)
//Need at least 10 KPa difference to overcome friction in the mechanism
last_pressure_delta = 0
return null
//Calculate necessary moles to transfer using PV = nRT
if(air2.temperature>0)
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2
var/transfer_moles = pressure_delta*air1.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
last_pressure_delta = pressure_delta
//Actually transfer the gas
var/datum/gas_mixture/removed = air2.remove(transfer_moles)
update_parents()
return removed
else
last_pressure_delta = 0
/obj/machinery/atmospherics/components/binary/circulator/process_atmos()
..()
update_icon()
/obj/machinery/atmospherics/components/binary/circulator/update_icon()
if(!is_operational())
icon_state = "circ-p-[flipped]"
else if(last_pressure_delta > 0)
if(last_pressure_delta > ONE_ATMOSPHERE)
icon_state = "circ-run-[flipped]"
else
icon_state = "circ-slow-[flipped]"
else
icon_state = "circ-off-[flipped]"
/obj/machinery/atmospherics/components/binary/circulator/wrench_act(mob/living/user, obj/item/I)
if(!panel_open)
return
anchored = !anchored
I.play_tool_sound(src)
if(generator)
disconnectFromGenerator()
to_chat(user, "<span class='notice'>You [anchored?"secure":"unsecure"] [src].</span>")
var/obj/machinery/atmospherics/node1 = nodes[1]
var/obj/machinery/atmospherics/node2 = nodes[2]
if(node1)
node1.disconnect(src)
nodes[1] = null
nullifyPipenet(parents[1])
if(node2)
node2.disconnect(src)
nodes[2] = null
nullifyPipenet(parents[2])
if(anchored)
SetInitDirections()
atmosinit()
node1 = nodes[1]
if(node1)
node1.atmosinit()
node1.addMember(src)
node2 = nodes[2]
if(node2)
node2.atmosinit()
node2.addMember(src)
build_network()
return TRUE
/obj/machinery/atmospherics/components/binary/circulator/SetInitDirections()
switch(dir)
if(NORTH, SOUTH)
initialize_directions = EAST|WEST
if(EAST, WEST)
initialize_directions = NORTH|SOUTH
/obj/machinery/atmospherics/components/binary/circulator/getNodeConnects()
if(flipped)
return list(turn(dir, 270), turn(dir, 90))
return list(turn(dir, 90), turn(dir, 270))
/obj/machinery/atmospherics/components/binary/circulator/can_be_node(obj/machinery/atmospherics/target)
if(anchored)
return ..(target)
return FALSE
/obj/machinery/atmospherics/components/binary/circulator/multitool_act(mob/living/user, obj/item/I)
if(generator)
disconnectFromGenerator()
mode = !mode
to_chat(user, "<span class='notice'>You set [src] to [mode?"cold":"hot"] mode.</span>")
return TRUE
/obj/machinery/atmospherics/components/binary/circulator/screwdriver_act(mob/user, obj/item/I)
if(..())
return TRUE
panel_open = !panel_open
I.play_tool_sound(src)
to_chat(user, "<span class='notice'>You [panel_open?"open":"close"] the panel on [src].</span>")
return TRUE
/obj/machinery/atmospherics/components/binary/circulator/crowbar_act(mob/user, obj/item/I)
default_deconstruction_crowbar(I)
return TRUE
/obj/machinery/atmospherics/components/binary/circulator/on_deconstruction()
if(generator)
disconnectFromGenerator()
/obj/machinery/atmospherics/components/binary/circulator/proc/disconnectFromGenerator()
if(mode)
generator.cold_circ = null
else
generator.hot_circ = null
generator.update_icon()
generator = null
/obj/machinery/atmospherics/components/binary/circulator/setPipingLayer(new_layer)
..()
pixel_x = 0
pixel_y = 0
/obj/machinery/atmospherics/components/binary/circulator/verb/circulator_flip()
set name = "Flip"
set category = "Object"
set src in oview(1)
if(!ishuman(usr))
return
if(anchored)
to_chat(usr, "<span class='danger'>[src] is anchored!</span>")
return
flipped = !flipped
to_chat(usr, "<span class='notice'>You flip [src].</span>")
update_icon()
@@ -1,253 +1,253 @@
/*
Acts like a normal vent, but has an input AND output.
*/
#define EXT_BOUND 1
#define INPUT_MIN 2
#define OUTPUT_MAX 4
/obj/machinery/atmospherics/components/binary/dp_vent_pump
icon = 'icons/obj/atmospherics/components/unary_devices.dmi' //We reuse the normal vent icons!
icon_state = "dpvent_map"
//node2 is output port
//node1 is input port
name = "dual-port air vent"
desc = "Has a valve and pump attached to it. There are two ports."
level = 1
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
var/pump_direction = 1 //0 = siphoning, 1 = releasing
var/external_pressure_bound = ONE_ATMOSPHERE
var/input_pressure_min = 0
var/output_pressure_max = 0
var/pressure_checks = EXT_BOUND
//EXT_BOUND: Do not pass external_pressure_bound
//INPUT_MIN: Do not pass input_pressure_min
//OUTPUT_MAX: Do not pass output_pressure_max
/obj/machinery/atmospherics/components/binary/dp_vent_pump/layer1
piping_layer = PIPING_LAYER_MIN
pixel_x = -PIPING_LAYER_P_X
pixel_y = -PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/layer3
piping_layer = PIPING_LAYER_MAX
pixel_x = PIPING_LAYER_P_X
pixel_y = PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/on
on = TRUE
icon_state = "dpvent_map_on"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/on/layer1
piping_layer = PIPING_LAYER_MIN
pixel_x = -PIPING_LAYER_P_X
pixel_y = -PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/on/layer3
piping_layer = PIPING_LAYER_MAX
pixel_x = PIPING_LAYER_P_X
pixel_y = PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/Destroy()
SSradio.remove_object(src, frequency)
return ..()
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume
name = "large dual-port air vent"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/incinerator_toxmix
id = INCINERATOR_TOXMIX_DP_VENTPUMP
frequency = FREQ_AIRLOCK_CONTROL
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/incinerator_atmos
id = INCINERATOR_ATMOS_DP_VENTPUMP
frequency = FREQ_AIRLOCK_CONTROL
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/incinerator_syndicatelava
id = INCINERATOR_SYNDICATELAVA_DP_VENTPUMP
frequency = FREQ_AIRLOCK_CONTROL
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/layer1
piping_layer = PIPING_LAYER_MIN
pixel_x = -PIPING_LAYER_P_X
pixel_y = -PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/layer3
piping_layer = PIPING_LAYER_MAX
pixel_x = PIPING_LAYER_P_X
pixel_y = PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/on
on = TRUE
icon_state = "dpvent_map_on"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/on/layer1
piping_layer = PIPING_LAYER_MIN
pixel_x = -PIPING_LAYER_P_X
pixel_y = -PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/on/layer3
piping_layer = PIPING_LAYER_MAX
pixel_x = PIPING_LAYER_P_X
pixel_y = PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/New()
..()
var/datum/gas_mixture/air1 = airs[1]
var/datum/gas_mixture/air2 = airs[2]
air1.volume = 1000
air2.volume = 1000
/obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes()
cut_overlays()
if(showpipe)
add_overlay(getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "dpvent_cap"))
if(!on || !is_operational())
icon_state = "vent_off"
return
if(pump_direction)
icon_state = "vent_out"
else
icon_state = "vent_in"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/process_atmos()
..()
if(!on)
return
var/datum/gas_mixture/air1 = airs[1]
var/datum/gas_mixture/air2 = airs[2]
var/datum/gas_mixture/environment = loc.return_air()
var/environment_pressure = environment.return_pressure()
if(pump_direction) //input -> external
var/pressure_delta = 10000
if(pressure_checks&EXT_BOUND)
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
if(pressure_checks&INPUT_MIN)
pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min))
if(pressure_delta > 0)
if(air1.temperature > 0)
var/transfer_moles = pressure_delta*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
//Removed can be null if there is no atmosphere in air1
if(!removed)
return
loc.assume_air(removed)
air_update_turf()
var/datum/pipeline/parent1 = parents[1]
parent1.update = 1
else //external -> output
var/pressure_delta = 10000
if(pressure_checks&EXT_BOUND)
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
if(pressure_checks&INPUT_MIN)
pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure()))
if(pressure_delta > 0)
if(environment.temperature > 0)
var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
//removed can be null if there is no air in the location
if(!removed)
return
air2.merge(removed)
air_update_turf()
var/datum/pipeline/parent2 = parents[2]
parent2.update = 1
//Radio remote control
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status()
if(!radio_connection)
return
var/datum/signal/signal = new(list(
"tag" = id,
"device" = "ADVP",
"power" = on,
"direction" = pump_direction?("release"):("siphon"),
"checks" = pressure_checks,
"input" = input_pressure_min,
"output" = output_pressure_max,
"external" = external_pressure_bound,
"sigtype" = "status"
))
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
/obj/machinery/atmospherics/components/binary/dp_vent_pump/atmosinit()
..()
if(frequency)
set_frequency(frequency)
broadcast_status()
/obj/machinery/atmospherics/components/binary/dp_vent_pump/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
return
if("power" in signal.data)
on = text2num(signal.data["power"])
if("power_toggle" in signal.data)
on = !on
if("set_direction" in signal.data)
pump_direction = text2num(signal.data["set_direction"])
if("checks" in signal.data)
pressure_checks = text2num(signal.data["checks"])
if("purge" in signal.data)
pressure_checks &= ~1
pump_direction = 0
if("stabilize" in signal.data)
pressure_checks |= 1
pump_direction = 1
if("set_input_pressure" in signal.data)
input_pressure_min = CLAMP(text2num(signal.data["set_input_pressure"]),0,ONE_ATMOSPHERE*50)
if("set_output_pressure" in signal.data)
output_pressure_max = CLAMP(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
if("set_external_pressure" in signal.data)
external_pressure_bound = CLAMP(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
if("status" in signal.data)
spawn(2)
broadcast_status()
return //do not update_icon
spawn(2)
broadcast_status()
update_icon()
#undef EXT_BOUND
#undef INPUT_MIN
#undef OUTPUT_MAX
/*
Acts like a normal vent, but has an input AND output.
*/
#define EXT_BOUND 1
#define INPUT_MIN 2
#define OUTPUT_MAX 4
/obj/machinery/atmospherics/components/binary/dp_vent_pump
icon = 'icons/obj/atmospherics/components/unary_devices.dmi' //We reuse the normal vent icons!
icon_state = "dpvent_map"
//node2 is output port
//node1 is input port
name = "dual-port air vent"
desc = "Has a valve and pump attached to it. There are two ports."
level = 1
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
var/pump_direction = 1 //0 = siphoning, 1 = releasing
var/external_pressure_bound = ONE_ATMOSPHERE
var/input_pressure_min = 0
var/output_pressure_max = 0
var/pressure_checks = EXT_BOUND
//EXT_BOUND: Do not pass external_pressure_bound
//INPUT_MIN: Do not pass input_pressure_min
//OUTPUT_MAX: Do not pass output_pressure_max
/obj/machinery/atmospherics/components/binary/dp_vent_pump/layer1
piping_layer = PIPING_LAYER_MIN
pixel_x = -PIPING_LAYER_P_X
pixel_y = -PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/layer3
piping_layer = PIPING_LAYER_MAX
pixel_x = PIPING_LAYER_P_X
pixel_y = PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/on
on = TRUE
icon_state = "dpvent_map_on"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/on/layer1
piping_layer = PIPING_LAYER_MIN
pixel_x = -PIPING_LAYER_P_X
pixel_y = -PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/on/layer3
piping_layer = PIPING_LAYER_MAX
pixel_x = PIPING_LAYER_P_X
pixel_y = PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/Destroy()
SSradio.remove_object(src, frequency)
return ..()
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume
name = "large dual-port air vent"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/incinerator_toxmix
id = INCINERATOR_TOXMIX_DP_VENTPUMP
frequency = FREQ_AIRLOCK_CONTROL
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/incinerator_atmos
id = INCINERATOR_ATMOS_DP_VENTPUMP
frequency = FREQ_AIRLOCK_CONTROL
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/incinerator_syndicatelava
id = INCINERATOR_SYNDICATELAVA_DP_VENTPUMP
frequency = FREQ_AIRLOCK_CONTROL
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/layer1
piping_layer = PIPING_LAYER_MIN
pixel_x = -PIPING_LAYER_P_X
pixel_y = -PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/layer3
piping_layer = PIPING_LAYER_MAX
pixel_x = PIPING_LAYER_P_X
pixel_y = PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/on
on = TRUE
icon_state = "dpvent_map_on"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/on/layer1
piping_layer = PIPING_LAYER_MIN
pixel_x = -PIPING_LAYER_P_X
pixel_y = -PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/on/layer3
piping_layer = PIPING_LAYER_MAX
pixel_x = PIPING_LAYER_P_X
pixel_y = PIPING_LAYER_P_Y
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/New()
..()
var/datum/gas_mixture/air1 = airs[1]
var/datum/gas_mixture/air2 = airs[2]
air1.volume = 1000
air2.volume = 1000
/obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes()
cut_overlays()
if(showpipe)
add_overlay(getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "dpvent_cap"))
if(!on || !is_operational())
icon_state = "vent_off"
return
if(pump_direction)
icon_state = "vent_out"
else
icon_state = "vent_in"
/obj/machinery/atmospherics/components/binary/dp_vent_pump/process_atmos()
..()
if(!on)
return
var/datum/gas_mixture/air1 = airs[1]
var/datum/gas_mixture/air2 = airs[2]
var/datum/gas_mixture/environment = loc.return_air()
var/environment_pressure = environment.return_pressure()
if(pump_direction) //input -> external
var/pressure_delta = 10000
if(pressure_checks&EXT_BOUND)
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
if(pressure_checks&INPUT_MIN)
pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min))
if(pressure_delta > 0)
if(air1.temperature > 0)
var/transfer_moles = pressure_delta*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
//Removed can be null if there is no atmosphere in air1
if(!removed)
return
loc.assume_air(removed)
air_update_turf()
var/datum/pipeline/parent1 = parents[1]
parent1.update = 1
else //external -> output
var/pressure_delta = 10000
if(pressure_checks&EXT_BOUND)
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
if(pressure_checks&INPUT_MIN)
pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure()))
if(pressure_delta > 0)
if(environment.temperature > 0)
var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
//removed can be null if there is no air in the location
if(!removed)
return
air2.merge(removed)
air_update_turf()
var/datum/pipeline/parent2 = parents[2]
parent2.update = 1
//Radio remote control
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status()
if(!radio_connection)
return
var/datum/signal/signal = new(list(
"tag" = id,
"device" = "ADVP",
"power" = on,
"direction" = pump_direction?("release"):("siphon"),
"checks" = pressure_checks,
"input" = input_pressure_min,
"output" = output_pressure_max,
"external" = external_pressure_bound,
"sigtype" = "status"
))
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
/obj/machinery/atmospherics/components/binary/dp_vent_pump/atmosinit()
..()
if(frequency)
set_frequency(frequency)
broadcast_status()
/obj/machinery/atmospherics/components/binary/dp_vent_pump/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
return
if("power" in signal.data)
on = text2num(signal.data["power"])
if("power_toggle" in signal.data)
on = !on
if("set_direction" in signal.data)
pump_direction = text2num(signal.data["set_direction"])
if("checks" in signal.data)
pressure_checks = text2num(signal.data["checks"])
if("purge" in signal.data)
pressure_checks &= ~1
pump_direction = 0
if("stabilize" in signal.data)
pressure_checks |= 1
pump_direction = 1
if("set_input_pressure" in signal.data)
input_pressure_min = CLAMP(text2num(signal.data["set_input_pressure"]),0,ONE_ATMOSPHERE*50)
if("set_output_pressure" in signal.data)
output_pressure_max = CLAMP(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
if("set_external_pressure" in signal.data)
external_pressure_bound = CLAMP(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
if("status" in signal.data)
spawn(2)
broadcast_status()
return //do not update_icon
spawn(2)
broadcast_status()
update_icon()
#undef EXT_BOUND
#undef INPUT_MIN
#undef OUTPUT_MAX