-Supply and scrubber pipes can be run in parallel without connecting to each other
-Supply pipes will only connect to supply pipes, vents and Universal Pipe Adapters(UPAs)
-Scrubber pipes will only connect to scrubber pipes, scrubbers and UPAs
-Supply and scrubber pipes are offset along the x and y axes to prevent sprite overlap
-UPAs will connect to regular, scrubber and supply pipes, as well as anything else that connects to a regular pipe. UPAs will be used to interface between the supply/scrubber loops and atmos
This commit is contained in:
RavingManiac
2014-09-05 00:18:33 +08:00
parent aba09de9d7
commit 9801dfa9a9
18 changed files with 822 additions and 174 deletions

View File

@@ -1,7 +1,7 @@
/obj/machinery/atmospherics/unary
dir = SOUTH
initialize_directions = SOUTH
layer = TURF_LAYER+0.1
//layer = TURF_LAYER+0.1
var/datum/gas_mixture/air_contents
@@ -46,8 +46,12 @@
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
if(target.initialize_directions & get_dir(target,src))
node = target
break
var/c = check_connect_types(target,src)
if (c)
target.connected_to = c
src.connected_to = c
node = target
break
update_icon()
update_underlays()

View File

@@ -18,7 +18,9 @@
use_power = 1
idle_power_usage = 150 //internal circuitry, friction losses and stuff
active_power_usage = 7500 //This also doubles as a measure of how powerful the pump is, in Watts. 7500 W ~ 10 HP
connect_types = list(1,2) //connects to regular and supply pipes
var/area/initial_loc
level = 1
var/area_uid
@@ -64,7 +66,7 @@
/obj/machinery/atmospherics/unary/vent_pump/New()
..()
air_contents.volume = ATMOS_DEFAULT_VOLUME_PUMP
icon = null
initial_loc = get_area(loc)
if (initial_loc.master)
@@ -87,13 +89,13 @@
air_contents.volume = ATMOS_DEFAULT_VOLUME_PUMP + 800
/obj/machinery/atmospherics/unary/vent_pump/update_icon(var/safety = 0)
if(!check_icon_cache())
if(!check_icon_cache())
return
if (!node)
on = 0
overlays.Cut()
var/vent_icon = "vent"
var/turf/T = get_turf(src)
@@ -102,7 +104,7 @@
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
vent_icon += "h"
if(welded)
vent_icon += "weld"
else if(!powered())
@@ -121,7 +123,10 @@
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
return
else
add_underlay(T, node, dir)
if(node)
add_underlay(T, node, dir, node.icon_connect_type)
else
add_underlay(T,, dir)
/obj/machinery/atmospherics/unary/vent_pump/hide()
update_icon()
@@ -138,7 +143,7 @@
/obj/machinery/atmospherics/unary/vent_pump/process()
..()
if (!node)
on = 0
if(!can_pump())
@@ -150,27 +155,27 @@
var/datum/gas_mixture/environment = loc.return_air()
var/power_draw = -1
//Figure out the target pressure difference
var/pressure_delta = get_pressure_delta(environment)
//src.visible_message("DEBUG >>> [src]: pressure_delta = [pressure_delta]")
if((environment.temperature || air_contents.temperature) && pressure_delta > 0.5)
if(pump_direction) //internal -> external
if(pump_direction) //internal -> external
var/output_volume = environment.volume * environment.group_multiplier
var/air_temperature = environment.temperature? environment.temperature : air_contents.temperature
var/transfer_moles = pressure_delta*output_volume/(air_temperature * R_IDEAL_GAS_EQUATION)
//src.visible_message("DEBUG >>> [src]: output_volume = [output_volume]L; air_temperature = [air_temperature]K; transfer_moles = [transfer_moles] mol")
power_draw = pump_gas(src, air_contents, environment, transfer_moles, active_power_usage)
else //external -> internal
var/output_volume = air_contents.volume + (network? network.volume : 0)
var/air_temperature = air_contents.temperature? air_contents.temperature : environment.temperature
var/transfer_moles = pressure_delta*output_volume/(air_temperature * R_IDEAL_GAS_EQUATION)
//limit flow rate from turfs
transfer_moles = min(transfer_moles, environment.total_moles*MAX_SIPHON_FLOWRATE/environment.volume) //group_multiplier gets divided out here
power_draw = pump_gas(src, environment, air_contents, transfer_moles, active_power_usage)
if (power_draw < 0)
@@ -182,13 +187,13 @@
last_power_draw = handle_power_draw(power_draw)
if(network)
network.update = 1
return 1
/obj/machinery/atmospherics/unary/vent_pump/proc/get_pressure_delta(datum/gas_mixture/environment)
var/pressure_delta = DEFAULT_PRESSURE_DELTA
var/environment_pressure = environment.return_pressure()
if(pump_direction) //internal -> external
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
pressure_delta = min(pressure_delta, external_pressure_bound - environment_pressure) //increasing the pressure here
@@ -199,7 +204,7 @@
pressure_delta = min(pressure_delta, environment_pressure - external_pressure_bound) //decreasing the pressure here
if(pressure_checks & PRESSURE_CHECK_INTERNAL)
pressure_delta = min(pressure_delta, internal_pressure_bound - air_contents.return_pressure()) //increasing the pressure here
return pressure_delta
//Radio remote control
@@ -282,7 +287,7 @@
if(signal.data["checks_toggle"] != null)
pressure_checks = (pressure_checks?0:3)
if(signal.data["direction"] != null)
pump_direction = text2num(signal.data["direction"])
@@ -325,7 +330,7 @@
if(signal.data["init"] != null)
name = signal.data["init"]
return
if(signal.data["status"] != null)
spawn(2)
broadcast_status()

View File

@@ -9,6 +9,8 @@
active_power_usage = 7500 //This also doubles as a measure of how powerful the pump is, in Watts. 7500 W ~ 10 HP
var/last_power_draw = 0
connect_types = list(1,3) //connects to regular and scrubber pipes
level = 1
var/area/initial_loc
@@ -29,7 +31,7 @@
/obj/machinery/atmospherics/unary/vent_scrubber/New()
..()
air_contents.volume = ATMOS_DEFAULT_VOLUME_FILTER
icon = null
initial_loc = get_area(loc)
if (initial_loc.master)
@@ -70,7 +72,10 @@
if(T.intact && node && node.level == 1 && istype(node, /obj/machinery/atmospherics/pipe))
return
else
add_underlay(T, node, dir)
if(node)
add_underlay(T, node, dir, node.icon_connect_type)
else
add_underlay(T,, dir)
/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
@@ -130,7 +135,7 @@
if(scrubbing)
//limit flow rate from turfs
var/transfer_moles = min(environment.total_moles, environment.total_moles*MAX_SCRUBBER_FLOWRATE/environment.volume) //group_multiplier gets divided out here
power_draw = scrub_gas(src, scrubbing_gas, environment, air_contents, transfer_moles, active_power_usage)
else //Just siphon all air
//limit flow rate from turfs
@@ -145,14 +150,15 @@
last_flow_rate = 0
else
last_power_draw = handle_power_draw(power_draw)
if(network)
network.update = 1
return 1
/obj/machinery/atmospherics/unary/vent_scrubber/hide(var/i) //to make the little pipe section invisible, the icon changes.
update_icon()
update_underlays()
/obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal)
if(stat & (NOPOWER|BROKEN))
@@ -186,7 +192,7 @@
scrubbing = !scrubbing
var/list/toggle = list()
if(!isnull(signal.data["co2_scrub"]) && text2num(signal.data["co2_scrub"]) != ("carbon_dioxide" in scrubbing_gas))
toggle += "carbon_dioxide"
else if(signal.data["toggle_co2_scrub"])