diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm
index d91a2044b00..ca07bb0ff8e 100644
--- a/code/ATMOSPHERICS/atmospherics.dm
+++ b/code/ATMOSPHERICS/atmospherics.dm
@@ -10,7 +10,7 @@ Pipelines + Other Objects -> Pipe network
*/
-obj/machinery/atmospherics
+/obj/machinery/atmospherics
anchored = 1
idle_power_usage = 0
active_power_usage = 0
@@ -20,46 +20,46 @@ obj/machinery/atmospherics
-obj/machinery/atmospherics/var/initialize_directions = 0
-obj/machinery/atmospherics/var/pipe_color
+/obj/machinery/atmospherics/var/initialize_directions = 0
+/obj/machinery/atmospherics/var/pipe_color
-obj/machinery/atmospherics/process()
+/obj/machinery/atmospherics/process()
if(gc_destroyed) //comments on /vg/ imply that GC'd pipes still process
return PROCESS_KILL
build_network()
-obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
+/obj/machinery/atmospherics/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
// Check to see if should be added to network. Add self if so and adjust variables appropriately.
// Note don't forget to have neighbors look as well!
return null
-obj/machinery/atmospherics/proc/build_network()
+/obj/machinery/atmospherics/proc/build_network()
// Called to build a network from this node
return null
-obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference)
+/obj/machinery/atmospherics/proc/return_network(obj/machinery/atmospherics/reference)
// Returns pipe_network associated with connection to reference
// Notes: should create network if necessary
// Should never return null
return null
-obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
+/obj/machinery/atmospherics/proc/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
// Used when two pipe_networks are combining
-obj/machinery/atmospherics/proc/return_network_air(datum/network/reference)
+/obj/machinery/atmospherics/proc/return_network_air(datum/network/reference)
// Return a list of gas_mixture(s) in the object
// associated with reference pipe_network for use in rebuilding the networks gases list
// Is permitted to return null
-obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
+/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
-obj/machinery/atmospherics/update_icon()
+/obj/machinery/atmospherics/update_icon()
return null
-obj/machinery/atmospherics/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
+/obj/machinery/atmospherics/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(can_unwrench && istype(W, /obj/item/weapon/wrench))
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm
index 83affc6a0c3..923bb5ea0c2 100644
--- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm
@@ -1,4 +1,4 @@
-obj/machinery/atmospherics/binary
+/obj/machinery/atmospherics/binary
dir = SOUTH
initialize_directions = SOUTH|NORTH
use_power = 1
@@ -12,119 +12,119 @@ obj/machinery/atmospherics/binary
var/datum/pipe_network/network1
var/datum/pipe_network/network2
- New()
- ..()
- 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
- air1 = new
- air2 = new
+/obj/machinery/atmospherics/binary/New()
+ ..()
+ 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
+ air1 = new
+ air2 = new
- air1.volume = 200
- air2.volume = 200
+ air1.volume = 200
+ air2.volume = 200
// Housekeeping and pipe network stuff below
- network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
- if(reference == node1)
- network1 = new_network
+/obj/machinery/atmospherics/binary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
+ if(reference == node1)
+ network1 = new_network
- else if(reference == node2)
- network2 = new_network
+ else if(reference == node2)
+ network2 = new_network
- if(new_network.normal_members.Find(src))
- return 0
+ if(new_network.normal_members.Find(src))
+ return 0
- new_network.normal_members += src
+ new_network.normal_members += src
- return null
+ return null
- Destroy()
- loc = null
+/obj/machinery/atmospherics/binary/Destroy()
+ loc = null
- if(node1)
- node1.disconnect(src)
- del(network1)
- if(node2)
- node2.disconnect(src)
- del(network2)
+ if(node1)
+ node1.disconnect(src)
+ del(network1)
+ if(node2)
+ node2.disconnect(src)
+ del(network2)
+ node1 = null
+ node2 = null
+
+ ..()
+
+/obj/machinery/atmospherics/binary/initialize()
+ src.disconnect(src)
+
+ var/node2_connect = dir
+ var/node1_connect = turn(dir, 180)
+
+ for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
+ if(target.initialize_directions & get_dir(target,src))
+ node1 = target
+ break
+
+ for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
+ if(target.initialize_directions & get_dir(target,src))
+ node2 = target
+ break
+
+ update_icon()
+
+/obj/machinery/atmospherics/binary/build_network()
+ if(!network1 && node1)
+ network1 = new /datum/pipe_network()
+ network1.normal_members += src
+ network1.build_network(node1, src)
+
+ if(!network2 && node2)
+ network2 = new /datum/pipe_network()
+ network2.normal_members += src
+ network2.build_network(node2, src)
+
+
+/obj/machinery/atmospherics/binary/return_network(obj/machinery/atmospherics/reference)
+ build_network()
+
+ if(reference==node1)
+ return network1
+
+ if(reference==node2)
+ return network2
+
+ return null
+
+/obj/machinery/atmospherics/binary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
+ if(network1 == old_network)
+ network1 = new_network
+ if(network2 == old_network)
+ network2 = new_network
+
+ return 1
+
+/obj/machinery/atmospherics/binary/return_network_air(datum/pipe_network/reference)
+ var/list/results = list()
+
+ if(network1 == reference)
+ results += air1
+ if(network2 == reference)
+ results += air2
+
+ return results
+
+/obj/machinery/atmospherics/binary/disconnect(obj/machinery/atmospherics/reference)
+ if(reference==node1)
+ del(network1)
node1 = null
+
+ else if(reference==node2)
+ del(network2)
node2 = null
- ..()
-
- initialize()
- src.disconnect(src)
-
- var/node2_connect = dir
- var/node1_connect = turn(dir, 180)
-
- for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
- if(target.initialize_directions & get_dir(target,src))
- node1 = target
- break
-
- for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
- if(target.initialize_directions & get_dir(target,src))
- node2 = target
- break
-
- update_icon()
-
- build_network()
- if(!network1 && node1)
- network1 = new /datum/pipe_network()
- network1.normal_members += src
- network1.build_network(node1, src)
-
- if(!network2 && node2)
- network2 = new /datum/pipe_network()
- network2.normal_members += src
- network2.build_network(node2, src)
-
-
- return_network(obj/machinery/atmospherics/reference)
- build_network()
-
- if(reference==node1)
- return network1
-
- if(reference==node2)
- return network2
-
- return null
-
- reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
- if(network1 == old_network)
- network1 = new_network
- if(network2 == old_network)
- network2 = new_network
-
- return 1
-
- return_network_air(datum/pipe_network/reference)
- var/list/results = list()
-
- if(network1 == reference)
- results += air1
- if(network2 == reference)
- results += air2
-
- return results
-
- disconnect(obj/machinery/atmospherics/reference)
- if(reference==node1)
- del(network1)
- node1 = null
-
- else if(reference==node2)
- del(network2)
- node2 = null
-
- return null
\ No newline at end of file
+ return null
diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm
index 2142b7b06e2..a5a222736fb 100644
--- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm
@@ -17,54 +17,54 @@
density = 1
- proc/return_transfer_air()
+/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
- var/output_starting_pressure = air1.return_pressure()
- var/input_starting_pressure = air2.return_pressure()
+ 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
+ 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
+ //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)
+ var/transfer_moles = pressure_delta*air1.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
- last_pressure_delta = pressure_delta
+ last_pressure_delta = pressure_delta
- //world << "pressure_delta = [pressure_delta]; transfer_moles = [transfer_moles];"
+ //world << "pressure_delta = [pressure_delta]; transfer_moles = [transfer_moles];"
- //Actually transfer the gas
- var/datum/gas_mixture/removed = air2.remove(transfer_moles)
+ //Actually transfer the gas
+ var/datum/gas_mixture/removed = air2.remove(transfer_moles)
- if(network1)
- network1.update = 1
+ if(network1)
+ network1.update = 1
- if(network2)
- network2.update = 1
+ if(network2)
+ network2.update = 1
- return removed
+ return removed
- else
- last_pressure_delta = 0
-
- process()
- ..()
- update_icon()
+ else
+ last_pressure_delta = 0
+/obj/machinery/atmospherics/binary/circulator/process()
+ ..()
update_icon()
- if(stat & (BROKEN|NOPOWER))
- icon_state = "circ[side]-p"
- else if(last_pressure_delta > 0)
- if(last_pressure_delta > ONE_ATMOSPHERE)
- icon_state = "circ[side]-run"
- else
- icon_state = "circ[side]-slow"
- else
- icon_state = "circ[side]-off"
- return 1
\ No newline at end of file
+/obj/machinery/atmospherics/binary/circulator/update_icon()
+ if(stat & (BROKEN|NOPOWER))
+ icon_state = "circ[side]-p"
+ else if(last_pressure_delta > 0)
+ if(last_pressure_delta > ONE_ATMOSPHERE)
+ icon_state = "circ[side]-run"
+ else
+ icon_state = "circ[side]-slow"
+ else
+ icon_state = "circ[side]-off"
+
+ return 1
diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
index b761ad7150f..e2332110eb0 100644
--- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
@@ -9,191 +9,189 @@
desc = "Has a valve and pump attached to it. There are two ports."
level = 1
-
- high_volume
- name = "large dual-port air vent"
-
- New()
- ..()
-
- air1.volume = 1000
- air2.volume = 1000
-
- var/on = 0
- 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 = 1
- //1: Do not pass external_pressure_bound
- //2: Do not pass input_pressure_min
- //4: Do not pass output_pressure_max
-
- update_icon()
- if(on)
- if(pump_direction)
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
- else
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
- else
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
- on = 0
-
- return
-
- hide(var/i) //to make the little pipe section invisible, the icon changes.
- if(on)
- if(pump_direction)
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
- else
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
- else
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
- on = 0
- return
-
- process()
- ..()
-
- if(!on)
- return 0
-
- 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&1)
- pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
- if(pressure_checks&2)
- 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)
-
- loc.assume_air(removed)
-
- if(network1)
- network1.update = 1
-
- else //external -> output
- var/pressure_delta = 10000
-
- if(pressure_checks&1)
- pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
- if(pressure_checks&4)
- 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)
-
- air2.merge(removed)
-
- if(network2)
- network2.update = 1
-
- return 1
-
- //Radio remote control
-
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- if(frequency)
- radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
-
- broadcast_status()
- if(!radio_connection)
- return 0
-
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
-
- signal.data = 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)
-
- return 1
-
var/frequency = 0
var/id = null
var/datum/radio_frequency/radio_connection
- initialize()
- ..()
- if(frequency)
- set_frequency(frequency)
+/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume
+ name = "large dual-port air vent"
- receive_signal(datum/signal/signal)
+/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume/New()
+ ..()
- if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
- return 0
- if("power" in signal.data)
- on = text2num(signal.data["power"])
+ air1.volume = 1000
+ air2.volume = 1000
- if("power_toggle" in signal.data)
- on = !on
+var/on = 0
+var/pump_direction = 1 //0 = siphoning, 1 = releasing
- if("set_direction" in signal.data)
- pump_direction = text2num(signal.data["set_direction"])
+var/external_pressure_bound = ONE_ATMOSPHERE
+var/input_pressure_min = 0
+var/output_pressure_max = 0
- if("checks" in signal.data)
- pressure_checks = text2num(signal.data["checks"])
+var/pressure_checks = 1
+//1: Do not pass external_pressure_bound
+//2: Do not pass input_pressure_min
+//4: Do not pass output_pressure_max
- if("purge" in signal.data)
- pressure_checks &= ~1
- pump_direction = 0
+/obj/machinery/atmospherics/binary/dp_vent_pump/update_icon()
+ if(on)
+ if(pump_direction)
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
+ else
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+ else
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ on = 0
- if("stabalize" in signal.data)
- pressure_checks |= 1
- pump_direction = 1
+ return
- if("set_input_pressure" in signal.data)
- input_pressure_min = Clamp(
- text2num(signal.data["set_input_pressure"]),
- 0,
- ONE_ATMOSPHERE*50
- )
+/obj/machinery/atmospherics/binary/dp_vent_pump/hide(var/i) //to make the little pipe section invisible, the icon changes.
+ if(on)
+ if(pump_direction)
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
+ else
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+ else
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ on = 0
+ return
- if("set_output_pressure" in signal.data)
- output_pressure_max = Clamp(
- text2num(signal.data["set_output_pressure"]),
- 0,
- ONE_ATMOSPHERE*50
- )
+/obj/machinery/atmospherics/binary/dp_vent_pump/process()
+ ..()
- if("set_external_pressure" in signal.data)
- external_pressure_bound = Clamp(
- text2num(signal.data["set_external_pressure"]),
- 0,
- ONE_ATMOSPHERE*50
- )
+ if(!on)
+ return 0
- if("status" in signal.data)
- spawn(2)
- broadcast_status()
- return //do not update_icon
- //if(signal.data["tag"])
+ 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&1)
+ pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
+ if(pressure_checks&2)
+ 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)
+
+ loc.assume_air(removed)
+
+ if(network1)
+ network1.update = 1
+
+ else //external -> output
+ var/pressure_delta = 10000
+
+ if(pressure_checks&1)
+ pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
+ if(pressure_checks&4)
+ 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)
+
+ air2.merge(removed)
+
+ if(network2)
+ network2.update = 1
+
+ return 1
+
+ //Radio remote control
+
+/obj/machinery/atmospherics/binary/dp_vent_pump/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ if(frequency)
+ radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
+
+/obj/machinery/atmospherics/binary/dp_vent_pump/proc/broadcast_status()
+ if(!radio_connection)
+ return 0
+
+ var/datum/signal/signal = new
+ signal.transmission_method = 1 //radio signal
+ signal.source = src
+
+ signal.data = 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)
+
+ return 1
+
+/obj/machinery/atmospherics/binary/dp_vent_pump/initialize()
+ ..()
+ if(frequency)
+ set_frequency(frequency)
+
+/obj/machinery/atmospherics/binary/dp_vent_pump/receive_signal(datum/signal/signal)
+
+ if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
+ return 0
+ 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("stabalize" 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()
- update_icon()
\ No newline at end of file
+ return //do not update_icon
+ //if(signal.data["tag"])
+ spawn(2)
+ broadcast_status()
+ update_icon()
diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
index 9441b78e48d..8cea7ee9207 100644
--- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
@@ -1,4 +1,4 @@
-obj/machinery/atmospherics/binary/passive_gate
+/obj/machinery/atmospherics/binary/passive_gate
//Tries to achieve target pressure at output (like a normal pump) except
// Uses no power but can not transfer gases from a low pressure area to a high pressure area
icon = 'icons/obj/atmospherics/passive_gate.dmi'
@@ -16,156 +16,155 @@ obj/machinery/atmospherics/binary/passive_gate
var/id = null
var/datum/radio_frequency/radio_connection
- update_icon()
- if(stat & NOPOWER)
- icon_state = "intact_off"
- else if(node1 && node2)
- icon_state = "intact_[on?("on"):("off")]"
+/obj/machinery/atmospherics/binary/passive_gate/update_icon()
+ if(stat & NOPOWER)
+ icon_state = "intact_off"
+ else if(node1 && node2)
+ icon_state = "intact_[on?("on"):("off")]"
+ else
+ if(node1)
+ icon_state = "exposed_1_off"
+ else if(node2)
+ icon_state = "exposed_2_off"
else
- if(node1)
- icon_state = "exposed_1_off"
- else if(node2)
- icon_state = "exposed_2_off"
- else
- icon_state = "exposed_3_off"
- return
+ icon_state = "exposed_3_off"
+ return
- process()
- ..()
- if(!on)
- return 0
+/obj/machinery/atmospherics/binary/passive_gate/process()
+ ..()
+ if(!on)
+ return 0
- var/output_starting_pressure = air2.return_pressure()
- var/input_starting_pressure = air1.return_pressure()
+ var/output_starting_pressure = air2.return_pressure()
+ var/input_starting_pressure = air1.return_pressure()
- if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10))
- //No need to pump gas if target is already reached or input pressure is too low
- //Need at least 10 KPa difference to overcome friction in the mechanism
- return 1
+ if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10))
+ //No need to pump gas if target is already reached or input pressure is too low
+ //Need at least 10 KPa difference to overcome friction in the mechanism
+ return 1
- //Calculate necessary moles to transfer using PV = nRT
- if((air1.total_moles() > 0) && (air1.temperature>0))
- var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2)
- //Can not have a pressure delta that would cause output_pressure > input_pressure
+ //Calculate necessary moles to transfer using PV = nRT
+ if((air1.total_moles() > 0) && (air1.temperature>0))
+ var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2)
+ //Can not have a pressure delta that would cause output_pressure > input_pressure
- var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
+ var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
- //Actually transfer the gas
- var/datum/gas_mixture/removed = air1.remove(transfer_moles)
- air2.merge(removed)
+ //Actually transfer the gas
+ var/datum/gas_mixture/removed = air1.remove(transfer_moles)
+ air2.merge(removed)
- if(network1)
- network1.update = 1
+ if(network1)
+ network1.update = 1
- if(network2)
- network2.update = 1
+ if(network2)
+ network2.update = 1
- //Radio remote control
+//Radio remote control
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- if(frequency)
- radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
+/obj/machinery/atmospherics/binary/passive_gate/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ if(frequency)
+ radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
- broadcast_status()
- if(!radio_connection)
- return 0
+/obj/machinery/atmospherics/binary/passive_gate/proc/broadcast_status()
+ if(!radio_connection)
+ return 0
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
+ var/datum/signal/signal = new
+ signal.transmission_method = 1 //radio signal
+ signal.source = src
- signal.data = list(
- "tag" = id,
- "device" = "AGP",
- "power" = on,
- "target_output" = target_pressure,
- "sigtype" = "status"
- )
+ signal.data = list(
+ "tag" = id,
+ "device" = "AGP",
+ "power" = on,
+ "target_output" = target_pressure,
+ "sigtype" = "status"
+ )
- radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
+ radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
- return 1
+ return 1
- interact(mob/user as mob)
- var/dat = {"Power: [on?"On":"Off"]
- Desirable output pressure:
- [round(target_pressure,0.1)]kPa | Change
- "}
+/obj/machinery/atmospherics/binary/passive_gate/interact(mob/user as mob)
+ var/dat = {"Power: [on?"On":"Off"]
+ Desirable output pressure:
+ [round(target_pressure,0.1)]kPa | Change
+ "}
- user << browse("
[src.name] control[dat]", "window=atmo_pump")
- onclose(user, "atmo_pump")
+ user << browse("[src.name] control[dat]", "window=atmo_pump")
+ onclose(user, "atmo_pump")
- initialize()
- ..()
- if(frequency)
- set_frequency(frequency)
+/obj/machinery/atmospherics/binary/passive_gate/initialize()
+ ..()
+ if(frequency)
+ set_frequency(frequency)
- receive_signal(datum/signal/signal)
- if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
- return 0
+/obj/machinery/atmospherics/binary/passive_gate/receive_signal(datum/signal/signal)
+ if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
+ return 0
- if("power" in signal.data)
- on = text2num(signal.data["power"])
+ if("power" in signal.data)
+ on = text2num(signal.data["power"])
- if("power_toggle" in signal.data)
- on = !on
+ if("power_toggle" in signal.data)
+ on = !on
- if("set_output_pressure" in signal.data)
- target_pressure = Clamp(
- text2num(signal.data["set_output_pressure"]),
- 0,
- ONE_ATMOSPHERE*50
- )
-
- if("status" in signal.data)
- spawn(2)
- broadcast_status()
- return //do not update_icon
+ if("set_output_pressure" in signal.data)
+ target_pressure = Clamp(
+ text2num(signal.data["set_output_pressure"]),
+ 0,
+ ONE_ATMOSPHERE*50
+ )
+ if("status" in signal.data)
spawn(2)
broadcast_status()
- update_icon()
+ return //do not update_icon
+
+ spawn(2)
+ broadcast_status()
+ update_icon()
+ return
+
+
+
+/obj/machinery/atmospherics/binary/passive_gate/attack_hand(user as mob)
+ if(..())
return
-
-
-
- attack_hand(user as mob)
- if(..())
- return
- src.add_fingerprint(usr)
- if(!src.allowed(user))
- user << "\red Access denied."
- return
- usr.set_machine(src)
- interact(user)
+ src.add_fingerprint(usr)
+ if(!src.allowed(user))
+ user << "\red Access denied."
return
+ usr.set_machine(src)
+ interact(user)
+ return
- Topic(href,href_list)
- if(..()) return
- if(href_list["power"])
- on = !on
- if(href_list["set_press"])
- var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
- src.target_pressure = max(0, min(4500, new_pressure))
- usr.set_machine(src)
- src.update_icon()
- src.updateUsrDialog()
- return
+/obj/machinery/atmospherics/binary/passive_gate/Topic(href,href_list)
+ if(..()) return
+ if(href_list["power"])
+ on = !on
+ if(href_list["set_press"])
+ var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
+ src.target_pressure = max(0, min(4500, new_pressure))
+ usr.set_machine(src)
+ src.update_icon()
+ src.updateUsrDialog()
+ return
- power_change()
- ..()
- update_icon()
+/obj/machinery/atmospherics/binary/passive_gate/power_change()
+ ..()
+ update_icon()
- attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
- if (!istype(W, /obj/item/weapon/wrench))
- return ..()
- if (on)
- user << "\red You cannot unwrench this [src], turn it off first."
- return 1
+/obj/machinery/atmospherics/binary/passive_gate/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
+ if (!istype(W, /obj/item/weapon/wrench))
return ..()
+ if (on)
+ user << "\red You cannot unwrench this [src], turn it off first."
+ return 1
+ return ..()
diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm
index 025cfded082..fa0b11c7878 100644
--- a/code/ATMOSPHERICS/components/binary_devices/pump.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm
@@ -12,7 +12,7 @@ Thus, the two variables affect pump operation are set in New():
but overall network volume is also increased as this increases...
*/
-obj/machinery/atmospherics/binary/pump
+/obj/machinery/atmospherics/binary/pump
icon = 'icons/obj/atmospherics/pump.dmi'
icon_state = "intact_off"
@@ -28,157 +28,156 @@ obj/machinery/atmospherics/binary/pump
var/id = null
var/datum/radio_frequency/radio_connection
- on
- on = 1
- icon_state = "intact_on"
+/obj/machinery/atmospherics/binary/pump/on
+ on = 1
+ icon_state = "intact_on"
- update_icon()
- if(stat & NOPOWER)
- icon_state = "intact_off"
- else if(node1 && node2)
- icon_state = "intact_[on?("on"):("off")]"
+/obj/machinery/atmospherics/binary/pump/update_icon()
+ if(stat & NOPOWER)
+ icon_state = "intact_off"
+ else if(node1 && node2)
+ icon_state = "intact_[on?("on"):("off")]"
+ else
+ if(node1)
+ icon_state = "exposed_1_off"
+ else if(node2)
+ icon_state = "exposed_2_off"
else
- if(node1)
- icon_state = "exposed_1_off"
- else if(node2)
- icon_state = "exposed_2_off"
- else
- icon_state = "exposed_3_off"
+ icon_state = "exposed_3_off"
+ return
+
+/obj/machinery/atmospherics/binary/pump/process()
+// ..()
+ if(stat & (NOPOWER|BROKEN))
return
+ if(!on)
+ return 0
- process()
-// ..()
- if(stat & (NOPOWER|BROKEN))
- return
- if(!on)
- return 0
-
- var/output_starting_pressure = air2.return_pressure()
-
- if( (target_pressure - output_starting_pressure) < 0.01)
- //No need to pump gas if target is already reached!
- return 1
-
- //Calculate necessary moles to transfer using PV=nRT
- if((air1.total_moles() > 0) && (air1.temperature>0))
- var/pressure_delta = target_pressure - output_starting_pressure
- var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
-
- //Actually transfer the gas
- var/datum/gas_mixture/removed = air1.remove(transfer_moles)
- air2.merge(removed)
-
- if(network1)
- network1.update = 1
-
- if(network2)
- network2.update = 1
+ var/output_starting_pressure = air2.return_pressure()
+ if( (target_pressure - output_starting_pressure) < 0.01)
+ //No need to pump gas if target is already reached!
return 1
+ //Calculate necessary moles to transfer using PV=nRT
+ if((air1.total_moles() > 0) && (air1.temperature>0))
+ var/pressure_delta = target_pressure - output_starting_pressure
+ var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
+
+ //Actually transfer the gas
+ var/datum/gas_mixture/removed = air1.remove(transfer_moles)
+ air2.merge(removed)
+
+ if(network1)
+ network1.update = 1
+
+ if(network2)
+ network2.update = 1
+
+ return 1
+
//Radio remote control
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- if(frequency)
- radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
+/obj/machinery/atmospherics/binary/pump/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ if(frequency)
+ radio_connection = radio_controller.add_object(src, frequency, filter = RADIO_ATMOSIA)
- broadcast_status()
- if(!radio_connection)
- return 0
+/obj/machinery/atmospherics/binary/pump/proc/broadcast_status()
+ if(!radio_connection)
+ return 0
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
+ var/datum/signal/signal = new
+ signal.transmission_method = 1 //radio signal
+ signal.source = src
- signal.data = list(
- "tag" = id,
- "device" = "AGP",
- "power" = on,
- "target_output" = target_pressure,
- "sigtype" = "status"
- )
+ signal.data = list(
+ "tag" = id,
+ "device" = "AGP",
+ "power" = on,
+ "target_output" = target_pressure,
+ "sigtype" = "status"
+ )
- radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
+ radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
- return 1
+ return 1
- interact(mob/user as mob)
- var/dat = {"Power: [on?"On":"Off"]
- Desirable output pressure:
- [round(target_pressure,0.1)]kPa | Change
- "}
+/obj/machinery/atmospherics/binary/pump/interact(mob/user as mob)
+ var/dat = {"Power: [on?"On":"Off"]
+ Desirable output pressure:
+ [round(target_pressure,0.1)]kPa | Change
+ "}
- user << browse("[src.name] control[dat]", "window=atmo_pump")
- onclose(user, "atmo_pump")
+ user << browse("[src.name] control[dat]", "window=atmo_pump")
+ onclose(user, "atmo_pump")
- initialize()
- ..()
- if(frequency)
- set_frequency(frequency)
+/obj/machinery/atmospherics/binary/pump/initialize()
+ ..()
+ if(frequency)
+ set_frequency(frequency)
- receive_signal(datum/signal/signal)
- if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
- return 0
+/obj/machinery/atmospherics/binary/pump/receive_signal(datum/signal/signal)
+ if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
+ return 0
- if("power" in signal.data)
- on = text2num(signal.data["power"])
+ if("power" in signal.data)
+ on = text2num(signal.data["power"])
- if("power_toggle" in signal.data)
- on = !on
+ if("power_toggle" in signal.data)
+ on = !on
- if("set_output_pressure" in signal.data)
- target_pressure = Clamp(
- text2num(signal.data["set_output_pressure"]),
- 0,
- ONE_ATMOSPHERE*50
- )
-
- if("status" in signal.data)
- spawn(2)
- broadcast_status()
- return //do not update_icon
+ if("set_output_pressure" in signal.data)
+ target_pressure = Clamp(
+ text2num(signal.data["set_output_pressure"]),
+ 0,
+ ONE_ATMOSPHERE*50
+ )
+ if("status" in signal.data)
spawn(2)
broadcast_status()
- update_icon()
+ return //do not update_icon
+
+ spawn(2)
+ broadcast_status()
+ update_icon()
+ return
+
+
+/obj/machinery/atmospherics/binary/pump/attack_hand(user as mob)
+ if(..())
return
-
-
- attack_hand(user as mob)
- if(..())
- return
- src.add_fingerprint(usr)
- if(!src.allowed(user))
- user << "\red Access denied."
- return
- usr.set_machine(src)
- interact(user)
+ src.add_fingerprint(usr)
+ if(!src.allowed(user))
+ user << "\red Access denied."
return
+ usr.set_machine(src)
+ interact(user)
+ return
- Topic(href,href_list)
- if(..()) return
- if(href_list["power"])
- on = !on
- if(href_list["set_press"])
- var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
- src.target_pressure = max(0, min(4500, new_pressure))
- usr.set_machine(src)
- src.update_icon()
- src.updateUsrDialog()
- return
+/obj/machinery/atmospherics/binary/pump/Topic(href,href_list)
+ if(..()) return
+ if(href_list["power"])
+ on = !on
+ if(href_list["set_press"])
+ var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
+ src.target_pressure = max(0, min(4500, new_pressure))
+ usr.set_machine(src)
+ src.update_icon()
+ src.updateUsrDialog()
+ return
- power_change()
- ..()
- update_icon()
+/obj/machinery/atmospherics/binary/pump/power_change()
+ ..()
+ update_icon()
- attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
- if (!istype(W, /obj/item/weapon/wrench))
- return ..()
- if (!(stat & NOPOWER) && on)
- user << "\red You cannot unwrench this [src], turn it off first."
- return 1
+/obj/machinery/atmospherics/binary/pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
+ if (!istype(W, /obj/item/weapon/wrench))
return ..()
+ if (!(stat & NOPOWER) && on)
+ user << "\red You cannot unwrench this [src], turn it off first."
+ return 1
+ return ..()
diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
index 049c3360362..2c6cd18c73d 100644
--- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
@@ -12,7 +12,7 @@ Thus, the two variables affect pump operation are set in New():
but overall network volume is also increased as this increases...
*/
-obj/machinery/atmospherics/binary/volume_pump
+/obj/machinery/atmospherics/binary/volume_pump
icon = 'icons/obj/atmospherics/volume_pump.dmi'
icon_state = "intact_off"
@@ -28,155 +28,154 @@ obj/machinery/atmospherics/binary/volume_pump
var/id = null
var/datum/radio_frequency/radio_connection
- on
- on = 1
- icon_state = "intact_on"
+/obj/machinery/atmospherics/binary/volume_pump/on
+ on = 1
+ icon_state = "intact_on"
- update_icon()
- if(stat & NOPOWER)
- icon_state = "intact_off"
- else if(node1 && node2)
- icon_state = "intact_[on?("on"):("off")]"
+/obj/machinery/atmospherics/binary/volume_pump/update_icon()
+ if(stat & NOPOWER)
+ icon_state = "intact_off"
+ else if(node1 && node2)
+ icon_state = "intact_[on?("on"):("off")]"
+ else
+ if(node1)
+ icon_state = "exposed_1_off"
+ else if(node2)
+ icon_state = "exposed_2_off"
else
- if(node1)
- icon_state = "exposed_1_off"
- else if(node2)
- icon_state = "exposed_2_off"
- else
- icon_state = "exposed_3_off"
- return
+ icon_state = "exposed_3_off"
+ return
- process()
-// ..()
- if(stat & (NOPOWER|BROKEN))
- return
- if(!on)
- return 0
+/obj/machinery/atmospherics/binary/volume_pump/process()
+// ..()
+ if(stat & (NOPOWER|BROKEN))
+ return
+ if(!on)
+ return 0
// Pump mechanism just won't do anything if the pressure is too high/too low
- var/input_starting_pressure = air1.return_pressure()
- var/output_starting_pressure = air2.return_pressure()
-
- if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000))
- return 1
-
- var/transfer_ratio = max(1, transfer_rate/air1.volume)
-
- var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
-
- air2.merge(removed)
-
- if(network1)
- network1.update = 1
-
- if(network2)
- network2.update = 1
+ var/input_starting_pressure = air1.return_pressure()
+ var/output_starting_pressure = air2.return_pressure()
+ if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000))
return 1
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- if(frequency)
- radio_connection = radio_controller.add_object(src, frequency)
+ var/transfer_ratio = max(1, transfer_rate/air1.volume)
- broadcast_status()
- if(!radio_connection)
- return 0
+ var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
+ air2.merge(removed)
- signal.data = list(
- "tag" = id,
- "device" = "APV",
- "power" = on,
- "transfer_rate" = transfer_rate,
- "sigtype" = "status"
- )
- radio_connection.post_signal(src, signal)
+ if(network1)
+ network1.update = 1
- return 1
+ if(network2)
+ network2.update = 1
- interact(mob/user as mob)
- var/dat = {"Power: [on?"On":"Off"]
- Desirable output flow:
- [round(transfer_rate,1)]l/s | Change
- "}
+ return 1
- user << browse("[src.name] control[dat]", "window=atmo_pump")
- onclose(user, "atmo_pump")
+/obj/machinery/atmospherics/binary/volume_pump/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ if(frequency)
+ radio_connection = radio_controller.add_object(src, frequency)
+
+/obj/machinery/atmospherics/binary/volume_pump/proc/broadcast_status()
+ if(!radio_connection)
+ return 0
+
+ var/datum/signal/signal = new
+ signal.transmission_method = 1 //radio signal
+ signal.source = src
+
+ signal.data = list(
+ "tag" = id,
+ "device" = "APV",
+ "power" = on,
+ "transfer_rate" = transfer_rate,
+ "sigtype" = "status"
+ )
+ radio_connection.post_signal(src, signal)
+
+ return 1
+
+/obj/machinery/atmospherics/binary/volume_pump/interact(mob/user as mob)
+ var/dat = {"Power: [on?"On":"Off"]
+ Desirable output flow:
+ [round(transfer_rate,1)]l/s | Change
+ "}
+
+ user << browse("[src.name] control[dat]", "window=atmo_pump")
+ onclose(user, "atmo_pump")
- initialize()
- ..()
+/obj/machinery/atmospherics/binary/volume_pump/initialize()
+ ..()
- set_frequency(frequency)
+ set_frequency(frequency)
- receive_signal(datum/signal/signal)
- if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
- return 0
+/obj/machinery/atmospherics/binary/volume_pump/receive_signal(datum/signal/signal)
+ if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
+ return 0
- if("power" in signal.data)
- on = text2num(signal.data["power"])
+ if("power" in signal.data)
+ on = text2num(signal.data["power"])
- if("power_toggle" in signal.data)
- on = !on
+ if("power_toggle" in signal.data)
+ on = !on
- if("set_transfer_rate" in signal.data)
- transfer_rate = Clamp(
- text2num(signal.data["set_transfer_rate"]),
- 0,
- air1.volume
- )
-
- if("status" in signal.data)
- spawn(2)
- broadcast_status()
- return //do not update_icon
+ if("set_transfer_rate" in signal.data)
+ transfer_rate = Clamp(
+ text2num(signal.data["set_transfer_rate"]),
+ 0,
+ air1.volume
+ )
+ if("status" in signal.data)
spawn(2)
broadcast_status()
- update_icon()
+ return //do not update_icon
+
+ spawn(2)
+ broadcast_status()
+ update_icon()
- attack_hand(user as mob)
- if(..())
- return
- src.add_fingerprint(usr)
- if(!src.allowed(user))
- user << "\red Access denied."
- return
- usr.set_machine(src)
- interact(user)
+/obj/machinery/atmospherics/binary/volume_pump/attack_hand(user as mob)
+ if(..())
return
-
- Topic(href,href_list)
- if(..()) return
- if(href_list["power"])
- on = !on
- if(href_list["set_transfer_rate"])
- var/new_transfer_rate = input(usr,"Enter new output volume (0-200l/s)","Flow control",src.transfer_rate) as num
- src.transfer_rate = max(0, min(200, new_transfer_rate))
- usr.set_machine(src)
- src.update_icon()
- src.updateUsrDialog()
+ src.add_fingerprint(usr)
+ if(!src.allowed(user))
+ user << "\red Access denied."
return
+ usr.set_machine(src)
+ interact(user)
+ return
- power_change()
- ..()
- update_icon()
+/obj/machinery/atmospherics/binary/volume_pump/Topic(href,href_list)
+ if(..()) return
+ if(href_list["power"])
+ on = !on
+ if(href_list["set_transfer_rate"])
+ var/new_transfer_rate = input(usr,"Enter new output volume (0-200l/s)","Flow control",src.transfer_rate) as num
+ src.transfer_rate = max(0, min(200, new_transfer_rate))
+ usr.set_machine(src)
+ src.update_icon()
+ src.updateUsrDialog()
+ return
+
+/obj/machinery/atmospherics/binary/volume_pump/power_change()
+ ..()
+ update_icon()
- attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
- if (!istype(W, /obj/item/weapon/wrench))
- return ..()
- if (!(stat & NOPOWER) && on)
- user << "\red You cannot unwrench this [src], turn it off first."
- return 1
+/obj/machinery/atmospherics/binary/volume_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
+ if (!istype(W, /obj/item/weapon/wrench))
return ..()
+ if (!(stat & NOPOWER) && on)
+ user << "\red You cannot unwrench this [src], turn it off first."
+ return 1
+ return ..()
diff --git a/code/ATMOSPHERICS/components/portables_connector.dm b/code/ATMOSPHERICS/components/portables_connector.dm
index 545163c9cf4..2f4bf80bed9 100644
--- a/code/ATMOSPHERICS/components/portables_connector.dm
+++ b/code/ATMOSPHERICS/components/portables_connector.dm
@@ -21,117 +21,117 @@
level = 0
- New()
- initialize_directions = dir
- ..()
+/obj/machinery/atmospherics/portables_connector/New()
+ initialize_directions = dir
+ ..()
- update_icon()
- if(node)
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
- dir = get_dir(src, node)
- else
- icon_state = "exposed"
+/obj/machinery/atmospherics/portables_connector/update_icon()
+ if(node)
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
+ dir = get_dir(src, node)
+ else
+ icon_state = "exposed"
+ return
+
+/obj/machinery/atmospherics/portables_connector/hide(var/i) //to make the little pipe section invisible, the icon changes.
+ if(node)
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
+ dir = get_dir(src, node)
+ else
+ icon_state = "exposed"
+
+/obj/machinery/atmospherics/portables_connector/process()
+ ..()
+ if(!on)
return
-
- hide(var/i) //to make the little pipe section invisible, the icon changes.
- if(node)
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
- dir = get_dir(src, node)
- else
- icon_state = "exposed"
-
- process()
- ..()
- if(!on)
- return
- if(!connected_device)
- on = 0
- return
- if(network)
- network.update = 1
- return 1
+ if(!connected_device)
+ on = 0
+ return
+ if(network)
+ network.update = 1
+ return 1
// Housekeeping and pipe network stuff below
- network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
- if(reference == node)
- network = new_network
+/obj/machinery/atmospherics/portables_connector/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
+ if(reference == node)
+ network = new_network
- if(new_network.normal_members.Find(src))
- return 0
+ if(new_network.normal_members.Find(src))
+ return 0
- new_network.normal_members += src
+ new_network.normal_members += src
- return null
+ return null
- Destroy()
- if(connected_device)
- connected_device.disconnect()
+/obj/machinery/atmospherics/portables_connector/Destroy()
+ if(connected_device)
+ connected_device.disconnect()
- if(node)
- node.disconnect(src)
- del(network)
+ if(node)
+ node.disconnect(src)
+ del(network)
+ node = null
+
+ ..()
+
+/obj/machinery/atmospherics/portables_connector/initialize()
+ src.disconnect(src)
+
+ var/node_connect = dir
+
+ for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
+ if(target.initialize_directions & get_dir(target,src))
+ node = target
+ break
+
+ update_icon()
+
+/obj/machinery/atmospherics/portables_connector/build_network()
+ if(!network && node)
+ network = new /datum/pipe_network()
+ network.normal_members += src
+ network.build_network(node, src)
+
+
+/obj/machinery/atmospherics/portables_connector/return_network(obj/machinery/atmospherics/reference)
+ build_network()
+
+ if(reference==node)
+ return network
+
+ if(reference==connected_device)
+ return network
+
+ return null
+
+/obj/machinery/atmospherics/portables_connector/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
+ if(network == old_network)
+ network = new_network
+
+ return 1
+
+/obj/machinery/atmospherics/portables_connector/return_network_air(datum/pipe_network/reference)
+ var/list/results = list()
+
+ if(connected_device)
+ results += connected_device.air_contents
+
+ return results
+
+/obj/machinery/atmospherics/portables_connector/disconnect(obj/machinery/atmospherics/reference)
+ if(reference==node)
+ del(network)
node = null
- ..()
-
- initialize()
- src.disconnect(src)
-
- var/node_connect = dir
-
- for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
- if(target.initialize_directions & get_dir(target,src))
- node = target
- break
-
- update_icon()
-
- build_network()
- if(!network && node)
- network = new /datum/pipe_network()
- network.normal_members += src
- network.build_network(node, src)
+ return null
- return_network(obj/machinery/atmospherics/reference)
- build_network()
-
- if(reference==node)
- return network
-
- if(reference==connected_device)
- return network
-
- return null
-
- reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
- if(network == old_network)
- network = new_network
-
+/obj/machinery/atmospherics/portables_connector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
+ if (!istype(W, /obj/item/weapon/wrench))
+ return ..()
+ if (connected_device)
+ user << "\red You cannot unwrench this [src], dettach [connected_device] first."
return 1
-
- return_network_air(datum/pipe_network/reference)
- var/list/results = list()
-
- if(connected_device)
- results += connected_device.air_contents
-
- return results
-
- disconnect(obj/machinery/atmospherics/reference)
- if(reference==node)
- del(network)
- node = null
-
- return null
-
-
- attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
- if (!istype(W, /obj/item/weapon/wrench))
- return ..()
- if (connected_device)
- user << "\red You cannot unwrench this [src], dettach [connected_device] first."
- return 1
- return ..()
\ No newline at end of file
+ return ..()
diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
index 34757072946..e64eef54de3 100644
--- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
@@ -1,4 +1,4 @@
-obj/machinery/atmospherics/trinary/filter
+/obj/machinery/atmospherics/trinary/filter
icon = 'icons/obj/atmospherics/filter.dmi'
icon_state = "intact_off"
density = 1
@@ -28,117 +28,116 @@ Filter types:
var/frequency = 0
var/datum/radio_frequency/radio_connection
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- if(frequency)
- radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
+/obj/machinery/atmospherics/trinary/filter/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ if(frequency)
+ radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
- New()
- ..()
- if(radio_controller)
- initialize()
+/obj/machinery/atmospherics/trinary/filter/New()
+ ..()
+ if(radio_controller)
+ initialize()
- update_icon()
- if(stat & NOPOWER)
- icon_state = "intact_off"
- else if(node2 && node3 && node1)
- icon_state = "intact_[on?("on"):("off")]"
- else
- icon_state = "intact_off"
- on = 0
+/obj/machinery/atmospherics/trinary/filter/update_icon()
+ if(stat & NOPOWER)
+ icon_state = "intact_off"
+ else if(node2 && node3 && node1)
+ icon_state = "intact_[on?("on"):("off")]"
+ else
+ icon_state = "intact_off"
+ on = 0
- return
+ return
- power_change()
- var/old_stat = stat
- ..()
- if(old_stat != stat)
- update_icon()
+/obj/machinery/atmospherics/trinary/filter/power_change()
+ var/old_stat = stat
+ ..()
+ if(old_stat != stat)
+ update_icon()
- process()
- ..()
- if(!on)
- return 0
+/obj/machinery/atmospherics/trinary/filter/process()
+ ..()
+ if(!on)
+ return 0
- var/output_starting_pressure = air3.return_pressure()
-
- if(output_starting_pressure >= target_pressure)
- //No need to mix if target is already full!
- return 1
-
- //Calculate necessary moles to transfer using PV=nRT
-
- var/pressure_delta = target_pressure - output_starting_pressure
- var/transfer_moles
-
- if(air1.temperature > 0)
- transfer_moles = pressure_delta*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
-
- //Actually transfer the gas
-
- if(transfer_moles > 0)
- var/datum/gas_mixture/removed = air1.remove(transfer_moles)
-
- if(!removed)
- return
- var/datum/gas_mixture/filtered_out = new
- filtered_out.temperature = removed.temperature
-
- switch(filter_type)
- if(0) //removing plasma
- filtered_out.toxins = removed.toxins
- removed.toxins = 0
-
- if(removed.trace_gases.len>0)
- for(var/datum/gas/trace_gas in removed.trace_gases)
- if(istype(trace_gas, /datum/gas/oxygen_agent_b))
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
-
- if(1) //removing O2
- filtered_out.oxygen = removed.oxygen
- removed.oxygen = 0
-
- if(2) //removing N2
- filtered_out.nitrogen = removed.nitrogen
- removed.nitrogen = 0
-
- if(3) //removing CO2
- filtered_out.carbon_dioxide = removed.carbon_dioxide
- removed.carbon_dioxide = 0
-
- if(4)//removing N2O
- if(removed.trace_gases.len>0)
- for(var/datum/gas/trace_gas in removed.trace_gases)
- if(istype(trace_gas, /datum/gas/sleeping_agent))
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
-
- else
- filtered_out = null
-
-
- air2.merge(filtered_out)
- air3.merge(removed)
-
- if(network2)
- network2.update = 1
-
- if(network3)
- network3.update = 1
-
- if(network1)
- network1.update = 1
+ var/output_starting_pressure = air3.return_pressure()
+ if(output_starting_pressure >= target_pressure)
+ //No need to mix if target is already full!
return 1
- initialize()
- set_frequency(frequency)
- return ..()
+ //Calculate necessary moles to transfer using PV=nRT
-obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob)
+ var/pressure_delta = target_pressure - output_starting_pressure
+ var/transfer_moles
+
+ if(air1.temperature > 0)
+ transfer_moles = pressure_delta*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
+
+ //Actually transfer the gas
+
+ if(transfer_moles > 0)
+ var/datum/gas_mixture/removed = air1.remove(transfer_moles)
+
+ if(!removed)
+ return
+ var/datum/gas_mixture/filtered_out = new
+ filtered_out.temperature = removed.temperature
+
+ switch(filter_type)
+ if(0) //removing plasma
+ filtered_out.toxins = removed.toxins
+ removed.toxins = 0
+
+ if(removed.trace_gases.len>0)
+ for(var/datum/gas/trace_gas in removed.trace_gases)
+ if(istype(trace_gas, /datum/gas/oxygen_agent_b))
+ removed.trace_gases -= trace_gas
+ filtered_out.trace_gases += trace_gas
+
+ if(1) //removing O2
+ filtered_out.oxygen = removed.oxygen
+ removed.oxygen = 0
+
+ if(2) //removing N2
+ filtered_out.nitrogen = removed.nitrogen
+ removed.nitrogen = 0
+
+ if(3) //removing CO2
+ filtered_out.carbon_dioxide = removed.carbon_dioxide
+ removed.carbon_dioxide = 0
+
+ if(4)//removing N2O
+ if(removed.trace_gases.len>0)
+ for(var/datum/gas/trace_gas in removed.trace_gases)
+ if(istype(trace_gas, /datum/gas/sleeping_agent))
+ removed.trace_gases -= trace_gas
+ filtered_out.trace_gases += trace_gas
+
+ else
+ filtered_out = null
+
+
+ air2.merge(filtered_out)
+ air3.merge(removed)
+
+ if(network2)
+ network2.update = 1
+
+ if(network3)
+ network3.update = 1
+
+ if(network1)
+ network1.update = 1
+
+ return 1
+
+/obj/machinery/atmospherics/trinary/filter/initialize()
+ set_frequency(frequency)
+ return ..()
+
+/obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob)
if(..())
return
@@ -191,7 +190,7 @@ obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob)
onclose(user, "atmo_filter")
return
-obj/machinery/atmospherics/trinary/filter/Topic(href, href_list)
+/obj/machinery/atmospherics/trinary/filter/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
index 279d736f0ff..118dc5c7c87 100644
--- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm
@@ -1,4 +1,4 @@
-obj/machinery/atmospherics/trinary/mixer
+/obj/machinery/atmospherics/trinary/mixer
icon = 'icons/obj/atmospherics/mixer.dmi'
icon_state = "intact_off"
density = 1
@@ -17,132 +17,132 @@ obj/machinery/atmospherics/trinary/mixer
//node 3 is the outlet, nodes 1 & 2 are intakes
- update_icon()
- if(stat & NOPOWER)
- icon_state = "intact_off"
- else if(node2 && node3 && node1)
- icon_state = "intact_[on?("on"):("off")]"
- else
- icon_state = "intact_off"
- on = 0
+/obj/machinery/atmospherics/trinary/mixer/update_icon()
+ if(stat & NOPOWER)
+ icon_state = "intact_off"
+ else if(node2 && node3 && node1)
+ icon_state = "intact_[on?("on"):("off")]"
+ else
+ icon_state = "intact_off"
+ on = 0
- return
+ return
- power_change()
- var/old_stat = stat
- ..()
- if(old_stat != stat)
- update_icon()
+/obj/machinery/atmospherics/trinary/mixer/power_change()
+ var/old_stat = stat
+ ..()
+ if(old_stat != stat)
+ update_icon()
- New()
- ..()
- air3.volume = 300
+/obj/machinery/atmospherics/trinary/mixer/New()
+ ..()
+ air3.volume = 300
- process()
- ..()
- if(!on)
- return 0
+/obj/machinery/atmospherics/trinary/mixer/process()
+ ..()
+ if(!on)
+ return 0
- var/output_starting_pressure = air3.return_pressure()
-
- if(output_starting_pressure >= target_pressure)
- //No need to mix if target is already full!
- return 1
-
- //Calculate necessary moles to transfer using PV=nRT
-
- var/pressure_delta = target_pressure - output_starting_pressure
- var/transfer_moles1 = 0
- var/transfer_moles2 = 0
-
- if(air1.temperature > 0)
- transfer_moles1 = (node1_concentration*pressure_delta)*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
-
- if(air2.temperature > 0)
- transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
-
- var/air1_moles = air1.total_moles()
- var/air2_moles = air2.total_moles()
-
- if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
- var/ratio = 0
- if (( transfer_moles1 > 0 ) && (transfer_moles2 >0 ))
- ratio = min(air1_moles/transfer_moles1, air2_moles/transfer_moles2)
- if (( transfer_moles2 == 0 ) && ( transfer_moles1 > 0 ))
- ratio = air1_moles/transfer_moles1
- if (( transfer_moles1 == 0 ) && ( transfer_moles2 > 0 ))
- ratio = air2_moles/transfer_moles2
-
- transfer_moles1 *= ratio
- transfer_moles2 *= ratio
-
- //Actually transfer the gas
-
- if(transfer_moles1 > 0)
- var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1)
- air3.merge(removed1)
-
- if(transfer_moles2 > 0)
- var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2)
- air3.merge(removed2)
-
- if(network1 && transfer_moles1)
- network1.update = 1
-
- if(network2 && transfer_moles2)
- network2.update = 1
-
- if(network3)
- network3.update = 1
+ var/output_starting_pressure = air3.return_pressure()
+ if(output_starting_pressure >= target_pressure)
+ //No need to mix if target is already full!
return 1
- attack_hand(user as mob)
- if(..())
- return
- src.add_fingerprint(usr)
- if(!src.allowed(user))
- user << "\red Access denied."
- return
- usr.set_machine(src)
- var/dat = {"Power: [on?"On":"Off"]
- Desirable output pressure:
- [target_pressure]kPa | Change
-
- Node 1 Concentration:
- -
- -
- [node1_concentration]([node1_concentration*100]%)
- +
- +
-
- Node 2 Concentration:
- -
- -
- [node2_concentration]([node2_concentration*100]%)
- +
- +
- "}
+ //Calculate necessary moles to transfer using PV=nRT
- user << browse("[src.name] control[dat]", "window=atmo_mixer")
- onclose(user, "atmo_mixer")
- return
+ var/pressure_delta = target_pressure - output_starting_pressure
+ var/transfer_moles1 = 0
+ var/transfer_moles2 = 0
- Topic(href,href_list)
- if(..()) return
- if(href_list["power"])
- on = !on
- if(href_list["set_press"])
- var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
- src.target_pressure = max(0, min(4500, new_pressure))
- if(href_list["node1_c"])
- var/value = text2num(href_list["node1_c"])
- src.node1_concentration = max(0, min(1, src.node1_concentration + value))
- src.node2_concentration = max(0, min(1, src.node2_concentration - value))
- if(href_list["node2_c"])
- var/value = text2num(href_list["node2_c"])
- src.node2_concentration = max(0, min(1, src.node2_concentration + value))
- src.node1_concentration = max(0, min(1, src.node1_concentration - value))
- src.update_icon()
- src.updateUsrDialog()
+ if(air1.temperature > 0)
+ transfer_moles1 = (node1_concentration*pressure_delta)*air3.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
+
+ if(air2.temperature > 0)
+ transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
+
+ var/air1_moles = air1.total_moles()
+ var/air2_moles = air2.total_moles()
+
+ if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
+ var/ratio = 0
+ if (( transfer_moles1 > 0 ) && (transfer_moles2 >0 ))
+ ratio = min(air1_moles/transfer_moles1, air2_moles/transfer_moles2)
+ if (( transfer_moles2 == 0 ) && ( transfer_moles1 > 0 ))
+ ratio = air1_moles/transfer_moles1
+ if (( transfer_moles1 == 0 ) && ( transfer_moles2 > 0 ))
+ ratio = air2_moles/transfer_moles2
+
+ transfer_moles1 *= ratio
+ transfer_moles2 *= ratio
+
+ //Actually transfer the gas
+
+ if(transfer_moles1 > 0)
+ var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1)
+ air3.merge(removed1)
+
+ if(transfer_moles2 > 0)
+ var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2)
+ air3.merge(removed2)
+
+ if(network1 && transfer_moles1)
+ network1.update = 1
+
+ if(network2 && transfer_moles2)
+ network2.update = 1
+
+ if(network3)
+ network3.update = 1
+
+ return 1
+
+/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob)
+ if(..())
return
+ src.add_fingerprint(usr)
+ if(!src.allowed(user))
+ user << "\red Access denied."
+ return
+ usr.set_machine(src)
+ var/dat = {"Power: [on?"On":"Off"]
+ Desirable output pressure:
+ [target_pressure]kPa | Change
+
+ Node 1 Concentration:
+ -
+ -
+ [node1_concentration]([node1_concentration*100]%)
+ +
+ +
+
+ Node 2 Concentration:
+ -
+ -
+ [node2_concentration]([node2_concentration*100]%)
+ +
+ +
+ "}
+
+ user << browse("[src.name] control[dat]", "window=atmo_mixer")
+ onclose(user, "atmo_mixer")
+ return
+
+/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
+ if(..()) return
+ if(href_list["power"])
+ on = !on
+ if(href_list["set_press"])
+ var/new_pressure = input(usr,"Enter new output pressure (0-4500kPa)","Pressure control",src.target_pressure) as num
+ src.target_pressure = max(0, min(4500, new_pressure))
+ if(href_list["node1_c"])
+ var/value = text2num(href_list["node1_c"])
+ src.node1_concentration = max(0, min(1, src.node1_concentration + value))
+ src.node2_concentration = max(0, min(1, src.node2_concentration - value))
+ if(href_list["node2_c"])
+ var/value = text2num(href_list["node2_c"])
+ src.node2_concentration = max(0, min(1, src.node2_concentration + value))
+ src.node1_concentration = max(0, min(1, src.node1_concentration - value))
+ src.update_icon()
+ src.updateUsrDialog()
+ return
diff --git a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm
index 79af6de5272..deb86fb9f8e 100644
--- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm
@@ -1,4 +1,4 @@
-obj/machinery/atmospherics/trinary
+/obj/machinery/atmospherics/trinary
dir = SOUTH
initialize_directions = SOUTH|NORTH|WEST
use_power = 1
@@ -15,148 +15,148 @@ obj/machinery/atmospherics/trinary
var/datum/pipe_network/network2
var/datum/pipe_network/network3
- New()
- ..()
- switch(dir)
- if(NORTH)
- initialize_directions = EAST|NORTH|SOUTH
- if(SOUTH)
- initialize_directions = SOUTH|WEST|NORTH
- if(EAST)
- initialize_directions = EAST|WEST|SOUTH
- if(WEST)
- initialize_directions = WEST|NORTH|EAST
- air1 = new
- air2 = new
- air3 = new
+/obj/machinery/atmospherics/trinary/New()
+ ..()
+ switch(dir)
+ if(NORTH)
+ initialize_directions = EAST|NORTH|SOUTH
+ if(SOUTH)
+ initialize_directions = SOUTH|WEST|NORTH
+ if(EAST)
+ initialize_directions = EAST|WEST|SOUTH
+ if(WEST)
+ initialize_directions = WEST|NORTH|EAST
+ air1 = new
+ air2 = new
+ air3 = new
- air1.volume = 200
- air2.volume = 200
- air3.volume = 200
+ air1.volume = 200
+ air2.volume = 200
+ air3.volume = 200
// Housekeeping and pipe network stuff below
- network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
- if(reference == node1)
- network1 = new_network
+/obj/machinery/atmospherics/trinary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
+ if(reference == node1)
+ network1 = new_network
- else if(reference == node2)
- network2 = new_network
+ else if(reference == node2)
+ network2 = new_network
- else if (reference == node3)
- network3 = new_network
+ else if (reference == node3)
+ network3 = new_network
- if(new_network.normal_members.Find(src))
- return 0
+ if(new_network.normal_members.Find(src))
+ return 0
- new_network.normal_members += src
+ new_network.normal_members += src
- return null
+ return null
- Destroy()
- if(node1)
- node1.disconnect(src)
- del(network1)
- if(node2)
- node2.disconnect(src)
- del(network2)
- if(node3)
- node3.disconnect(src)
- del(network3)
+/obj/machinery/atmospherics/trinary/Destroy()
+ if(node1)
+ node1.disconnect(src)
+ del(network1)
+ if(node2)
+ node2.disconnect(src)
+ del(network2)
+ if(node3)
+ node3.disconnect(src)
+ del(network3)
+ node1 = null
+ node2 = null
+ node3 = null
+
+ ..()
+
+/obj/machinery/atmospherics/trinary/initialize()
+ src.disconnect(src)
+
+ var/node1_connect = turn(dir, -180)
+ var/node2_connect = turn(dir, -90)
+ var/node3_connect = dir
+
+ for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
+ if(target.initialize_directions & get_dir(target,src))
+ node1 = target
+ break
+
+ for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
+ if(target.initialize_directions & get_dir(target,src))
+ node2 = target
+ break
+
+ for(var/obj/machinery/atmospherics/target in get_step(src,node3_connect))
+ if(target.initialize_directions & get_dir(target,src))
+ node3 = target
+ break
+
+ update_icon()
+
+/obj/machinery/atmospherics/trinary/build_network()
+ if(!network1 && node1)
+ network1 = new /datum/pipe_network()
+ network1.normal_members += src
+ network1.build_network(node1, src)
+
+ if(!network2 && node2)
+ network2 = new /datum/pipe_network()
+ network2.normal_members += src
+ network2.build_network(node2, src)
+
+ if(!network3 && node3)
+ network3 = new /datum/pipe_network()
+ network3.normal_members += src
+ network3.build_network(node3, src)
+
+
+/obj/machinery/atmospherics/trinary/return_network(obj/machinery/atmospherics/reference)
+ build_network()
+
+ if(reference==node1)
+ return network1
+
+ if(reference==node2)
+ return network2
+
+ if(reference==node3)
+ return network3
+
+ return null
+
+/obj/machinery/atmospherics/trinary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
+ if(network1 == old_network)
+ network1 = new_network
+ if(network2 == old_network)
+ network2 = new_network
+ if(network3 == old_network)
+ network3 = new_network
+
+ return 1
+
+/obj/machinery/atmospherics/trinary/return_network_air(datum/pipe_network/reference)
+ var/list/results = list()
+
+ if(network1 == reference)
+ results += air1
+ if(network2 == reference)
+ results += air2
+ if(network3 == reference)
+ results += air3
+
+ return results
+
+/obj/machinery/atmospherics/trinary/disconnect(obj/machinery/atmospherics/reference)
+ if(reference==node1)
+ del(network1)
node1 = null
+
+ else if(reference==node2)
+ del(network2)
node2 = null
+
+ else if(reference==node3)
+ del(network3)
node3 = null
- ..()
-
- initialize()
- src.disconnect(src)
-
- var/node1_connect = turn(dir, -180)
- var/node2_connect = turn(dir, -90)
- var/node3_connect = dir
-
- for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
- if(target.initialize_directions & get_dir(target,src))
- node1 = target
- break
-
- for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
- if(target.initialize_directions & get_dir(target,src))
- node2 = target
- break
-
- for(var/obj/machinery/atmospherics/target in get_step(src,node3_connect))
- if(target.initialize_directions & get_dir(target,src))
- node3 = target
- break
-
- update_icon()
-
- build_network()
- if(!network1 && node1)
- network1 = new /datum/pipe_network()
- network1.normal_members += src
- network1.build_network(node1, src)
-
- if(!network2 && node2)
- network2 = new /datum/pipe_network()
- network2.normal_members += src
- network2.build_network(node2, src)
-
- if(!network3 && node3)
- network3 = new /datum/pipe_network()
- network3.normal_members += src
- network3.build_network(node3, src)
-
-
- return_network(obj/machinery/atmospherics/reference)
- build_network()
-
- if(reference==node1)
- return network1
-
- if(reference==node2)
- return network2
-
- if(reference==node3)
- return network3
-
- return null
-
- reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
- if(network1 == old_network)
- network1 = new_network
- if(network2 == old_network)
- network2 = new_network
- if(network3 == old_network)
- network3 = new_network
-
- return 1
-
- return_network_air(datum/pipe_network/reference)
- var/list/results = list()
-
- if(network1 == reference)
- results += air1
- if(network2 == reference)
- results += air2
- if(network3 == reference)
- results += air3
-
- return results
-
- disconnect(obj/machinery/atmospherics/reference)
- if(reference==node1)
- del(network1)
- node1 = null
-
- else if(reference==node2)
- del(network2)
- node2 = null
-
- else if(reference==node3)
- del(network3)
- node3 = null
-
- return null
\ No newline at end of file
+ return null
diff --git a/code/ATMOSPHERICS/components/unary/cold_sink.dm b/code/ATMOSPHERICS/components/unary/cold_sink.dm
index b3632c84a16..ea66aa52d4f 100644
--- a/code/ATMOSPHERICS/components/unary/cold_sink.dm
+++ b/code/ATMOSPHERICS/components/unary/cold_sink.dm
@@ -12,30 +12,30 @@
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
- update_icon()
- if(node)
- icon_state = "intact_[on?("on"):("off")]"
- else
- icon_state = "exposed"
+/obj/machinery/atmospherics/unary/cold_sink/update_icon()
+ if(node)
+ icon_state = "intact_[on?("on"):("off")]"
+ else
+ icon_state = "exposed"
- on = 0
+ on = 0
- return
+ return
- process()
- ..()
- if(!on || !network)
- return 0
- var/air_heat_capacity = air_contents.heat_capacity()
- var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
- var/old_temperature = air_contents.temperature
+/obj/machinery/atmospherics/unary/cold_sink/process()
+ ..()
+ if(!on || !network)
+ return 0
+ var/air_heat_capacity = air_contents.heat_capacity()
+ var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
+ var/old_temperature = air_contents.temperature
- if(combined_heat_capacity > 0)
- var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
- air_contents.temperature = combined_energy/combined_heat_capacity
+ if(combined_heat_capacity > 0)
+ var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
+ air_contents.temperature = combined_energy/combined_heat_capacity
- //todo: have current temperature affected. require power to bring down current temperature again
+ //todo: have current temperature affected. require power to bring down current temperature again
- if(abs(old_temperature-air_contents.temperature) > 1)
- network.update = 1
- return 1
\ No newline at end of file
+ if(abs(old_temperature-air_contents.temperature) > 1)
+ network.update = 1
+ return 1
diff --git a/code/ATMOSPHERICS/components/unary/generator_input.dm b/code/ATMOSPHERICS/components/unary/generator_input.dm
index 97714f1f6e3..8aa828e1174 100644
--- a/code/ATMOSPHERICS/components/unary/generator_input.dm
+++ b/code/ATMOSPHERICS/components/unary/generator_input.dm
@@ -8,14 +8,13 @@
var/update_cycle
- update_icon()
- if(node)
- icon_state = "intact"
- else
- icon_state = "exposed"
+/obj/machinery/atmospherics/unary/generator_input/update_icon()
+ if(node)
+ icon_state = "intact"
+ else
+ icon_state = "exposed"
- return
+ return
- proc
- return_exchange_air()
- return air_contents
\ No newline at end of file
+/obj/machinery/atmospherics/unary/generator_input/proc/return_exchange_air()
+ return air_contents
diff --git a/code/ATMOSPHERICS/components/unary/heat_exchanger.dm b/code/ATMOSPHERICS/components/unary/heat_exchanger.dm
index 017afeaf7e9..41b0ad9619c 100644
--- a/code/ATMOSPHERICS/components/unary/heat_exchanger.dm
+++ b/code/ATMOSPHERICS/components/unary/heat_exchanger.dm
@@ -12,57 +12,57 @@
var/obj/machinery/atmospherics/unary/heat_exchanger/partner = null
var/update_cycle
- update_icon()
- if(node)
- icon_state = "intact"
- else
- icon_state = "exposed"
+/obj/machinery/atmospherics/unary/heat_exchanger/update_icon()
+ if(node)
+ icon_state = "intact"
+ else
+ icon_state = "exposed"
- return
+ return
- initialize()
- if(!partner)
- var/partner_connect = turn(dir,180)
+/obj/machinery/atmospherics/unary/heat_exchanger/initialize()
+ if(!partner)
+ var/partner_connect = turn(dir,180)
- for(var/obj/machinery/atmospherics/unary/heat_exchanger/target in get_step(src,partner_connect))
- if(target.dir & get_dir(src,target))
- partner = target
- partner.partner = src
- break
+ for(var/obj/machinery/atmospherics/unary/heat_exchanger/target in get_step(src,partner_connect))
+ if(target.dir & get_dir(src,target))
+ partner = target
+ partner.partner = src
+ break
- ..()
+ ..()
- process()
- ..()
- if(!partner)
- return 0
+/obj/machinery/atmospherics/unary/heat_exchanger/process()
+ ..()
+ if(!partner)
+ return 0
- if(!air_master || air_master.current_cycle <= update_cycle)
- return 0
+ if(!air_master || air_master.current_cycle <= update_cycle)
+ return 0
- update_cycle = air_master.current_cycle
- partner.update_cycle = air_master.current_cycle
+ update_cycle = air_master.current_cycle
+ partner.update_cycle = air_master.current_cycle
- var/air_heat_capacity = air_contents.heat_capacity()
- var/other_air_heat_capacity = partner.air_contents.heat_capacity()
- var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
+ var/air_heat_capacity = air_contents.heat_capacity()
+ var/other_air_heat_capacity = partner.air_contents.heat_capacity()
+ var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
- var/old_temperature = air_contents.temperature
- var/other_old_temperature = partner.air_contents.temperature
+ var/old_temperature = air_contents.temperature
+ var/other_old_temperature = partner.air_contents.temperature
- if(combined_heat_capacity > 0)
- var/combined_energy = partner.air_contents.temperature*other_air_heat_capacity + air_heat_capacity*air_contents.temperature
+ if(combined_heat_capacity > 0)
+ var/combined_energy = partner.air_contents.temperature*other_air_heat_capacity + air_heat_capacity*air_contents.temperature
- var/new_temperature = combined_energy/combined_heat_capacity
- air_contents.temperature = new_temperature
- partner.air_contents.temperature = new_temperature
+ var/new_temperature = combined_energy/combined_heat_capacity
+ air_contents.temperature = new_temperature
+ partner.air_contents.temperature = new_temperature
- if(network)
- if(abs(old_temperature-air_contents.temperature) > 1)
- network.update = 1
+ if(network)
+ if(abs(old_temperature-air_contents.temperature) > 1)
+ network.update = 1
- if(partner.network)
- if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
- partner.network.update = 1
+ if(partner.network)
+ if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
+ partner.network.update = 1
- return 1
+ return 1
diff --git a/code/ATMOSPHERICS/components/unary/heat_source.dm b/code/ATMOSPHERICS/components/unary/heat_source.dm
index a19503b7b61..062bbd71110 100644
--- a/code/ATMOSPHERICS/components/unary/heat_source.dm
+++ b/code/ATMOSPHERICS/components/unary/heat_source.dm
@@ -14,30 +14,30 @@
var/current_temperature = T20C
var/current_heat_capacity = 50000 //totally random
- update_icon()
- if(node)
- icon_state = "intact_[on?("on"):("off")]"
- else
- icon_state = "exposed"
+/obj/machinery/atmospherics/unary/heat_reservoir/update_icon()
+ if(node)
+ icon_state = "intact_[on?("on"):("off")]"
+ else
+ icon_state = "exposed"
- on = 0
+ on = 0
- return
+ return
- process()
- ..()
- if(!on)
- return 0
- var/air_heat_capacity = air_contents.heat_capacity()
- var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
- var/old_temperature = air_contents.temperature
+/obj/machinery/atmospherics/unary/heat_reservoir/process()
+ ..()
+ if(!on)
+ return 0
+ var/air_heat_capacity = air_contents.heat_capacity()
+ var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
+ var/old_temperature = air_contents.temperature
- if(combined_heat_capacity > 0)
- var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
- air_contents.temperature = combined_energy/combined_heat_capacity
+ if(combined_heat_capacity > 0)
+ var/combined_energy = current_temperature*current_heat_capacity + air_heat_capacity*air_contents.temperature
+ air_contents.temperature = combined_energy/combined_heat_capacity
- //todo: have current temperature affected. require power to bring up current temperature again
+ //todo: have current temperature affected. require power to bring up current temperature again
- if(abs(old_temperature-air_contents.temperature) > 1)
- network.update = 1
- return 1
\ No newline at end of file
+ if(abs(old_temperature-air_contents.temperature) > 1)
+ network.update = 1
+ return 1
diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm
index 3a668a1dd0b..17d62269f5c 100644
--- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm
+++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm
@@ -3,7 +3,7 @@
icon_state = "off"
use_power = 1
- name = "air injector"
+ name = "Air Injector"
desc = "Has a valve and pump attached to it"
var/on = 0
@@ -17,134 +17,133 @@
level = 1
- update_icon()
- if(node)
- if(on && !(stat & NOPOWER))
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
- else
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+/obj/machinery/atmospherics/unary/outlet_injector/update_icon()
+ if(node)
+ if(on && !(stat & NOPOWER))
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
else
- icon_state = "exposed"
- on = 0
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ else
+ icon_state = "exposed"
+ on = 0
- return
+ return
- power_change()
- var/old_stat = stat
- ..()
- if(old_stat != stat)
- update_icon()
-
-
- process()
- ..()
- injecting = 0
-
- if(!on || stat & NOPOWER)
- return 0
-
- if(air_contents.temperature > 0)
- var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
-
- var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
-
- loc.assume_air(removed)
- air_update_turf()
-
- if(network)
- network.update = 1
-
- return 1
-
- proc/inject()
- if(on || injecting)
- return 0
-
- injecting = 1
-
- if(air_contents.temperature > 0)
- var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
-
- var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
-
- loc.assume_air(removed)
-
- if(network)
- network.update = 1
-
- flick("inject", src)
-
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- if(frequency)
- radio_connection = radio_controller.add_object(src, frequency)
-
- broadcast_status()
- if(!radio_connection)
- return 0
-
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
-
- signal.data = list(
- "tag" = id,
- "device" = "AO",
- "power" = on,
- "volume_rate" = volume_rate,
- //"timestamp" = world.time,
- "sigtype" = "status"
- )
-
- radio_connection.post_signal(src, signal)
-
- return 1
-
- initialize()
- ..()
-
- set_frequency(frequency)
- spawn(rand(25,50))
- broadcast_status()
-
- receive_signal(datum/signal/signal)
- if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
- return 0
-
- if("power" in signal.data)
- on = text2num(signal.data["power"])
-
- if("power_toggle" in signal.data)
- on = !on
-
- if("inject" in signal.data)
- spawn inject()
- return
-
- if("set_volume_rate" in signal.data)
- var/number = text2num(signal.data["set_volume_rate"])
- volume_rate = Clamp(number, 0, air_contents.volume)
-
- if("status" in signal.data)
- spawn(2)
- broadcast_status()
- return //do not update_icon
-
- //log_admin("DEBUG \[[world.timeofday]\]: outlet_injector/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
- //return
- spawn(2)
- broadcast_status()
+/obj/machinery/atmospherics/unary/outlet_injector/power_change()
+ var/old_stat = stat
+ ..()
+ if(old_stat != stat)
update_icon()
- hide(var/i) //to make the little pipe section invisible, the icon changes.
- if(node)
- if(on)
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
- else
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+
+/obj/machinery/atmospherics/unary/outlet_injector/process()
+ ..()
+ injecting = 0
+
+ if(!on || stat & NOPOWER)
+ return 0
+
+ if(air_contents.temperature > 0)
+ var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
+
+ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
+
+ loc.assume_air(removed)
+ air_update_turf()
+
+ if(network)
+ network.update = 1
+
+ return 1
+
+/obj/machinery/atmospherics/unary/outlet_injector/proc/inject()
+ if(on || injecting)
+ return 0
+
+ injecting = 1
+
+ if(air_contents.temperature > 0)
+ var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
+
+ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
+
+ loc.assume_air(removed)
+
+ if(network)
+ network.update = 1
+
+ flick("inject", src)
+
+/obj/machinery/atmospherics/unary/outlet_injector/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ if(frequency)
+ radio_connection = radio_controller.add_object(src, frequency)
+
+/obj/machinery/atmospherics/unary/outlet_injector/proc/broadcast_status()
+ if(!radio_connection)
+ return 0
+
+ var/datum/signal/signal = new
+ signal.transmission_method = 1 //radio signal
+ signal.source = src
+
+ signal.data = list(
+ "tag" = id,
+ "device" = "AO",
+ "power" = on,
+ "volume_rate" = volume_rate,
+ //"timestamp" = world.time,
+ "sigtype" = "status"
+ )
+
+ radio_connection.post_signal(src, signal)
+
+ return 1
+
+/obj/machinery/atmospherics/unary/outlet_injector/initialize()
+ ..()
+
+ set_frequency(frequency)
+ spawn(rand(25,50))
+ broadcast_status()
+
+/obj/machinery/atmospherics/unary/outlet_injector/receive_signal(datum/signal/signal)
+ if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
+ return 0
+
+ if("power" in signal.data)
+ on = text2num(signal.data["power"])
+
+ if("power_toggle" in signal.data)
+ on = !on
+
+ if("inject" in signal.data)
+ spawn inject()
+ return
+
+ if("set_volume_rate" in signal.data)
+ var/number = text2num(signal.data["set_volume_rate"])
+ volume_rate = Clamp(number, 0, air_contents.volume)
+
+ if("status" in signal.data)
+ spawn(2)
+ broadcast_status()
+ return //do not update_icon
+
+ //log_admin("DEBUG \[[world.timeofday]\]: outlet_injector/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
+ //return
+ spawn(2)
+ broadcast_status()
+ update_icon()
+
+/obj/machinery/atmospherics/unary/outlet_injector/hide(var/i) //to make the little pipe section invisible, the icon changes.
+ if(node)
+ if(on)
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
else
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]exposed"
- on = 0
- return
\ No newline at end of file
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ else
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]exposed"
+ on = 0
+ return
diff --git a/code/ATMOSPHERICS/components/unary/oxygen_generator.dm b/code/ATMOSPHERICS/components/unary/oxygen_generator.dm
index f87b9982ce0..cbbb91683fd 100644
--- a/code/ATMOSPHERICS/components/unary/oxygen_generator.dm
+++ b/code/ATMOSPHERICS/components/unary/oxygen_generator.dm
@@ -1,4 +1,4 @@
-obj/machinery/atmospherics/unary/oxygen_generator
+/obj/machinery/atmospherics/unary/oxygen_generator
icon = 'icons/obj/atmospherics/oxygen_generator.dmi'
icon_state = "intact_off"
density = 1
@@ -13,37 +13,37 @@ obj/machinery/atmospherics/unary/oxygen_generator
var/oxygen_content = 10
- update_icon()
- if(node)
- icon_state = "intact_[on?("on"):("off")]"
- else
- icon_state = "exposed_off"
+/obj/machinery/atmospherics/unary/oxygen_generator/update_icon()
+ if(node)
+ icon_state = "intact_[on?("on"):("off")]"
+ else
+ icon_state = "exposed_off"
- on = 0
+ on = 0
- return
+ return
- New()
- ..()
+/obj/machinery/atmospherics/unary/oxygen_generator/New()
+ ..()
- air_contents.volume = 50
+ air_contents.volume = 50
- process()
- ..()
- if(!on)
- return 0
+/obj/machinery/atmospherics/unary/oxygen_generator/process()
+ ..()
+ if(!on)
+ return 0
- var/total_moles = air_contents.total_moles()
+ var/total_moles = air_contents.total_moles()
- if(total_moles < oxygen_content)
- var/current_heat_capacity = air_contents.heat_capacity()
+ if(total_moles < oxygen_content)
+ var/current_heat_capacity = air_contents.heat_capacity()
- var/added_oxygen = oxygen_content - total_moles
+ var/added_oxygen = oxygen_content - total_moles
- air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
- air_contents.oxygen += added_oxygen
+ air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
+ air_contents.oxygen += added_oxygen
- if(network)
- network.update = 1
+ if(network)
+ network.update = 1
- return 1
\ No newline at end of file
+ return 1
diff --git a/code/ATMOSPHERICS/components/unary/unary_base.dm b/code/ATMOSPHERICS/components/unary/unary_base.dm
index 118c036c1ee..07465402083 100644
--- a/code/ATMOSPHERICS/components/unary/unary_base.dm
+++ b/code/ATMOSPHERICS/components/unary/unary_base.dm
@@ -9,91 +9,91 @@
var/datum/pipe_network/network
- New()
- ..()
- initialize_directions = dir
- air_contents = new
+/obj/machinery/atmospherics/unary/New()
+ ..()
+ initialize_directions = dir
+ air_contents = new
- air_contents.volume = 200
+ air_contents.volume = 200
// Housekeeping and pipe network stuff below
- network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
- if(reference == node)
- network = new_network
+/obj/machinery/atmospherics/unary/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
+ if(reference == node)
+ network = new_network
- if(new_network.normal_members.Find(src))
- return 0
+ if(new_network.normal_members.Find(src))
+ return 0
- new_network.normal_members += src
+ new_network.normal_members += src
- return null
+ return null
- Destroy()
- if(node)
- node.disconnect(src)
- del(network)
+/obj/machinery/atmospherics/unary/Destroy()
+ if(node)
+ node.disconnect(src)
+ del(network)
- node = null
+ node = null
- ..()
+ ..()
- initialize(infiniteloop = 0)
- if(!infiniteloop)
- src.disconnect(src)
+/obj/machinery/atmospherics/unary/initialize(infiniteloop = 0)
+ if(!infiniteloop)
+ src.disconnect(src)
- var/node_connect = dir
-
- for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
- if(target.initialize_directions & get_dir(target,src))
- node = target
- if(!infiniteloop)
- target.initialize(1)
- break
- build_network()
-
- update_icon()
-
- default_change_direction_wrench(mob/user, obj/item/weapon/wrench/W)
- if(..())
- initialize_directions = dir
- if(node)
- disconnect(node)
- initialize()
- . = 1
+ var/node_connect = dir
+ for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
+ if(target.initialize_directions & get_dir(target,src))
+ node = target
+ if(!infiniteloop)
+ target.initialize(1)
+ break
build_network()
- if(!network && node)
- network = new /datum/pipe_network()
- network.normal_members += src
- network.build_network(node, src)
+
+ update_icon()
+
+/obj/machinery/atmospherics/unary/default_change_direction_wrench(mob/user, obj/item/weapon/wrench/W)
+ if(..())
+ initialize_directions = dir
+ if(node)
+ disconnect(node)
+ initialize()
+ . = 1
+
+/obj/machinery/atmospherics/unary/build_network()
+ if(!network && node)
+ network = new /datum/pipe_network()
+ network.normal_members += src
+ network.build_network(node, src)
- return_network(obj/machinery/atmospherics/reference)
- build_network()
+/obj/machinery/atmospherics/unary/return_network(obj/machinery/atmospherics/reference)
+ build_network()
- if(reference==node)
- return network
+ if(reference==node)
+ return network
- return null
+ return null
- reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
- if(network == old_network)
- network = new_network
+/obj/machinery/atmospherics/unary/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
+ if(network == old_network)
+ network = new_network
- return 1
+ return 1
- return_network_air(datum/pipe_network/reference)
- var/list/results = list()
+/obj/machinery/atmospherics/unary/return_network_air(datum/pipe_network/reference)
+ var/list/results = list()
- if(network == reference)
- results += air_contents
+ if(network == reference)
+ results += air_contents
- return results
+ return results
- disconnect(obj/machinery/atmospherics/reference)
- if(reference==node)
- node = null
- reference.disconnect(src)
- del(network)
+/obj/machinery/atmospherics/unary/disconnect(obj/machinery/atmospherics/reference)
+ if(reference==node)
+ node = null
+ reference.disconnect(src)
+ del(network)
- return null
\ No newline at end of file
+ return null
diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm
index 348ab417363..fbf61bec3d9 100644
--- a/code/ATMOSPHERICS/components/unary/vent_pump.dm
+++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm
@@ -32,286 +32,286 @@
var/radio_filter_out
var/radio_filter_in
- on
- on = 1
- icon_state = "out"
+/obj/machinery/atmospherics/unary/vent_pump/on
+ on = 1
+ icon_state = "out"
- siphon
- pump_direction = 0
- icon_state = "off"
+/obj/machinery/atmospherics/unary/vent_pump/siphon
+ pump_direction = 0
+ icon_state = "off"
- on
- on = 1
- icon_state = "in"
+/obj/machinery/atmospherics/unary/vent_pump/siphon/on
+ on = 1
+ icon_state = "in"
- New()
- ..()
- initial_loc = get_area(loc)
- if (initial_loc.master)
- initial_loc = initial_loc.master
- area_uid = initial_loc.uid
- if (!id_tag)
- assign_uid()
- id_tag = num2text(uid)
- if(ticker && ticker.current_state == 3)//if the game is running
- src.initialize()
- src.broadcast_status()
+/obj/machinery/atmospherics/unary/vent_pump/New()
+ ..()
+ initial_loc = get_area(loc)
+ if (initial_loc.master)
+ initial_loc = initial_loc.master
+ area_uid = initial_loc.uid
+ if (!id_tag)
+ assign_uid()
+ id_tag = num2text(uid)
+ if(ticker && ticker.current_state == 3)//if the game is running
+ src.initialize()
+ src.broadcast_status()
- high_volume
- name = "large air vent"
- power_channel = EQUIP
- New()
- ..()
- air_contents.volume = 1000
+/obj/machinery/atmospherics/unary/vent_pump/high_volume
+ name = "large air vent"
+ power_channel = EQUIP
- update_icon()
- if(welded)
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]weld"
- return
- if(on && !(stat & (NOPOWER|BROKEN)))
- if(pump_direction)
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
- else
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+/obj/machinery/atmospherics/unary/vent_pump/high_volume/New()
+ ..()
+ air_contents.volume = 1000
+
+/obj/machinery/atmospherics/unary/vent_pump/update_icon()
+ if(welded)
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]weld"
+ return
+ if(on && !(stat & (NOPOWER|BROKEN)))
+ if(pump_direction)
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
else
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+ else
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ return
+
+/obj/machinery/atmospherics/unary/vent_pump/process()
+ ..()
+ if(stat & (NOPOWER|BROKEN))
+ return
+ if (!node)
+ on = 0
+ //broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
+ if(!on)
+ return 0
+
+ if(welded)
+ return 0
+
+ var/datum/gas_mixture/environment = loc.return_air()
+ var/environment_pressure = environment.return_pressure()
+
+ if(pump_direction) //internal -> external
+ var/pressure_delta = 10000
+
+ if(pressure_checks&1)
+ pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
+ if(pressure_checks&2)
+ pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
+
+ if(pressure_delta > 0)
+ if(air_contents.temperature > 0)
+ var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
+
+ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
+
+ loc.assume_air(removed)
+ air_update_turf()
+
+ if(network)
+ network.update = 1
+
+ else //external -> internal
+ var/pressure_delta = 10000
+ if(pressure_checks&1)
+ pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
+ if(pressure_checks&2)
+ pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure()))
+
+ if(pressure_delta > 0)
+ if(environment.temperature > 0)
+ var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
+
+ var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
+ if (isnull(removed)) //in space
+ return
+
+ air_contents.merge(removed)
+ air_update_turf()
+
+ if(network)
+ network.update = 1
+
+ return 1
+
+//Radio remote control
+
+/obj/machinery/atmospherics/unary/vent_pump/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ if(frequency)
+ radio_connection = radio_controller.add_object(src, frequency,radio_filter_in)
+
+/obj/machinery/atmospherics/unary/vent_pump/proc/broadcast_status()
+ if(!radio_connection)
+ return 0
+
+ var/datum/signal/signal = new
+ signal.transmission_method = 1 //radio signal
+ signal.source = src
+
+ signal.data = list(
+ "area" = src.area_uid,
+ "tag" = src.id_tag,
+ "device" = "AVP",
+ "power" = on,
+ "direction" = pump_direction?("release"):("siphon"),
+ "checks" = pressure_checks,
+ "internal" = internal_pressure_bound,
+ "external" = external_pressure_bound,
+ "timestamp" = world.time,
+ "sigtype" = "status"
+ )
+
+ if(!initial_loc.air_vent_names[id_tag])
+ var/new_name = "\improper [initial_loc.name] vent pump #[initial_loc.air_vent_names.len+1]"
+ initial_loc.air_vent_names[id_tag] = new_name
+ src.name = new_name
+ initial_loc.air_vent_info[id_tag] = signal.data
+
+ radio_connection.post_signal(src, signal, radio_filter_out)
+
+ return 1
+
+
+/obj/machinery/atmospherics/unary/vent_pump/initialize()
+ ..()
+
+ //some vents work his own spesial way
+ radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null
+ radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null
+ if(frequency)
+ set_frequency(frequency)
+
+/obj/machinery/atmospherics/unary/vent_pump/receive_signal(datum/signal/signal)
+ if(stat & (NOPOWER|BROKEN))
+ return
+ //log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
+ if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
+ return 0
+
+ if("purge" in signal.data)
+ pressure_checks &= ~1
+ pump_direction = 0
+
+ if("stabalize" in signal.data)
+ pressure_checks |= 1
+ pump_direction = 1
+
+ if("power" in signal.data)
+ on = text2num(signal.data["power"])
+
+ if("power_toggle" in signal.data)
+ on = !on
+
+ if("checks" in signal.data)
+ pressure_checks = text2num(signal.data["checks"])
+
+ if("checks_toggle" in signal.data)
+ pressure_checks = (pressure_checks?0:3)
+
+ if("direction" in signal.data)
+ pump_direction = text2num(signal.data["direction"])
+
+ if("set_internal_pressure" in signal.data)
+ internal_pressure_bound = Clamp(
+ text2num(signal.data["set_internal_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("adjust_internal_pressure" in signal.data)
+ internal_pressure_bound = Clamp(
+ internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
+ 0,
+ ONE_ATMOSPHERE*50
+ )
+
+ if("adjust_external_pressure" in signal.data)
+ external_pressure_bound = Clamp(
+ external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
+ 0,
+ ONE_ATMOSPHERE*50
+ )
+
+ if("init" in signal.data)
+ name = signal.data["init"]
return
- process()
- ..()
- if(stat & (NOPOWER|BROKEN))
- return
- if (!node)
- on = 0
- //broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
- if(!on)
- return 0
-
- if(welded)
- return 0
-
- var/datum/gas_mixture/environment = loc.return_air()
- var/environment_pressure = environment.return_pressure()
-
- if(pump_direction) //internal -> external
- var/pressure_delta = 10000
-
- if(pressure_checks&1)
- pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
- if(pressure_checks&2)
- pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
-
- if(pressure_delta > 0)
- if(air_contents.temperature > 0)
- var/transfer_moles = pressure_delta*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
-
- var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
-
- loc.assume_air(removed)
- air_update_turf()
-
- if(network)
- network.update = 1
-
- else //external -> internal
- var/pressure_delta = 10000
- if(pressure_checks&1)
- pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
- if(pressure_checks&2)
- pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure()))
-
- if(pressure_delta > 0)
- if(environment.temperature > 0)
- var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION)
-
- var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
- if (isnull(removed)) //in space
- return
-
- air_contents.merge(removed)
- air_update_turf()
-
- if(network)
- network.update = 1
-
- return 1
-
- //Radio remote control
-
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- if(frequency)
- radio_connection = radio_controller.add_object(src, frequency,radio_filter_in)
-
- broadcast_status()
- if(!radio_connection)
- return 0
-
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
-
- signal.data = list(
- "area" = src.area_uid,
- "tag" = src.id_tag,
- "device" = "AVP",
- "power" = on,
- "direction" = pump_direction?("release"):("siphon"),
- "checks" = pressure_checks,
- "internal" = internal_pressure_bound,
- "external" = external_pressure_bound,
- "timestamp" = world.time,
- "sigtype" = "status"
- )
-
- if(!initial_loc.air_vent_names[id_tag])
- var/new_name = "\improper [initial_loc.name] vent pump #[initial_loc.air_vent_names.len+1]"
- initial_loc.air_vent_names[id_tag] = new_name
- src.name = new_name
- initial_loc.air_vent_info[id_tag] = signal.data
-
- radio_connection.post_signal(src, signal, radio_filter_out)
-
- return 1
-
-
- initialize()
- ..()
-
- //some vents work his own spesial way
- radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null
- radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null
- if(frequency)
- set_frequency(frequency)
-
- receive_signal(datum/signal/signal)
- if(stat & (NOPOWER|BROKEN))
- return
- //log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
- if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
- return 0
-
- if("purge" in signal.data)
- pressure_checks &= ~1
- pump_direction = 0
-
- if("stabalize" in signal.data)
- pressure_checks |= 1
- pump_direction = 1
-
- if("power" in signal.data)
- on = text2num(signal.data["power"])
-
- if("power_toggle" in signal.data)
- on = !on
-
- if("checks" in signal.data)
- pressure_checks = text2num(signal.data["checks"])
-
- if("checks_toggle" in signal.data)
- pressure_checks = (pressure_checks?0:3)
-
- if("direction" in signal.data)
- pump_direction = text2num(signal.data["direction"])
-
- if("set_internal_pressure" in signal.data)
- internal_pressure_bound = Clamp(
- text2num(signal.data["set_internal_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("adjust_internal_pressure" in signal.data)
- internal_pressure_bound = Clamp(
- internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
- 0,
- ONE_ATMOSPHERE*50
- )
-
- if("adjust_external_pressure" in signal.data)
- external_pressure_bound = Clamp(
- external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
- 0,
- ONE_ATMOSPHERE*50
- )
-
- if("init" in signal.data)
- name = signal.data["init"]
- return
-
- if("status" in signal.data)
- spawn(2)
- broadcast_status()
- return //do not update_icon
-
- //log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
+ if("status" in signal.data)
spawn(2)
broadcast_status()
- update_icon()
- return
+ return //do not update_icon
- hide(var/i) //to make the little pipe section invisible, the icon changes.
- if(welded)
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]weld"
- return
- if(on&&node)
- if(pump_direction)
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
- else
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+ //log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
+ spawn(2)
+ broadcast_status()
+ update_icon()
+ return
+
+/obj/machinery/atmospherics/unary/vent_pump/hide(var/i) //to make the little pipe section invisible, the icon changes.
+ if(welded)
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]weld"
+ return
+ if(on&&node)
+ if(pump_direction)
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]out"
else
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
- on = 0
- return
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+ else
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ on = 0
+ return
- attackby(obj/item/W, mob/user)
- if (istype(W, /obj/item/weapon/wrench)&& !(stat & NOPOWER) && on)
- user << "\red You cannot unwrench this [src], turn it off first."
- return 1
- if(istype(W, /obj/item/weapon/weldingtool))
- var/obj/item/weapon/weldingtool/WT = W
- if (WT.remove_fuel(0,user))
- user << "\blue Now welding the vent."
- if(do_after(user, 20))
- if(!src || !WT.isOn()) return
- playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
- if(!welded)
- user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
- welded = 1
- update_icon()
- else
- user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
- welded = 0
- update_icon()
+/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user)
+ if (istype(W, /obj/item/weapon/wrench)&& !(stat & NOPOWER) && on)
+ user << "\red You cannot unwrench this [src], turn it off first."
+ return 1
+ if(istype(W, /obj/item/weapon/weldingtool))
+ var/obj/item/weapon/weldingtool/WT = W
+ if (WT.remove_fuel(0,user))
+ user << "\blue Now welding the vent."
+ if(do_after(user, 20))
+ if(!src || !WT.isOn()) return
+ playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
+ if(!welded)
+ user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
+ welded = 1
+ update_icon()
else
- user << "\blue The welding tool needs to be on to start this task."
+ user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
+ welded = 0
+ update_icon()
else
- user << "\blue You need more welding fuel to complete this task."
- return 1
+ user << "\blue The welding tool needs to be on to start this task."
else
- return ..()
+ user << "\blue You need more welding fuel to complete this task."
+ return 1
+ else
+ return ..()
- examine()
- set src in oview(1)
- ..()
- if(welded)
- usr << "It seems welded shut."
+/obj/machinery/atmospherics/unary/vent_pump/examine()
+ set src in oview(1)
+ ..()
+ if(welded)
+ usr << "It seems welded shut."
- power_change()
- if(powered(power_channel))
- stat &= ~NOPOWER
- else
- stat |= NOPOWER
+/obj/machinery/atmospherics/unary/vent_pump/power_change()
+ if(powered(power_channel))
+ stat &= ~NOPOWER
+ else
+ stat |= NOPOWER
update_icon()
/obj/machinery/atmospherics/unary/vent_pump/Destroy()
diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm
index 5ca05a05941..fcba70665d8 100644
--- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm
+++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm
@@ -28,229 +28,228 @@
var/radio_filter_out
var/radio_filter_in
- New()
- ..()
- initial_loc = get_area(loc)
- if (initial_loc.master)
- initial_loc = initial_loc.master
- area_uid = initial_loc.uid
- if (!id_tag)
- assign_uid()
- id_tag = num2text(uid)
- if(ticker && ticker.current_state == 3)//if the game is running
- src.initialize()
- src.broadcast_status()
-
- update_icon()
- if(node && on && !(stat & (NOPOWER|BROKEN)))
- if(scrubbing)
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
- else
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
- else
- icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
- return
-
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- radio_connection = radio_controller.add_object(src, frequency, radio_filter_in)
-
- broadcast_status()
- if(!radio_connection)
- return 0
-
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
- signal.data = list(
- "area" = area_uid,
- "tag" = id_tag,
- "device" = "AScr",
- "timestamp" = world.time,
- "power" = on,
- "scrubbing" = scrubbing,
- "panic" = panic,
- "filter_co2" = scrub_CO2,
- "filter_toxins" = scrub_Toxins,
- "filter_n2o" = scrub_N2O,
- "sigtype" = "status"
- )
- if(!initial_loc.air_scrub_names[id_tag])
- var/new_name = "\improper [initial_loc.name] air scrubber #[initial_loc.air_scrub_names.len+1]"
- initial_loc.air_scrub_names[id_tag] = new_name
- src.name = new_name
- initial_loc.air_scrub_info[id_tag] = signal.data
- radio_connection.post_signal(src, signal, radio_filter_out)
-
- return 1
-
- initialize()
- ..()
- radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
- radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
- if (frequency)
- set_frequency(frequency)
-
- process()
- ..()
- if(stat & (NOPOWER|BROKEN))
- return
- if (!node)
- on = 0
- //broadcast_status()
- if(!on)
- return 0
-
-
- var/datum/gas_mixture/environment = loc.return_air()
+/obj/machinery/atmospherics/unary/vent_scrubber/New()
+ ..()
+ initial_loc = get_area(loc)
+ if (initial_loc.master)
+ initial_loc = initial_loc.master
+ area_uid = initial_loc.uid
+ if (!id_tag)
+ assign_uid()
+ id_tag = num2text(uid)
+ if(ticker && ticker.current_state == 3)//if the game is running
+ src.initialize()
+ src.broadcast_status()
+/obj/machinery/atmospherics/unary/vent_scrubber/update_icon()
+ if(node && on && !(stat & (NOPOWER|BROKEN)))
if(scrubbing)
- if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0))
- var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
+ else
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+ else
+ icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ return
- //Take a gas sample
- var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
- if (isnull(removed)) //in space
- return
+/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ radio_connection = radio_controller.add_object(src, frequency, radio_filter_in)
- //Filter it
- var/datum/gas_mixture/filtered_out = new
- filtered_out.temperature = removed.temperature
- if(scrub_Toxins)
- filtered_out.toxins = removed.toxins
- removed.toxins = 0
- if(scrub_CO2)
- filtered_out.carbon_dioxide = removed.carbon_dioxide
- removed.carbon_dioxide = 0
+/obj/machinery/atmospherics/unary/vent_scrubber/proc/broadcast_status()
+ if(!radio_connection)
+ return 0
- if(removed.trace_gases.len>0)
- for(var/datum/gas/trace_gas in removed.trace_gases)
- if(istype(trace_gas, /datum/gas/oxygen_agent_b))
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
- else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
+ var/datum/signal/signal = new
+ signal.transmission_method = 1 //radio signal
+ signal.source = src
+ signal.data = list(
+ "area" = area_uid,
+ "tag" = id_tag,
+ "device" = "AScr",
+ "timestamp" = world.time,
+ "power" = on,
+ "scrubbing" = scrubbing,
+ "panic" = panic,
+ "filter_co2" = scrub_CO2,
+ "filter_toxins" = scrub_Toxins,
+ "filter_n2o" = scrub_N2O,
+ "sigtype" = "status"
+ )
+ if(!initial_loc.air_scrub_names[id_tag])
+ var/new_name = "\improper [initial_loc.name] air scrubber #[initial_loc.air_scrub_names.len+1]"
+ initial_loc.air_scrub_names[id_tag] = new_name
+ src.name = new_name
+ initial_loc.air_scrub_info[id_tag] = signal.data
+ radio_connection.post_signal(src, signal, radio_filter_out)
+
+ return 1
+
+/obj/machinery/atmospherics/unary/vent_scrubber/initialize()
+ ..()
+ radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
+ radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
+ if (frequency)
+ set_frequency(frequency)
+
+/obj/machinery/atmospherics/unary/vent_scrubber/process()
+ ..()
+ if(stat & (NOPOWER|BROKEN))
+ return
+ if (!node)
+ on = 0
+ //broadcast_status()
+ if(!on)
+ return 0
- //Remix the resulting gases
- air_contents.merge(filtered_out)
+ var/datum/gas_mixture/environment = loc.return_air()
- loc.assume_air(removed)
- air_update_turf()
+ if(scrubbing)
+ if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0))
+ var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
- if(network)
- network.update = 1
-
- else //Just siphoning all air
- if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
+ //Take a gas sample
+ var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
+ if (isnull(removed)) //in space
return
- var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume)
+ //Filter it
+ var/datum/gas_mixture/filtered_out = new
+ filtered_out.temperature = removed.temperature
+ if(scrub_Toxins)
+ filtered_out.toxins = removed.toxins
+ removed.toxins = 0
+ if(scrub_CO2)
+ filtered_out.carbon_dioxide = removed.carbon_dioxide
+ removed.carbon_dioxide = 0
- var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
+ if(removed.trace_gases.len>0)
+ for(var/datum/gas/trace_gas in removed.trace_gases)
+ if(istype(trace_gas, /datum/gas/oxygen_agent_b))
+ removed.trace_gases -= trace_gas
+ filtered_out.trace_gases += trace_gas
+ else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
+ removed.trace_gases -= trace_gas
+ filtered_out.trace_gases += trace_gas
- air_contents.merge(removed)
+
+ //Remix the resulting gases
+ air_contents.merge(filtered_out)
+
+ loc.assume_air(removed)
air_update_turf()
if(network)
network.update = 1
- return 1
+ else //Just siphoning all air
+ if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
+ return
+
+ var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume)
+
+ var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
+
+ air_contents.merge(removed)
+ air_update_turf()
+
+ if(network)
+ network.update = 1
+
+ return 1
/* //unused piece of code
- hide(var/i) //to make the little pipe section invisible, the icon changes.
- if(on&&node)
- if(scrubbing)
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
- else
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+/obj/machinery/atmospherics/unary/vent_scrubber/hide(var/i) //to make the little pipe section invisible, the icon changes.
+ if(on&&node)
+ if(scrubbing)
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
else
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
- on = 0
- return
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
+ else
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
+ on = 0
+ return
*/
- receive_signal(datum/signal/signal)
- if(stat & (NOPOWER|BROKEN))
- return
- if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
- return 0
+/obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal)
+ if(stat & (NOPOWER|BROKEN))
+ return
+ if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
+ return 0
- if("power" in signal.data)
- on = text2num(signal.data["power"])
- if("power_toggle" in signal.data)
- on = !on
+ if("power" in signal.data)
+ on = text2num(signal.data["power"])
+ if("power_toggle" in signal.data)
+ on = !on
- if("panic_siphon" in signal.data) //must be before if("scrubbing" thing
- panic = text2num(signal.data["panic_siphon"])
- if(panic)
- on = 1
- scrubbing = 0
- volume_rate = 2000
- else
- scrubbing = 1
- volume_rate = initial(volume_rate)
- if("toggle_panic_siphon" in signal.data)
- panic = !panic
- if(panic)
- on = 1
- scrubbing = 0
- volume_rate = 2000
- else
- scrubbing = 1
- volume_rate = initial(volume_rate)
+ if("panic_siphon" in signal.data) //must be before if("scrubbing" thing
+ panic = text2num(signal.data["panic_siphon"])
+ if(panic)
+ on = 1
+ scrubbing = 0
+ volume_rate = 2000
+ else
+ scrubbing = 1
+ volume_rate = initial(volume_rate)
+ if("toggle_panic_siphon" in signal.data)
+ panic = !panic
+ if(panic)
+ on = 1
+ scrubbing = 0
+ volume_rate = 2000
+ else
+ scrubbing = 1
+ volume_rate = initial(volume_rate)
- if("scrubbing" in signal.data)
- scrubbing = text2num(signal.data["scrubbing"])
- if("toggle_scrubbing" in signal.data)
- scrubbing = !scrubbing
+ if("scrubbing" in signal.data)
+ scrubbing = text2num(signal.data["scrubbing"])
+ if("toggle_scrubbing" in signal.data)
+ scrubbing = !scrubbing
- if("co2_scrub" in signal.data)
- scrub_CO2 = text2num(signal.data["co2_scrub"])
- if("toggle_co2_scrub" in signal.data)
- scrub_CO2 = !scrub_CO2
+ if("co2_scrub" in signal.data)
+ scrub_CO2 = text2num(signal.data["co2_scrub"])
+ if("toggle_co2_scrub" in signal.data)
+ scrub_CO2 = !scrub_CO2
- if("tox_scrub" in signal.data)
- scrub_Toxins = text2num(signal.data["tox_scrub"])
- if("toggle_tox_scrub" in signal.data)
- scrub_Toxins = !scrub_Toxins
+ if("tox_scrub" in signal.data)
+ scrub_Toxins = text2num(signal.data["tox_scrub"])
+ if("toggle_tox_scrub" in signal.data)
+ scrub_Toxins = !scrub_Toxins
- if("n2o_scrub" in signal.data)
- scrub_N2O = text2num(signal.data["n2o_scrub"])
- if("toggle_n2o_scrub" in signal.data)
- scrub_N2O = !scrub_N2O
+ if("n2o_scrub" in signal.data)
+ scrub_N2O = text2num(signal.data["n2o_scrub"])
+ if("toggle_n2o_scrub" in signal.data)
+ scrub_N2O = !scrub_N2O
- if("init" in signal.data)
- name = signal.data["init"]
- return
-
- if("status" in signal.data)
- spawn(2)
- broadcast_status()
- return //do not update_icon
-
-// log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
- spawn(2)
- broadcast_status()
- update_icon()
+ if("init" in signal.data)
+ name = signal.data["init"]
return
- power_change()
- if(powered(power_channel))
- stat &= ~NOPOWER
- else
- stat |= NOPOWER
- update_icon()
+ if("status" in signal.data)
+ spawn(2)
+ broadcast_status()
+ return //do not update_icon
- attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
- if (!istype(W, /obj/item/weapon/wrench))
- return ..()
- if (!(stat & NOPOWER) && on)
- user << "\red You cannot unwrench this [src], turn it off first."
- return 1
+// log_admin("DEBUG \[[world.timeofday]\]: vent_scrubber/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]")
+ spawn(2)
+ broadcast_status()
+ update_icon()
+ return
+
+/obj/machinery/atmospherics/unary/vent_scrubber/power_change()
+ if(powered(power_channel))
+ stat &= ~NOPOWER
+ else
+ stat |= NOPOWER
+ update_icon()
+
+/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
+ if (!istype(W, /obj/item/weapon/wrench))
return ..()
+ if (!(stat & NOPOWER) && on)
+ user << "\red You cannot unwrench this [src], turn it off first."
+ return 1
+ return ..()
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
if(initial_loc)
diff --git a/code/ATMOSPHERICS/components/valve.dm b/code/ATMOSPHERICS/components/valve.dm
index c67f47a403a..cb2af13543f 100644
--- a/code/ATMOSPHERICS/components/valve.dm
+++ b/code/ATMOSPHERICS/components/valve.dm
@@ -1,4 +1,4 @@
-obj/machinery/atmospherics/valve
+/obj/machinery/atmospherics/valve
icon = 'icons/obj/atmospherics/valve.dmi'
icon_state = "valve0"
@@ -18,295 +18,294 @@ obj/machinery/atmospherics/valve
var/datum/pipe_network/network_node1
var/datum/pipe_network/network_node2
+ var/frequency = 0
+ var/id = null
+ var/datum/radio_frequency/radio_connection
- open
- open = 1
- icon_state = "valve1"
+/obj/machinery/atmospherics/valve/open
+ open = 1
+ icon_state = "valve1"
- update_icon(animation)
- if(animation)
- flick("valve[src.open][!src.open]",src)
- else
- icon_state = "valve[open]"
+/obj/machinery/atmospherics/valve/update_icon(animation)
+ if(animation)
+ flick("valve[src.open][!src.open]",src)
+ else
+ icon_state = "valve[open]"
- New()
- ..()
- switch(dir)
- if(NORTH || SOUTH)
- initialize_directions = NORTH|SOUTH
- if(EAST || WEST)
- initialize_directions = EAST|WEST
+/obj/machinery/atmospherics/valve/New()
+ ..()
+ switch(dir)
+ if(NORTH || SOUTH)
+ initialize_directions = NORTH|SOUTH
+ if(EAST || WEST)
+ initialize_directions = EAST|WEST
- network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
+/obj/machinery/atmospherics/valve/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
- if(reference == node1)
- network_node1 = new_network
- if(open)
- network_node2 = new_network
- else if(reference == node2)
- network_node2 = new_network
- if(open)
- network_node1 = new_network
-
- if(new_network.normal_members.Find(src))
- return 0
-
- new_network.normal_members += src
-
+ if(reference == node1)
+ network_node1 = new_network
if(open)
- if(reference == node1)
- if(node2)
- return node2.network_expand(new_network, src)
- else if(reference == node2)
- if(node1)
- return node1.network_expand(new_network, src)
+ network_node2 = new_network
+ else if(reference == node2)
+ network_node2 = new_network
+ if(open)
+ network_node1 = new_network
- return null
+ if(new_network.normal_members.Find(src))
+ return 0
- Destroy()
- if(node1)
- node1.disconnect(src)
- del(network_node1)
- if(node2)
- node2.disconnect(src)
- del(network_node2)
+ new_network.normal_members += src
- node1 = null
- node2 = null
+ if(open)
+ if(reference == node1)
+ if(node2)
+ return node2.network_expand(new_network, src)
+ else if(reference == node2)
+ if(node1)
+ return node1.network_expand(new_network, src)
- ..()
+ return null
- proc/open()
+/obj/machinery/atmospherics/valve/Destroy()
+ if(node1)
+ node1.disconnect(src)
+ del(network_node1)
+ if(node2)
+ node2.disconnect(src)
+ del(network_node2)
- if(open) return 0
+ node1 = null
+ node2 = null
- open = 1
- update_icon()
+ ..()
- if(network_node1&&network_node2)
- network_node1.merge(network_node2)
- network_node2 = network_node1
+/obj/machinery/atmospherics/valve/proc/open()
- if(network_node1)
- network_node1.update = 1
- else if(network_node2)
- network_node2.update = 1
+ if(open) return 0
- return 1
+ open = 1
+ update_icon()
- proc/close()
+ if(network_node1&&network_node2)
+ network_node1.merge(network_node2)
+ network_node2 = network_node1
- if(!open)
- return 0
+ if(network_node1)
+ network_node1.update = 1
+ else if(network_node2)
+ network_node2.update = 1
- open = 0
- update_icon()
+ return 1
- if(network_node1)
- del(network_node1)
- if(network_node2)
- del(network_node2)
+/obj/machinery/atmospherics/valve/proc/close()
- build_network()
+ if(!open)
+ return 0
- return 1
+ open = 0
+ update_icon()
- proc/normalize_dir()
- if(dir==3)
- dir = 1
- else if(dir==12)
- dir = 4
+ if(network_node1)
+ del(network_node1)
+ if(network_node2)
+ del(network_node2)
- attack_ai(mob/user as mob)
- return
+ build_network()
- attack_paw(mob/user as mob)
- return attack_hand(user)
+ return 1
- attack_hand(mob/user as mob)
- src.add_fingerprint(usr)
- update_icon(1)
- sleep(10)
- if (src.open)
- src.close()
- else
- src.open()
+/obj/machinery/atmospherics/valve/proc/normalize_dir()
+ if(dir==3)
+ dir = 1
+ else if(dir==12)
+ dir = 4
- process()
- ..()
- . = PROCESS_KILL
+/obj/machinery/atmospherics/valve/attack_ai(mob/user as mob)
+ return
-/* if(open && (!node1 || !node2))
- close()
- if(!node1)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
- else if (!node2)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
- else if (nodealert)
- nodealert = 0
+/obj/machinery/atmospherics/valve/attack_paw(mob/user as mob)
+ return attack_hand(user)
+
+obj/machinery/atmospherics/valve/attack_hand(mob/user as mob)
+ src.add_fingerprint(usr)
+ update_icon(1)
+ sleep(10)
+ if (src.open)
+ src.close()
+ else
+ src.open()
+
+/obj/machinery/atmospherics/valve/process()
+ ..()
+ . = PROCESS_KILL
+
+/* if(open && (!node1 || !node2))
+ close()
+ if(!node1)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
+ else if (!node2)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
+ else if (nodealert)
+ nodealert = 0
*/
- return
+ return
- initialize()
- normalize_dir()
+/obj/machinery/atmospherics/valve/initialize()
+ normalize_dir()
- var/node1_dir
- var/node2_dir
+ var/node1_dir
+ var/node2_dir
- for(var/direction in cardinal)
- if(direction&initialize_directions)
- if (!node1_dir)
- node1_dir = direction
- else if (!node2_dir)
- node2_dir = direction
+ for(var/direction in cardinal)
+ if(direction&initialize_directions)
+ if (!node1_dir)
+ node1_dir = direction
+ else if (!node2_dir)
+ node2_dir = direction
- for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
- if(target.initialize_directions & get_dir(target,src))
- node1 = target
- break
- for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
- if(target.initialize_directions & get_dir(target,src))
- node2 = target
- break
+ for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
+ if(target.initialize_directions & get_dir(target,src))
+ node1 = target
+ break
+ for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
+ if(target.initialize_directions & get_dir(target,src))
+ node2 = target
+ break
- build_network()
+ build_network()
- if(openDuringInit)
- close()
- open()
- openDuringInit = 0
+ if(openDuringInit)
+ close()
+ open()
+ openDuringInit = 0
/*
- var/connect_directions
- switch(dir)
- if(NORTH)
- connect_directions = NORTH|SOUTH
- if(SOUTH)
- connect_directions = NORTH|SOUTH
- if(EAST)
- connect_directions = EAST|WEST
- if(WEST)
- connect_directions = EAST|WEST
- else
- connect_directions = dir
+ var/connect_directions
+ switch(dir)
+ if(NORTH)
+ connect_directions = NORTH|SOUTH
+ if(SOUTH)
+ connect_directions = NORTH|SOUTH
+ if(EAST)
+ connect_directions = EAST|WEST
+ if(WEST)
+ connect_directions = EAST|WEST
+ else
+ connect_directions = dir
- for(var/direction in cardinal)
- if(direction&connect_directions)
- for(var/obj/machinery/atmospherics/target in get_step(src,direction))
- if(target.initialize_directions & get_dir(target,src))
- connect_directions &= ~direction
- node1 = target
- break
- if(node1)
+ for(var/direction in cardinal)
+ if(direction&connect_directions)
+ for(var/obj/machinery/atmospherics/target in get_step(src,direction))
+ if(target.initialize_directions & get_dir(target,src))
+ connect_directions &= ~direction
+ node1 = target
break
+ if(node1)
+ break
- for(var/direction in cardinal)
- if(direction&connect_directions)
- for(var/obj/machinery/atmospherics/target in get_step(src,direction))
- if(target.initialize_directions & get_dir(target,src))
- node2 = target
- break
- if(node1)
+ for(var/direction in cardinal)
+ if(direction&connect_directions)
+ for(var/obj/machinery/atmospherics/target in get_step(src,direction))
+ if(target.initialize_directions & get_dir(target,src))
+ node2 = target
break
+ if(node1)
+ break
*/
+/obj/machinery/atmospherics/valve/build_network()
+ if(!network_node1 && node1)
+ network_node1 = new /datum/pipe_network()
+ network_node1.normal_members += src
+ network_node1.build_network(node1, src)
+
+ if(!network_node2 && node2)
+ network_node2 = new /datum/pipe_network()
+ network_node2.normal_members += src
+ network_node2.build_network(node2, src)
+
+
+/obj/machinery/atmospherics/valve/return_network(obj/machinery/atmospherics/reference)
build_network()
- if(!network_node1 && node1)
- network_node1 = new /datum/pipe_network()
- network_node1.normal_members += src
- network_node1.build_network(node1, src)
- if(!network_node2 && node2)
- network_node2 = new /datum/pipe_network()
- network_node2.normal_members += src
- network_node2.build_network(node2, src)
+ if(reference==node1)
+ return network_node1
+ if(reference==node2)
+ return network_node2
- return_network(obj/machinery/atmospherics/reference)
- build_network()
+ return null
- if(reference==node1)
- return network_node1
+/obj/machinery/atmospherics/valve/reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
+ if(network_node1 == old_network)
+ network_node1 = new_network
+ if(network_node2 == old_network)
+ network_node2 = new_network
- if(reference==node2)
- return network_node2
+ return 1
- return null
+/obj/machinery/atmospherics/valve/return_network_air(datum/network/reference)
+ return null
- reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network)
- if(network_node1 == old_network)
- network_node1 = new_network
- if(network_node2 == old_network)
- network_node2 = new_network
+/obj/machinery/atmospherics/valve/disconnect(obj/machinery/atmospherics/reference)
+ if(reference==node1)
+ del(network_node1)
+ node1 = null
- return 1
+ else if(reference==node2)
+ del(network_node2)
+ node2 = null
- return_network_air(datum/network/reference)
- return null
+ return null
- disconnect(obj/machinery/atmospherics/reference)
- if(reference==node1)
- del(network_node1)
- node1 = null
+/obj/machinery/atmospherics/valve/digital // can be controlled by AI
+ name = "digital valve"
+ desc = "A digitally controlled valve."
+ icon = 'icons/obj/atmospherics/digital_valve.dmi'
- else if(reference==node2)
- del(network_node2)
- node2 = null
+/obj/machinery/atmospherics/valve/digital/attack_ai(mob/user as mob)
+ return src.attack_hand(user)
- return null
+/obj/machinery/atmospherics/valve/digital/attack_hand(mob/user as mob)
+ if(!src.allowed(user))
+ user << "\red Access denied."
+ return
+ ..()
- digital // can be controlled by AI
- name = "digital valve"
- desc = "A digitally controlled valve."
- icon = 'icons/obj/atmospherics/digital_valve.dmi'
+//Radio remote control
- attack_ai(mob/user as mob)
- return src.attack_hand(user)
+/obj/machinery/atmospherics/valve/digital/proc
+ set_frequency(new_frequency)
+ radio_controller.remove_object(src, frequency)
+ frequency = new_frequency
+ if(frequency)
+ radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
- attack_hand(mob/user as mob)
- if(!src.allowed(user))
- user << "\red Access denied."
- return
- ..()
+/obj/machinery/atmospherics/valve/digital/initialize()
+ ..()
+ if(frequency)
+ set_frequency(frequency)
- //Radio remote control
+/obj/machinery/atmospherics/valve/digital/receive_signal(datum/signal/signal)
+ if(!signal.data["tag"] || (signal.data["tag"] != id))
+ return 0
- proc
- set_frequency(new_frequency)
- radio_controller.remove_object(src, frequency)
- frequency = new_frequency
- if(frequency)
- radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
+ switch(signal.data["command"])
+ if("valve_open")
+ if(!open)
+ open()
- var/frequency = 0
- var/id = null
- var/datum/radio_frequency/radio_connection
+ if("valve_close")
+ if(open)
+ close()
- initialize()
- ..()
- if(frequency)
- set_frequency(frequency)
-
- receive_signal(datum/signal/signal)
- if(!signal.data["tag"] || (signal.data["tag"] != id))
- return 0
-
- switch(signal.data["command"])
- if("valve_open")
- if(!open)
- open()
-
- if("valve_close")
- if(open)
- close()
-
- if("valve_toggle")
- if(open)
- close()
- else
- open()
+ if("valve_toggle")
+ if(open)
+ close()
+ else
+ open()
diff --git a/code/ATMOSPHERICS/datum_pipe_network.dm b/code/ATMOSPHERICS/datum_pipe_network.dm
index ce74f6cfbfc..7956edb5a34 100644
--- a/code/ATMOSPHERICS/datum_pipe_network.dm
+++ b/code/ATMOSPHERICS/datum_pipe_network.dm
@@ -1,6 +1,6 @@
var/global/list/datum/pipe_network/pipe_networks = list()
-datum/pipe_network
+/datum/pipe_network
var/list/datum/gas_mixture/gases = list() //All of the gas_mixtures continuously connected in this network
var/list/obj/machinery/atmospherics/normal_members = list()
@@ -10,135 +10,135 @@ datum/pipe_network
var/update = 1
var/datum/gas_mixture/air_transient = null
- New()
- air_transient = new()
+/datum/pipe_network/New()
+ air_transient = new()
- ..()
+ ..()
- proc/process()
- //Equalize gases amongst pipe if called for
- if(update)
- update = 0
- reconcile_air() //equalize_gases(gases)
+/datum/pipe_network/proc/process()
+ //Equalize gases amongst pipe if called for
+ if(update)
+ update = 0
+ reconcile_air() //equalize_gases(gases)
- //Give pipelines their process call for pressure checking and what not. Have to remove pressure checks for the time being as pipes dont radiate heat - Mport
- //for(var/datum/pipeline/line_member in line_members)
- // line_member.process()
+ //Give pipelines their process call for pressure checking and what not. Have to remove pressure checks for the time being as pipes dont radiate heat - Mport
+ //for(var/datum/pipeline/line_member in line_members)
+ // line_member.process()
- proc/build_network(obj/machinery/atmospherics/start_normal, obj/machinery/atmospherics/reference)
- //Purpose: Generate membership roster
- //Notes: Assuming that members will add themselves to appropriate roster in network_expand()
+/datum/pipe_network/proc/build_network(obj/machinery/atmospherics/start_normal, obj/machinery/atmospherics/reference)
+ //Purpose: Generate membership roster
+ //Notes: Assuming that members will add themselves to appropriate roster in network_expand()
- if(!start_normal)
- del(src)
+ if(!start_normal)
+ del(src)
- start_normal.network_expand(src, reference)
+ start_normal.network_expand(src, reference)
- update_network_gases()
+ update_network_gases()
+
+ if((normal_members.len>0)||(line_members.len>0))
+ pipe_networks += src
+ else
+ del(src)
+
+/datum/pipe_network/proc/merge(datum/pipe_network/giver)
+ if(giver==src) return 0
+
+ normal_members -= giver.normal_members
+ normal_members += giver.normal_members
+
+ line_members -= giver.line_members
+ line_members += giver.line_members
+
+ for(var/obj/machinery/atmospherics/normal_member in giver.normal_members)
+ normal_member.reassign_network(giver, src)
+
+ for(var/datum/pipeline/line_member in giver.line_members)
+ line_member.network = src
+
+ del(giver)
+
+ update_network_gases()
+ return 1
+
+/datum/pipe_network/proc/update_network_gases()
+ //Go through membership roster and make sure gases is up to date
+
+ gases = list()
+
+ for(var/obj/machinery/atmospherics/normal_member in normal_members)
+ var/result = normal_member.return_network_air(src)
+ if(result) gases += result
+
+ for(var/datum/pipeline/line_member in line_members)
+ gases += line_member.air
+
+/datum/pipe_network/proc/reconcile_air()
+ //Perfectly equalize all gases members instantly
+
+ //Calculate totals from individual components
+ var/total_thermal_energy = 0
+ var/total_heat_capacity = 0
+
+ air_transient.volume = 0
+
+ air_transient.oxygen = 0
+ air_transient.nitrogen = 0
+ air_transient.toxins = 0
+ air_transient.carbon_dioxide = 0
+
+
+ air_transient.trace_gases = list()
+
+ for(var/datum/gas_mixture/gas in gases)
+ air_transient.volume += gas.volume
+ total_thermal_energy += gas.thermal_energy()
+ total_heat_capacity += gas.heat_capacity()
+
+ air_transient.oxygen += gas.oxygen
+ air_transient.nitrogen += gas.nitrogen
+ air_transient.toxins += gas.toxins
+ air_transient.carbon_dioxide += gas.carbon_dioxide
+
+ if(gas.trace_gases.len)
+ for(var/datum/gas/trace_gas in gas.trace_gases)
+ var/datum/gas/corresponding = locate(trace_gas.type) in air_transient.trace_gases
+ if(!corresponding)
+ corresponding = new trace_gas.type()
+ air_transient.trace_gases += corresponding
+
+ corresponding.moles += trace_gas.moles
+
+ if(air_transient.volume > 0)
+
+ if(total_heat_capacity > 0)
+ air_transient.temperature = total_thermal_energy/total_heat_capacity
+
+ //Allow air mixture to react
+ if(air_transient.react())
+ update = 1
- if((normal_members.len>0)||(line_members.len>0))
- pipe_networks += src
else
- del(src)
-
- proc/merge(datum/pipe_network/giver)
- if(giver==src) return 0
-
- normal_members -= giver.normal_members
- normal_members += giver.normal_members
-
- line_members -= giver.line_members
- line_members += giver.line_members
-
- for(var/obj/machinery/atmospherics/normal_member in giver.normal_members)
- normal_member.reassign_network(giver, src)
-
- for(var/datum/pipeline/line_member in giver.line_members)
- line_member.network = src
-
- del(giver)
-
- update_network_gases()
- return 1
-
- proc/update_network_gases()
- //Go through membership roster and make sure gases is up to date
-
- gases = list()
-
- for(var/obj/machinery/atmospherics/normal_member in normal_members)
- var/result = normal_member.return_network_air(src)
- if(result) gases += result
-
- for(var/datum/pipeline/line_member in line_members)
- gases += line_member.air
-
- proc/reconcile_air()
- //Perfectly equalize all gases members instantly
-
- //Calculate totals from individual components
- var/total_thermal_energy = 0
- var/total_heat_capacity = 0
-
- air_transient.volume = 0
-
- air_transient.oxygen = 0
- air_transient.nitrogen = 0
- air_transient.toxins = 0
- air_transient.carbon_dioxide = 0
-
-
- air_transient.trace_gases = list()
+ air_transient.temperature = 0
+ //Update individual gas_mixtures by volume ratio
for(var/datum/gas_mixture/gas in gases)
- air_transient.volume += gas.volume
- total_thermal_energy += gas.thermal_energy()
- total_heat_capacity += gas.heat_capacity()
+ gas.oxygen = air_transient.oxygen*gas.volume/air_transient.volume
+ gas.nitrogen = air_transient.nitrogen*gas.volume/air_transient.volume
+ gas.toxins = air_transient.toxins*gas.volume/air_transient.volume
+ gas.carbon_dioxide = air_transient.carbon_dioxide*gas.volume/air_transient.volume
- air_transient.oxygen += gas.oxygen
- air_transient.nitrogen += gas.nitrogen
- air_transient.toxins += gas.toxins
- air_transient.carbon_dioxide += gas.carbon_dioxide
+ gas.temperature = air_transient.temperature
- if(gas.trace_gases.len)
- for(var/datum/gas/trace_gas in gas.trace_gases)
- var/datum/gas/corresponding = locate(trace_gas.type) in air_transient.trace_gases
+ if(air_transient.trace_gases.len)
+ for(var/datum/gas/trace_gas in air_transient.trace_gases)
+ var/datum/gas/corresponding = locate(trace_gas.type) in gas.trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
- air_transient.trace_gases += corresponding
+ gas.trace_gases += corresponding
- corresponding.moles += trace_gas.moles
-
- if(air_transient.volume > 0)
-
- if(total_heat_capacity > 0)
- air_transient.temperature = total_thermal_energy/total_heat_capacity
-
- //Allow air mixture to react
- if(air_transient.react())
- update = 1
-
- else
- air_transient.temperature = 0
-
- //Update individual gas_mixtures by volume ratio
- for(var/datum/gas_mixture/gas in gases)
- gas.oxygen = air_transient.oxygen*gas.volume/air_transient.volume
- gas.nitrogen = air_transient.nitrogen*gas.volume/air_transient.volume
- gas.toxins = air_transient.toxins*gas.volume/air_transient.volume
- gas.carbon_dioxide = air_transient.carbon_dioxide*gas.volume/air_transient.volume
-
- gas.temperature = air_transient.temperature
-
- if(air_transient.trace_gases.len)
- for(var/datum/gas/trace_gas in air_transient.trace_gases)
- var/datum/gas/corresponding = locate(trace_gas.type) in gas.trace_gases
- if(!corresponding)
- corresponding = new trace_gas.type()
- gas.trace_gases += corresponding
-
- corresponding.moles = trace_gas.moles*gas.volume/air_transient.volume
- return 1
+ corresponding.moles = trace_gas.moles*gas.volume/air_transient.volume
+ return 1
proc/equalize_gases(datum/gas_mixture/list/gases)
//Perfectly equalize all gases members instantly
diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm
index b9eb1d29a89..1d9e9e2d21a 100644
--- a/code/ATMOSPHERICS/datum_pipeline.dm
+++ b/code/ATMOSPHERICS/datum_pipeline.dm
@@ -1,4 +1,4 @@
-datum/pipeline
+/datum/pipeline
var/datum/gas_mixture/air
var/list/obj/machinery/atmospherics/pipe/members
@@ -8,187 +8,187 @@ datum/pipeline
var/alert_pressure = 0
- Del()
- if(network)
- del(network)
+/datum/pipeline/Del()
+ if(network)
+ del(network)
- if(air && air.volume)
- temporarily_store_air()
- del(air)
+ if(air && air.volume)
+ temporarily_store_air()
+ del(air)
- ..()
+ ..()
- proc/process()//This use to be called called from the pipe networks
-
- //Check to see if pressure is within acceptable limits
- var/pressure = air.return_pressure()
- if(pressure > alert_pressure)
- for(var/obj/machinery/atmospherics/pipe/member in members)
- if(!member.check_pressure(pressure))
- break //Only delete 1 pipe per process
-
- //Allow for reactions
- //air.react() //Should be handled by pipe_network now
-
- proc/temporarily_store_air()
- //Update individual gas_mixtures by volume ratio
+/datum/pipeline/proc/process()//This use to be called called from the pipe networks
+ //Check to see if pressure is within acceptable limits
+ var/pressure = air.return_pressure()
+ if(pressure > alert_pressure)
for(var/obj/machinery/atmospherics/pipe/member in members)
- member.air_temporary = new
- member.air_temporary.volume = member.volume
+ if(!member.check_pressure(pressure))
+ break //Only delete 1 pipe per process
- member.air_temporary.oxygen = air.oxygen*member.volume/air.volume
- member.air_temporary.nitrogen = air.nitrogen*member.volume/air.volume
- member.air_temporary.toxins = air.toxins*member.volume/air.volume
- member.air_temporary.carbon_dioxide = air.carbon_dioxide*member.volume/air.volume
+ //Allow for reactions
+ //air.react() //Should be handled by pipe_network now
- member.air_temporary.temperature = air.temperature
+/datum/pipeline/proc/temporarily_store_air()
+ //Update individual gas_mixtures by volume ratio
- if(air.trace_gases.len)
- for(var/datum/gas/trace_gas in air.trace_gases)
- var/datum/gas/corresponding = new trace_gas.type()
- member.air_temporary.trace_gases += corresponding
+ for(var/obj/machinery/atmospherics/pipe/member in members)
+ member.air_temporary = new
+ member.air_temporary.volume = member.volume
- corresponding.moles = trace_gas.moles*member.volume/air.volume
+ member.air_temporary.oxygen = air.oxygen*member.volume/air.volume
+ member.air_temporary.nitrogen = air.nitrogen*member.volume/air.volume
+ member.air_temporary.toxins = air.toxins*member.volume/air.volume
+ member.air_temporary.carbon_dioxide = air.carbon_dioxide*member.volume/air.volume
- proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
+ member.air_temporary.temperature = air.temperature
+
+ if(air.trace_gases.len)
+ for(var/datum/gas/trace_gas in air.trace_gases)
+ var/datum/gas/corresponding = new trace_gas.type()
+ member.air_temporary.trace_gases += corresponding
+
+ corresponding.moles = trace_gas.moles*member.volume/air.volume
+
+/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
+ air = new
+
+ var/list/possible_expansions = list(base)
+ members = list(base)
+ edges = list()
+
+ var/volume = base.volume
+ base.parent = src
+ alert_pressure = base.alert_pressure
+
+ if(base.air_temporary)
+ air = base.air_temporary
+ base.air_temporary = null
+ else
air = new
- var/list/possible_expansions = list(base)
- members = list(base)
- edges = list()
+ while(possible_expansions.len>0)
+ for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
- var/volume = base.volume
- base.parent = src
- alert_pressure = base.alert_pressure
+ var/list/result = borderline.pipeline_expansion()
+ var/edge_check = result.len
- if(base.air_temporary)
- air = base.air_temporary
- base.air_temporary = null
- else
- air = new
+ if(result.len>0)
+ for(var/obj/machinery/atmospherics/pipe/item in result)
+ if(!members.Find(item))
+ members += item
+ possible_expansions += item
- while(possible_expansions.len>0)
- for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
+ volume += item.volume
+ item.parent = src
- var/list/result = borderline.pipeline_expansion()
- var/edge_check = result.len
+ alert_pressure = min(alert_pressure, item.alert_pressure)
- if(result.len>0)
- for(var/obj/machinery/atmospherics/pipe/item in result)
- if(!members.Find(item))
- members += item
- possible_expansions += item
+ if(item.air_temporary)
+ air.merge(item.air_temporary)
- volume += item.volume
- item.parent = src
+ edge_check--
- alert_pressure = min(alert_pressure, item.alert_pressure)
+ if(edge_check>0)
+ edges += borderline
- if(item.air_temporary)
- air.merge(item.air_temporary)
+ possible_expansions -= borderline
- edge_check--
+ air.volume = volume
- if(edge_check>0)
- edges += borderline
+/datum/pipeline/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
- possible_expansions -= borderline
+ if(new_network.line_members.Find(src))
+ return 0
- air.volume = volume
+ new_network.line_members += src
- proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
+ network = new_network
- if(new_network.line_members.Find(src))
- return 0
+ for(var/obj/machinery/atmospherics/pipe/edge in edges)
+ for(var/obj/machinery/atmospherics/result in edge.pipeline_expansion())
+ if(!istype(result,/obj/machinery/atmospherics/pipe) && (result!=reference))
+ result.network_expand(new_network, edge)
- new_network.line_members += src
+ return 1
- network = new_network
+/datum/pipeline/proc/return_network(obj/machinery/atmospherics/reference)
+ if(!network)
+ network = new /datum/pipe_network()
+ network.build_network(src, null)
+ //technically passing these parameters should not be allowed
+ //however pipe_network.build_network(..) and pipeline.network_extend(...)
+ // were setup to properly handle this case
- for(var/obj/machinery/atmospherics/pipe/edge in edges)
- for(var/obj/machinery/atmospherics/result in edge.pipeline_expansion())
- if(!istype(result,/obj/machinery/atmospherics/pipe) && (result!=reference))
- result.network_expand(new_network, edge)
+ return network
- return 1
+/datum/pipeline/proc/mingle_with_turf(turf/simulated/target, mingle_volume)
+ var/datum/gas_mixture/air_sample = air.remove_ratio(mingle_volume/air.volume)
+ air_sample.volume = mingle_volume
- proc/return_network(obj/machinery/atmospherics/reference)
- if(!network)
- network = new /datum/pipe_network()
- network.build_network(src, null)
- //technically passing these parameters should not be allowed
- //however pipe_network.build_network(..) and pipeline.network_extend(...)
- // were setup to properly handle this case
+ var/datum/gas_mixture/turf_air = target.return_air()
- return network
+ equalize_gases(list(air_sample, turf_air))
+ air.merge(air_sample)
+ //turf_air already modified by equalize_gases()
- proc/mingle_with_turf(turf/simulated/target, mingle_volume)
- var/datum/gas_mixture/air_sample = air.remove_ratio(mingle_volume/air.volume)
- air_sample.volume = mingle_volume
+ if(istype(target))
+ if(target.air)
+ if(target.air.check_tile_graphic())
+ target.update_visuals(target.air)
+ if(network)
+ network.update = 1
- var/datum/gas_mixture/turf_air = target.return_air()
+/datum/pipeline/proc/temperature_interact(turf/target, share_volume, thermal_conductivity)
+ var/total_heat_capacity = air.heat_capacity()
+ var/partial_heat_capacity = total_heat_capacity*(share_volume/air.volume)
- equalize_gases(list(air_sample, turf_air))
- air.merge(air_sample)
- //turf_air already modified by equalize_gases()
+ if(istype(target, /turf/simulated))
+ var/turf/simulated/modeled_location = target
- if(istype(target))
- if(target.air)
- if(target.air.check_tile_graphic())
- target.update_visuals(target.air)
- if(network)
- network.update = 1
+ if(modeled_location.blocks_air)
- proc/temperature_interact(turf/target, share_volume, thermal_conductivity)
- var/total_heat_capacity = air.heat_capacity()
- var/partial_heat_capacity = total_heat_capacity*(share_volume/air.volume)
-
- if(istype(target, /turf/simulated))
- var/turf/simulated/modeled_location = target
-
- if(modeled_location.blocks_air)
-
- if((modeled_location.heat_capacity>0) && (partial_heat_capacity>0))
- var/delta_temperature = air.temperature - modeled_location.temperature
-
- var/heat = thermal_conductivity*delta_temperature* \
- (partial_heat_capacity*modeled_location.heat_capacity/(partial_heat_capacity+modeled_location.heat_capacity))
-
- air.temperature -= heat/total_heat_capacity
- modeled_location.temperature += heat/modeled_location.heat_capacity
-
- else
- var/delta_temperature = 0
- var/sharer_heat_capacity = 0
-
- delta_temperature = (air.temperature - modeled_location.air.temperature)
- sharer_heat_capacity = modeled_location.air.heat_capacity()
-
- var/self_temperature_delta = 0
- var/sharer_temperature_delta = 0
-
- if((sharer_heat_capacity>0) && (partial_heat_capacity>0))
- var/heat = thermal_conductivity*delta_temperature* \
- (partial_heat_capacity*sharer_heat_capacity/(partial_heat_capacity+sharer_heat_capacity))
-
- self_temperature_delta = -heat/total_heat_capacity
- sharer_temperature_delta = heat/sharer_heat_capacity
- else
- return 1
-
- air.temperature += self_temperature_delta
-
- modeled_location.air.temperature += sharer_temperature_delta
-
-
- else
- if((target.heat_capacity>0) && (partial_heat_capacity>0))
- var/delta_temperature = air.temperature - target.temperature
+ if((modeled_location.heat_capacity>0) && (partial_heat_capacity>0))
+ var/delta_temperature = air.temperature - modeled_location.temperature
var/heat = thermal_conductivity*delta_temperature* \
- (partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity))
+ (partial_heat_capacity*modeled_location.heat_capacity/(partial_heat_capacity+modeled_location.heat_capacity))
air.temperature -= heat/total_heat_capacity
- if(network)
- network.update = 1
\ No newline at end of file
+ modeled_location.temperature += heat/modeled_location.heat_capacity
+
+ else
+ var/delta_temperature = 0
+ var/sharer_heat_capacity = 0
+
+ delta_temperature = (air.temperature - modeled_location.air.temperature)
+ sharer_heat_capacity = modeled_location.air.heat_capacity()
+
+ var/self_temperature_delta = 0
+ var/sharer_temperature_delta = 0
+
+ if((sharer_heat_capacity>0) && (partial_heat_capacity>0))
+ var/heat = thermal_conductivity*delta_temperature* \
+ (partial_heat_capacity*sharer_heat_capacity/(partial_heat_capacity+sharer_heat_capacity))
+
+ self_temperature_delta = -heat/total_heat_capacity
+ sharer_temperature_delta = heat/sharer_heat_capacity
+ else
+ return 1
+
+ air.temperature += self_temperature_delta
+
+ modeled_location.air.temperature += sharer_temperature_delta
+
+
+ else
+ if((target.heat_capacity>0) && (partial_heat_capacity>0))
+ var/delta_temperature = air.temperature - target.temperature
+
+ var/heat = thermal_conductivity*delta_temperature* \
+ (partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity))
+
+ air.temperature -= heat/total_heat_capacity
+ if(network)
+ network.update = 1
\ No newline at end of file
diff --git a/code/ATMOSPHERICS/he_pipes.dm b/code/ATMOSPHERICS/he_pipes.dm
index 556800d1efc..c1cd3304c8e 100644
--- a/code/ATMOSPHERICS/he_pipes.dm
+++ b/code/ATMOSPHERICS/he_pipes.dm
@@ -1,5 +1,5 @@
-obj/machinery/atmospherics/pipe/simple/heat_exchanging
+/obj/machinery/atmospherics/pipe/simple/heat_exchanging
icon = 'icons/obj/pipes/heat.dmi'
icon_state = "intact"
level = 2
@@ -8,99 +8,99 @@ obj/machinery/atmospherics/pipe/simple/heat_exchanging
minimum_temperature_difference = 20
thermal_conductivity = WINDOW_HEAT_TRANSFER_COEFFICIENT
- // BubbleWrap
- New()
+// BubbleWrap
+/obj/machinery/atmospherics/pipe/simple/heat_exchanging/New()
+ ..()
+ initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
+// BubbleWrap END
+
+/obj/machinery/atmospherics/pipe/simple/heat_exchanging/initialize()
+ normalize_dir()
+ var/node1_dir
+ var/node2_dir
+
+ for(var/direction in cardinal)
+ if(direction&initialize_directions_he)
+ if (!node1_dir)
+ node1_dir = direction
+ else if (!node2_dir)
+ node2_dir = direction
+
+ for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir))
+ if(target.initialize_directions_he & get_dir(target,src))
+ node1 = target
+ break
+ for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir))
+ if(target.initialize_directions_he & get_dir(target,src))
+ node2 = target
+ break
+ update_icon()
+ return
+
+
+/obj/machinery/atmospherics/pipe/simple/heat_exchanging/process()
+ if(!parent)
..()
- initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
- // BubbleWrap END
-
- initialize()
- normalize_dir()
- var/node1_dir
- var/node2_dir
-
- for(var/direction in cardinal)
- if(direction&initialize_directions_he)
- if (!node1_dir)
- node1_dir = direction
- else if (!node2_dir)
- node2_dir = direction
-
- for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir))
- if(target.initialize_directions_he & get_dir(target,src))
- node1 = target
- break
- for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir))
- if(target.initialize_directions_he & get_dir(target,src))
- node2 = target
- break
- update_icon()
- return
-
-
- process()
- if(!parent)
- ..()
- else
- var/environment_temperature = 0
- if(istype(loc, /turf/simulated/))
- if(loc:blocks_air)
- environment_temperature = loc:temperature
- else
- var/datum/gas_mixture/environment = loc.return_air()
- environment_temperature = environment.temperature
- else
+ else
+ var/environment_temperature = 0
+ if(istype(loc, /turf/simulated/))
+ if(loc:blocks_air)
environment_temperature = loc:temperature
- var/datum/gas_mixture/pipe_air = return_air()
- if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
- parent.temperature_interact(loc, volume, thermal_conductivity)
+ else
+ var/datum/gas_mixture/environment = loc.return_air()
+ environment_temperature = environment.temperature
+ else
+ environment_temperature = loc:temperature
+ var/datum/gas_mixture/pipe_air = return_air()
+ if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
+ parent.temperature_interact(loc, volume, thermal_conductivity)
-obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
+/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
icon = 'icons/obj/pipes/junction.dmi'
icon_state = "intact"
level = 2
minimum_temperature_difference = 300
thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
- // BubbleWrap
- New()
- .. ()
- switch ( dir )
- if ( SOUTH )
- initialize_directions = NORTH
- initialize_directions_he = SOUTH
- if ( NORTH )
- initialize_directions = SOUTH
- initialize_directions_he = NORTH
- if ( EAST )
- initialize_directions = WEST
- initialize_directions_he = EAST
- if ( WEST )
- initialize_directions = EAST
- initialize_directions_he = WEST
- // BubbleWrap END
+// BubbleWrap
+/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/New()
+ .. ()
+ switch ( dir )
+ if ( SOUTH )
+ initialize_directions = NORTH
+ initialize_directions_he = SOUTH
+ if ( NORTH )
+ initialize_directions = SOUTH
+ initialize_directions_he = NORTH
+ if ( EAST )
+ initialize_directions = WEST
+ initialize_directions_he = EAST
+ if ( WEST )
+ initialize_directions = EAST
+ initialize_directions_he = WEST
+// BubbleWrap END
+
+/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/update_icon()
+ if(node1&&node2)
+ icon_state = "intact"
+ else
+ var/have_node1 = node1?1:0
+ var/have_node2 = node2?1:0
+ icon_state = "exposed[have_node1][have_node2]"
+ if(!node1&&!node2)
+ qdel(src)
+
+/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/initialize()
+ for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))
+ if(target.initialize_directions & get_dir(target,src))
+ node1 = target
+ break
+ for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,initialize_directions_he))
+ if(target.initialize_directions_he & get_dir(target,src))
+ node2 = target
+ break
update_icon()
- if(node1&&node2)
- icon_state = "intact"
- else
- var/have_node1 = node1?1:0
- var/have_node2 = node2?1:0
- icon_state = "exposed[have_node1][have_node2]"
- if(!node1&&!node2)
- qdel(src)
-
- initialize()
- for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))
- if(target.initialize_directions & get_dir(target,src))
- node1 = target
- break
- for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,initialize_directions_he))
- if(target.initialize_directions_he & get_dir(target,src))
- node2 = target
- break
-
- update_icon()
- return
+ return
diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm
index 833ff4b93d1..562bed66e96 100644
--- a/code/ATMOSPHERICS/pipes.dm
+++ b/code/ATMOSPHERICS/pipes.dm
@@ -1,4 +1,4 @@
-obj/machinery/atmospherics/pipe
+/obj/machinery/atmospherics/pipe
var/datum/gas_mixture/air_temporary //used when reconstructing a pipeline that broke
var/datum/pipeline/parent
@@ -14,802 +14,803 @@ obj/machinery/atmospherics/pipe
var/alert_pressure = 80*ONE_ATMOSPHERE
//minimum pressure before check_pressure(...) should be called
- proc/pipeline_expansion()
- return null
+/obj/machinery/atmospherics/pipe/proc/pipeline_expansion()
+ return null
- proc/check_pressure(pressure)
- //Return 1 if parent should continue checking other pipes
- //Return null if parent should stop checking other pipes. Recall: del(src) will by default return null
+/obj/machinery/atmospherics/pipe/proc/check_pressure(pressure)
+ //Return 1 if parent should continue checking other pipes
+ //Return null if parent should stop checking other pipes. Recall: del(src) will by default return null
- return 1
+ return 1
- return_air()
- if(!parent)
- parent = new /datum/pipeline()
- parent.build_pipeline(src)
+/obj/machinery/atmospherics/pipe/return_air()
+ if(!parent)
+ parent = new /datum/pipeline()
+ parent.build_pipeline(src)
- return parent.air
+ return parent.air
- build_network()
- if(!parent)
- parent = new /datum/pipeline()
- parent.build_pipeline(src)
+/obj/machinery/atmospherics/pipe/build_network()
+ if(!parent)
+ parent = new /datum/pipeline()
+ parent.build_pipeline(src)
- return parent.return_network()
+ return parent.return_network()
- network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
- if(!parent)
- parent = new /datum/pipeline()
- parent.build_pipeline(src)
+/obj/machinery/atmospherics/pipe/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
+ if(!parent)
+ parent = new /datum/pipeline()
+ parent.build_pipeline(src)
- return parent.network_expand(new_network, reference)
+ return parent.network_expand(new_network, reference)
- return_network(obj/machinery/atmospherics/reference)
- if(!parent)
- parent = new /datum/pipeline()
- parent.build_pipeline(src)
+/obj/machinery/atmospherics/pipe/return_network(obj/machinery/atmospherics/reference)
+ if(!parent)
+ parent = new /datum/pipeline()
+ parent.build_pipeline(src)
- return parent.return_network(reference)
+ return parent.return_network(reference)
- Destroy()
- del(parent)
- if(air_temporary)
- loc.assume_air(air_temporary)
- del(air_temporary)
+/obj/machinery/atmospherics/pipe/Destroy()
+ del(parent)
+ if(air_temporary)
+ loc.assume_air(air_temporary)
+ del(air_temporary)
+ ..()
+
+/obj/machinery/atmospherics/pipe/simple
+ icon = 'icons/obj/pipes.dmi'
+ icon_state = "intact-f"
+
+ name = "pipe"
+ desc = "A one meter section of regular pipe"
+
+ volume = 70
+
+ dir = SOUTH
+ initialize_directions = SOUTH|NORTH
+
+ var/obj/machinery/atmospherics/node1
+ var/obj/machinery/atmospherics/node2
+
+ var/minimum_temperature_difference = 300
+ var/thermal_conductivity = 0 //WALL_HEAT_TRANSFER_COEFFICIENT No
+
+ var/maximum_pressure = 70*ONE_ATMOSPHERE
+ var/fatigue_pressure = 55*ONE_ATMOSPHERE
+ alert_pressure = 55*ONE_ATMOSPHERE
+
+
+ level = 1
+
+/obj/machinery/atmospherics/pipe/simple/New()
+ ..()
+ switch(dir)
+ if(SOUTH || NORTH)
+ initialize_directions = SOUTH|NORTH
+ if(EAST || WEST)
+ initialize_directions = EAST|WEST
+ if(NORTHEAST)
+ initialize_directions = NORTH|EAST
+ if(NORTHWEST)
+ initialize_directions = NORTH|WEST
+ if(SOUTHEAST)
+ initialize_directions = SOUTH|EAST
+ if(SOUTHWEST)
+ initialize_directions = SOUTH|WEST
+
+
+/obj/machinery/atmospherics/pipe/simple/hide(var/i)
+ if(level == 1 && istype(loc, /turf/simulated))
+ invisibility = i ? 101 : 0
+ update_icon()
+
+/obj/machinery/atmospherics/pipe/simple/process()
+ if(!parent) //This should cut back on the overhead calling build_network thousands of times per cycle
..()
+ else
+ . = PROCESS_KILL
- simple
- icon = 'icons/obj/pipes.dmi'
- icon_state = "intact-f"
+ /*if(!node1)
+ parent.mingle_with_turf(loc, volume)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
- name = "pipe"
- desc = "A one meter section of regular pipe"
-
- volume = 70
-
- dir = SOUTH
- initialize_directions = SOUTH|NORTH
-
- var/obj/machinery/atmospherics/node1
- var/obj/machinery/atmospherics/node2
-
- var/minimum_temperature_difference = 300
- var/thermal_conductivity = 0 //WALL_HEAT_TRANSFER_COEFFICIENT No
-
- var/maximum_pressure = 70*ONE_ATMOSPHERE
- var/fatigue_pressure = 55*ONE_ATMOSPHERE
- alert_pressure = 55*ONE_ATMOSPHERE
+ else if(!node2)
+ parent.mingle_with_turf(loc, volume)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
+ else if (nodealert)
+ nodealert = 0
- level = 1
+ else if(parent)
+ var/environment_temperature = 0
- New()
- ..()
- switch(dir)
- if(SOUTH || NORTH)
- initialize_directions = SOUTH|NORTH
- if(EAST || WEST)
- initialize_directions = EAST|WEST
- if(NORTHEAST)
- initialize_directions = NORTH|EAST
- if(NORTHWEST)
- initialize_directions = NORTH|WEST
- if(SOUTHEAST)
- initialize_directions = SOUTH|EAST
- if(SOUTHWEST)
- initialize_directions = SOUTH|WEST
-
-
- hide(var/i)
- if(level == 1 && istype(loc, /turf/simulated))
- invisibility = i ? 101 : 0
- update_icon()
-
- process()
- if(!parent) //This should cut back on the overhead calling build_network thousands of times per cycle
- ..()
+ if(istype(loc, /turf/simulated/))
+ if(loc:blocks_air)
+ environment_temperature = loc:temperature
else
- . = PROCESS_KILL
+ var/datum/gas_mixture/environment = loc.return_air()
+ environment_temperature = environment.temperature
- /*if(!node1)
- parent.mingle_with_turf(loc, volume)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
+ else
+ environment_temperature = loc:temperature
- else if(!node2)
- parent.mingle_with_turf(loc, volume)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
- else if (nodealert)
- nodealert = 0
+ var/datum/gas_mixture/pipe_air = return_air()
+
+ if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
+ parent.temperature_interact(loc, volume, thermal_conductivity)
+ */ //Screw you heat lag
+
+/obj/machinery/atmospherics/pipe/simple/check_pressure(pressure)
+ var/datum/gas_mixture/environment = loc.return_air()
+
+ var/pressure_difference = pressure - environment.return_pressure()
+
+ if(pressure_difference > maximum_pressure)
+ burst()
+
+ else if(pressure_difference > fatigue_pressure)
+ //TODO: leak to turf, doing pfshhhhh
+ if(prob(5))
+ burst()
+
+ else return 1
+
+/obj/machinery/atmospherics/pipe/simple/proc/burst()
+ src.visible_message("\red \bold [src] bursts!");
+ playsound(src.loc, 'sound/effects/bang.ogg', 25, 1)
+ var/datum/effect/effect/system/harmless_smoke_spread/smoke = new
+ smoke.set_up(1,0, src.loc, 0)
+ smoke.start()
+ qdel(src)
+
+/obj/machinery/atmospherics/pipe/simple/proc/normalize_dir()
+ if(dir==3)
+ dir = 1
+ else if(dir==12)
+ dir = 4
+
+/obj/machinery/atmospherics/pipe/simple/Destroy()
+ if(node1)
+ node1.disconnect(src)
+ if(node2)
+ node2.disconnect(src)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/simple/pipeline_expansion()
+ return list(node1, node2)
+
+/obj/machinery/atmospherics/pipe/simple/update_icon()
+ if(node1&&node2)
+ var/C = ""
+ switch(pipe_color)
+ if ("red") C = "-r"
+ if ("blue") C = "-b"
+ if ("cyan") C = "-c"
+ if ("green") C = "-g"
+ if ("yellow") C = "-y"
+ if ("purple") C = "-p"
+ icon_state = "intact[C][invisibility ? "-f" : "" ]"
+
+ //var/node1_direction = get_dir(src, node1)
+ //var/node2_direction = get_dir(src, node2)
+
+ //dir = node1_direction|node2_direction
+
+ else
+ if(!node1&&!node2)
+ qdel(src) //TODO: silent deleting looks weird
+ var/have_node1 = node1?1:0
+ var/have_node2 = node2?1:0
+ icon_state = "exposed[have_node1][have_node2][invisibility ? "-f" : "" ]"
- else if(parent)
- var/environment_temperature = 0
+/obj/machinery/atmospherics/pipe/simple/initialize()
+ normalize_dir()
+ var/node1_dir
+ var/node2_dir
- if(istype(loc, /turf/simulated/))
- if(loc:blocks_air)
- environment_temperature = loc:temperature
- else
- var/datum/gas_mixture/environment = loc.return_air()
- environment_temperature = environment.temperature
+ for(var/direction in cardinal)
+ if(direction&initialize_directions)
+ if (!node1_dir)
+ node1_dir = direction
+ else if (!node2_dir)
+ node2_dir = direction
- else
- environment_temperature = loc:temperature
+ for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
+ if(target.initialize_directions & get_dir(target,src))
+ node1 = target
+ break
+ for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
+ if(target.initialize_directions & get_dir(target,src))
+ node2 = target
+ break
- var/datum/gas_mixture/pipe_air = return_air()
- if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
- parent.temperature_interact(loc, volume, thermal_conductivity)
- */ //Screw you heat lag
+ var/turf/T = src.loc // hide if turf is not intact
+ hide(T.intact)
+ update_icon()
+ //update_icon()
- check_pressure(pressure)
- var/datum/gas_mixture/environment = loc.return_air()
+/obj/machinery/atmospherics/pipe/simple/disconnect(obj/machinery/atmospherics/reference)
+ if(reference == node1)
+ if(istype(node1, /obj/machinery/atmospherics/pipe))
+ del(parent)
+ node1 = null
- var/pressure_difference = pressure - environment.return_pressure()
+ if(reference == node2)
+ if(istype(node2, /obj/machinery/atmospherics/pipe))
+ del(parent)
+ node2 = null
- if(pressure_difference > maximum_pressure)
- burst()
+ update_icon()
- else if(pressure_difference > fatigue_pressure)
- //TODO: leak to turf, doing pfshhhhh
- if(prob(5))
- burst()
+ return null
- else return 1
+/obj/machinery/atmospherics/pipe/simple/scrubbers
+ name="Scrubbers pipe"
+ pipe_color="red"
+ icon_state = ""
- proc/burst()
- src.visible_message("\red \bold [src] bursts!");
- playsound(src.loc, 'sound/effects/bang.ogg', 25, 1)
- var/datum/effect/effect/system/harmless_smoke_spread/smoke = new
- smoke.set_up(1,0, src.loc, 0)
- smoke.start()
+/obj/machinery/atmospherics/pipe/simple/supply
+ name="Air supply pipe"
+ pipe_color="blue"
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/simple/supplymain
+ name="Main air supply pipe"
+ pipe_color="purple"
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/simple/general
+ name="Pipe"
+ pipe_color=""
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/simple/scrubbers/visible
+ level = 2
+ icon_state = "intact-r"
+
+/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden
+ level = 1
+ icon_state = "intact-r-f"
+
+/obj/machinery/atmospherics/pipe/simple/supply/visible
+ level = 2
+ icon_state = "intact-b"
+
+/obj/machinery/atmospherics/pipe/simple/supply/hidden
+ level = 1
+ icon_state = "intact-b-f"
+
+/obj/machinery/atmospherics/pipe/simple/supplymain/visible
+ level = 2
+ icon_state = "intact-p"
+
+/obj/machinery/atmospherics/pipe/simple/supplymain/hidden
+ level = 1
+ icon_state = "intact-p-f"
+
+/obj/machinery/atmospherics/pipe/simple/general/visible
+ level = 2
+ icon_state = "intact"
+
+/obj/machinery/atmospherics/pipe/simple/general/hidden
+ level = 1
+ icon_state = "intact-f"
+
+/obj/machinery/atmospherics/pipe/simple/yellow
+ name="Pipe"
+ pipe_color="yellow"
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/simple/yellow/visible
+ level = 2
+ icon_state = "intact-y"
+
+/obj/machinery/atmospherics/pipe/simple/yellow/hidden
+ level = 1
+ icon_state = "intact-y-f"
+
+
+
+/obj/machinery/atmospherics/pipe/simple/insulated
+ icon = 'icons/obj/atmospherics/red_pipe.dmi'
+ icon_state = "intact"
+
+ minimum_temperature_difference = 10000
+ thermal_conductivity = 0
+ maximum_pressure = 1000*ONE_ATMOSPHERE
+ fatigue_pressure = 900*ONE_ATMOSPHERE
+ alert_pressure = 900*ONE_ATMOSPHERE
+
+ level = 2
+
+
+/obj/machinery/atmospherics/pipe/tank
+ icon = 'icons/obj/atmospherics/pipe_tank.dmi'
+ icon_state = "intact"
+
+ name = "pressure tank"
+ desc = "A large vessel containing pressurized gas."
+
+ volume = 10000 //in liters, 1 meters by 1 meters by 2 meters
+
+ dir = SOUTH
+ initialize_directions = SOUTH
+ density = 1
+
+ can_unwrench = 0
+
+ var/obj/machinery/atmospherics/node1
+
+/obj/machinery/atmospherics/pipe/tank/New()
+ initialize_directions = dir
+ ..()
+
+/obj/machinery/atmospherics/pipe/tank/process()
+ if(!parent)
+ ..()
+ else
+ . = PROCESS_KILL
+/* if(!node1)
+ parent.mingle_with_turf(loc, 200)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
+ else if (nodealert)
+ nodealert = 0
+*/
+/obj/machinery/atmospherics/pipe/tank/carbon_dioxide
+ name = "pressure tank (Carbon Dioxide)"
+
+/obj/machinery/atmospherics/pipe/tank/carbon_dioxide/New()
+ air_temporary = new
+ air_temporary.volume = volume
+ air_temporary.temperature = T20C
+
+ air_temporary.carbon_dioxide = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/tank/toxins
+ icon = 'icons/obj/atmospherics/orange_pipe_tank.dmi'
+ name = "pressure tank (Plasma)"
+
+/obj/machinery/atmospherics/pipe/tank/toxins/New()
+ air_temporary = new
+ air_temporary.volume = volume
+ air_temporary.temperature = T20C
+
+ air_temporary.toxins = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/tank/oxygen_agent_b
+ icon = 'icons/obj/atmospherics/red_orange_pipe_tank.dmi'
+ name = "pressure tank (Oxygen + Plasma)"
+
+/obj/machinery/atmospherics/pipe/tank/oxygen_agent_b/New()
+ air_temporary = new
+ air_temporary.volume = volume
+ air_temporary.temperature = T0C
+
+ var/datum/gas/oxygen_agent_b/trace_gas = new
+ trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
+
+ air_temporary.trace_gases += trace_gas
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/tank/oxygen
+ icon = 'icons/obj/atmospherics/blue_pipe_tank.dmi'
+ name = "pressure tank (Oxygen)"
+
+/obj/machinery/atmospherics/pipe/tank/oxygen/New()
+ air_temporary = new
+ air_temporary.volume = volume
+ air_temporary.temperature = T20C
+
+ air_temporary.oxygen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/tank/nitrogen
+ icon = 'icons/obj/atmospherics/red_pipe_tank.dmi'
+ name = "pressure tank (Nitrogen)"
+
+/obj/machinery/atmospherics/pipe/tank/nitrogen/New()
+ air_temporary = new
+ air_temporary.volume = volume
+ air_temporary.temperature = T20C
+
+ air_temporary.nitrogen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/tank/air
+ icon = 'icons/obj/atmospherics/red_pipe_tank.dmi'
+ name = "pressure tank (Air)"
+
+/obj/machinery/atmospherics/pipe/tank/air/New()
+ air_temporary = new
+ air_temporary.volume = volume
+ air_temporary.temperature = T20C
+
+ air_temporary.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
+ air_temporary.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/tank/Destroy()
+ if(node1)
+ node1.disconnect(src)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/tank/pipeline_expansion()
+ return list(node1)
+
+/obj/machinery/atmospherics/pipe/tank/update_icon()
+ if(node1)
+ icon_state = "intact"
+
+ dir = get_dir(src, node1)
+
+ else
+ icon_state = "exposed"
+
+/obj/machinery/atmospherics/pipe/tank/initialize()
+
+ var/connect_direction = dir
+
+ for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
+ if(target.initialize_directions & get_dir(target,src))
+ node1 = target
+ break
+
+ update_icon()
+
+/obj/machinery/atmospherics/pipe/tank/disconnect(obj/machinery/atmospherics/reference)
+ if(reference == node1)
+ if(istype(node1, /obj/machinery/atmospherics/pipe))
+ del(parent)
+ node1 = null
+
+ update_icon()
+
+ return null
+
+/obj/machinery/atmospherics/pipe/tank/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
+ if (istype(W, /obj/item/device/analyzer) && get_dist(user, src) <= 1)
+ atmosanalyzer_scan(parent.air, user)
+
+/obj/machinery/atmospherics/pipe/vent
+ icon = 'icons/obj/atmospherics/pipe_vent.dmi'
+ icon_state = "intact"
+
+ name = "vent"
+ desc = "A large air vent"
+
+ level = 1
+
+ volume = 250
+
+ dir = SOUTH
+ initialize_directions = SOUTH
+
+ can_unwrench = 0
+
+ var/build_killswitch = 1
+
+ var/obj/machinery/atmospherics/node1
+
+/obj/machinery/atmospherics/pipe/vent/New()
+ initialize_directions = dir
+ ..()
+
+/obj/machinery/atmospherics/pipe/vent/process()
+ if(!parent)
+ if(build_killswitch <= 0)
+ . = PROCESS_KILL
+ else
+ build_killswitch--
+ ..()
+ return
+ else
+ parent.mingle_with_turf(loc, 250)
+/*
+ if(!node1)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
+ else if (nodealert)
+ nodealert = 0
+*/
+/obj/machinery/atmospherics/pipe/vent/Destroy()
+ if(node1)
+ node1.disconnect(src)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/vent/pipeline_expansion()
+ return list(node1)
+
+/obj/machinery/atmospherics/pipe/vent/update_icon()
+ if(node1)
+ icon_state = "intact"
+
+ dir = get_dir(src, node1)
+
+ else
+ icon_state = "exposed"
+
+/obj/machinery/atmospherics/pipe/vent/initialize()
+ var/connect_direction = dir
+
+ for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
+ if(target.initialize_directions & get_dir(target,src))
+ node1 = target
+ break
+
+ update_icon()
+
+/obj/machinery/atmospherics/pipe/vent/disconnect(obj/machinery/atmospherics/reference)
+ if(reference == node1)
+ if(istype(node1, /obj/machinery/atmospherics/pipe))
+ del(parent)
+ node1 = null
+
+ update_icon()
+
+ return null
+
+/obj/machinery/atmospherics/pipe/vent/hide(var/i) //to make the little pipe section invisible, the icon changes.
+ if(node1)
+ icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
+ dir = get_dir(src, node1)
+ else
+ icon_state = "exposed"
+
+/obj/machinery/atmospherics/pipe/manifold
+ icon = 'icons/obj/atmospherics/pipe_manifold.dmi'
+ icon_state = "manifold-f"
+
+ name = "pipe manifold"
+ desc = "A manifold composed of regular pipes"
+
+ volume = 105
+
+ dir = SOUTH
+ initialize_directions = EAST|NORTH|WEST
+
+ var/obj/machinery/atmospherics/node1
+ var/obj/machinery/atmospherics/node2
+ var/obj/machinery/atmospherics/node3
+
+ level = 1
+ layer = 2.4 //under wires with their 2.44
+
+/obj/machinery/atmospherics/pipe/manifold/New()
+ switch(dir)
+ if(NORTH)
+ initialize_directions = EAST|SOUTH|WEST
+ if(SOUTH)
+ initialize_directions = WEST|NORTH|EAST
+ if(EAST)
+ initialize_directions = SOUTH|WEST|NORTH
+ if(WEST)
+ initialize_directions = NORTH|EAST|SOUTH
+
+ ..()
+
+
+
+/obj/machinery/atmospherics/pipe/manifold/hide(var/i)
+ if(level == 1 && istype(loc, /turf/simulated))
+ invisibility = i ? 101 : 0
+ update_icon()
+
+/obj/machinery/atmospherics/pipe/manifold/pipeline_expansion()
+ return list(node1, node2, node3)
+
+/obj/machinery/atmospherics/pipe/manifold/process()
+ if(!parent)
+ ..()
+ else
+ . = PROCESS_KILL
+/*
+ if(!node1)
+ parent.mingle_with_turf(loc, 70)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
+ else if(!node2)
+ parent.mingle_with_turf(loc, 70)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
+ else if(!node3)
+ parent.mingle_with_turf(loc, 70)
+ if(!nodealert)
+ //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
+ nodealert = 1
+ else if (nodealert)
+ nodealert = 0
+*/
+/obj/machinery/atmospherics/pipe/manifold/Destroy()
+ if(node1)
+ node1.disconnect(src)
+ if(node2)
+ node2.disconnect(src)
+ if(node3)
+ node3.disconnect(src)
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/reference)
+ if(reference == node1)
+ if(istype(node1, /obj/machinery/atmospherics/pipe))
+ del(parent)
+ node1 = null
+
+ if(reference == node2)
+ if(istype(node2, /obj/machinery/atmospherics/pipe))
+ del(parent)
+ node2 = null
+
+ if(reference == node3)
+ if(istype(node3, /obj/machinery/atmospherics/pipe))
+ del(parent)
+ node3 = null
+
+ update_icon()
+
+ ..()
+
+/obj/machinery/atmospherics/pipe/manifold/update_icon()
+ if(node1&&node2&&node3)
+ var/C = ""
+ switch(pipe_color)
+ if ("red") C = "-r"
+ if ("blue") C = "-b"
+ if ("cyan") C = "-c"
+ if ("green") C = "-g"
+ if ("yellow") C = "-y"
+ if ("purple") C = "-p"
+ icon_state = "manifold[C][invisibility ? "-f" : ""]"
+
+ else
+ var/connected = 0
+ var/unconnected = 0
+ var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
+
+ if(node1)
+ connected |= get_dir(src, node1)
+ if(node2)
+ connected |= get_dir(src, node2)
+ if(node3)
+ connected |= get_dir(src, node3)
+
+ unconnected = (~connected)&(connect_directions)
+
+ icon_state = "manifold_[connected]_[unconnected]"
+
+ if(!connected)
qdel(src)
- proc/normalize_dir()
- if(dir==3)
- dir = 1
- else if(dir==12)
- dir = 4
+ return
- Destroy()
- if(node1)
- node1.disconnect(src)
- if(node2)
- node2.disconnect(src)
+/obj/machinery/atmospherics/pipe/manifold/initialize()
+ var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
- ..()
-
- pipeline_expansion()
- return list(node1, node2)
-
- update_icon()
- if(node1&&node2)
- var/C = ""
- switch(pipe_color)
- if ("red") C = "-r"
- if ("blue") C = "-b"
- if ("cyan") C = "-c"
- if ("green") C = "-g"
- if ("yellow") C = "-y"
- if ("purple") C = "-p"
- icon_state = "intact[C][invisibility ? "-f" : "" ]"
-
- //var/node1_direction = get_dir(src, node1)
- //var/node2_direction = get_dir(src, node2)
-
- //dir = node1_direction|node2_direction
-
- else
- if(!node1&&!node2)
- qdel(src) //TODO: silent deleting looks weird
- var/have_node1 = node1?1:0
- var/have_node2 = node2?1:0
- icon_state = "exposed[have_node1][have_node2][invisibility ? "-f" : "" ]"
-
-
- initialize()
- normalize_dir()
- var/node1_dir
- var/node2_dir
-
- for(var/direction in cardinal)
- if(direction&initialize_directions)
- if (!node1_dir)
- node1_dir = direction
- else if (!node2_dir)
- node2_dir = direction
-
- for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
+ for(var/direction in cardinal)
+ if(direction&connect_directions)
+ for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
node1 = target
+ connect_directions &= ~direction
break
- for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
+ if (node1)
+ break
+
+
+ for(var/direction in cardinal)
+ if(direction&connect_directions)
+ for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
node2 = target
+ connect_directions &= ~direction
break
+ if (node2)
+ break
- var/turf/T = src.loc // hide if turf is not intact
- hide(T.intact)
- update_icon()
- //update_icon()
-
- disconnect(obj/machinery/atmospherics/reference)
- if(reference == node1)
- if(istype(node1, /obj/machinery/atmospherics/pipe))
- del(parent)
- node1 = null
-
- if(reference == node2)
- if(istype(node2, /obj/machinery/atmospherics/pipe))
- del(parent)
- node2 = null
-
- update_icon()
-
- return null
-
- simple/scrubbers
- name="Scrubbers pipe"
- pipe_color="red"
- icon_state = ""
-
- simple/supply
- name="Air supply pipe"
- pipe_color="blue"
- icon_state = ""
-
- simple/supplymain
- name="Main air supply pipe"
- pipe_color="purple"
- icon_state = ""
-
- simple/general
- name="Pipe"
- pipe_color=""
- icon_state = ""
-
- simple/scrubbers/visible
- level = 2
- icon_state = "intact-r"
-
- simple/scrubbers/hidden
- level = 1
- icon_state = "intact-r-f"
-
- simple/supply/visible
- level = 2
- icon_state = "intact-b"
-
- simple/supply/hidden
- level = 1
- icon_state = "intact-b-f"
-
- simple/supplymain/visible
- level = 2
- icon_state = "intact-p"
-
- simple/supplymain/hidden
- level = 1
- icon_state = "intact-p-f"
-
- simple/general/visible
- level = 2
- icon_state = "intact"
-
- simple/general/hidden
- level = 1
- icon_state = "intact-f"
-
- simple/yellow
- name="Pipe"
- pipe_color="yellow"
- icon_state = ""
-
- simple/yellow/visible
- level = 2
- icon_state = "intact-y"
-
- simple/yellow/hidden
- level = 1
- icon_state = "intact-y-f"
-
-
-
- simple/insulated
- icon = 'icons/obj/atmospherics/red_pipe.dmi'
- icon_state = "intact"
-
- minimum_temperature_difference = 10000
- thermal_conductivity = 0
- maximum_pressure = 1000*ONE_ATMOSPHERE
- fatigue_pressure = 900*ONE_ATMOSPHERE
- alert_pressure = 900*ONE_ATMOSPHERE
-
- level = 2
-
-
- tank
- icon = 'icons/obj/atmospherics/pipe_tank.dmi'
- icon_state = "intact"
-
- name = "pressure tank"
- desc = "A large vessel containing pressurized gas."
-
- volume = 10000 //in liters, 1 meters by 1 meters by 2 meters
-
- dir = SOUTH
- initialize_directions = SOUTH
- density = 1
-
- can_unwrench = 0
-
- var/obj/machinery/atmospherics/node1
-
- New()
- initialize_directions = dir
- ..()
-
- process()
- if(!parent)
- ..()
- else
- . = PROCESS_KILL
-/* if(!node1)
- parent.mingle_with_turf(loc, 200)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
- else if (nodealert)
- nodealert = 0
-*/
- carbon_dioxide
- name = "pressure tank (Carbon Dioxide)"
-
- New()
- air_temporary = new
- air_temporary.volume = volume
- air_temporary.temperature = T20C
-
- air_temporary.carbon_dioxide = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
-
- ..()
-
- toxins
- icon = 'icons/obj/atmospherics/orange_pipe_tank.dmi'
- name = "pressure tank (Plasma)"
-
- New()
- air_temporary = new
- air_temporary.volume = volume
- air_temporary.temperature = T20C
-
- air_temporary.toxins = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
-
- ..()
-
- oxygen_agent_b
- icon = 'icons/obj/atmospherics/red_orange_pipe_tank.dmi'
- name = "pressure tank (Oxygen + Plasma)"
-
- New()
- air_temporary = new
- air_temporary.volume = volume
- air_temporary.temperature = T0C
-
- var/datum/gas/oxygen_agent_b/trace_gas = new
- trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
-
- air_temporary.trace_gases += trace_gas
-
- ..()
-
- oxygen
- icon = 'icons/obj/atmospherics/blue_pipe_tank.dmi'
- name = "pressure tank (Oxygen)"
-
- New()
- air_temporary = new
- air_temporary.volume = volume
- air_temporary.temperature = T20C
-
- air_temporary.oxygen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
-
- ..()
-
- nitrogen
- icon = 'icons/obj/atmospherics/red_pipe_tank.dmi'
- name = "pressure tank (Nitrogen)"
-
- New()
- air_temporary = new
- air_temporary.volume = volume
- air_temporary.temperature = T20C
-
- air_temporary.nitrogen = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
-
- ..()
-
- air
- icon = 'icons/obj/atmospherics/red_pipe_tank.dmi'
- name = "pressure tank (Air)"
-
- New()
- air_temporary = new
- air_temporary.volume = volume
- air_temporary.temperature = T20C
-
- air_temporary.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
- air_temporary.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
-
- ..()
-
- Destroy()
- if(node1)
- node1.disconnect(src)
-
- ..()
-
- pipeline_expansion()
- return list(node1)
-
- update_icon()
- if(node1)
- icon_state = "intact"
-
- dir = get_dir(src, node1)
-
- else
- icon_state = "exposed"
-
- initialize()
-
- var/connect_direction = dir
-
- for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
+ for(var/direction in cardinal)
+ if(direction&connect_directions)
+ for(var/obj/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
- node1 = target
+ node3 = target
+ connect_directions &= ~direction
break
-
- update_icon()
-
- disconnect(obj/machinery/atmospherics/reference)
- if(reference == node1)
- if(istype(node1, /obj/machinery/atmospherics/pipe))
- del(parent)
- node1 = null
-
- update_icon()
-
- return null
-
- attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
- if (istype(W, /obj/item/device/analyzer) && get_dist(user, src) <= 1)
- atmosanalyzer_scan(parent.air, user)
-
- vent
- icon = 'icons/obj/atmospherics/pipe_vent.dmi'
- icon_state = "intact"
-
- name = "vent"
- desc = "A large air vent"
-
- level = 1
-
- volume = 250
-
- dir = SOUTH
- initialize_directions = SOUTH
-
- can_unwrench = 0
-
- var/build_killswitch = 1
-
- var/obj/machinery/atmospherics/node1
- New()
- initialize_directions = dir
- ..()
-
- process()
- if(!parent)
- if(build_killswitch <= 0)
- . = PROCESS_KILL
- else
- build_killswitch--
- ..()
- return
- else
- parent.mingle_with_turf(loc, 250)
-/*
- if(!node1)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
- else if (nodealert)
- nodealert = 0
-*/
- Destroy()
- if(node1)
- node1.disconnect(src)
-
- ..()
-
- pipeline_expansion()
- return list(node1)
-
- update_icon()
- if(node1)
- icon_state = "intact"
-
- dir = get_dir(src, node1)
-
- else
- icon_state = "exposed"
-
- initialize()
- var/connect_direction = dir
-
- for(var/obj/machinery/atmospherics/target in get_step(src,connect_direction))
- if(target.initialize_directions & get_dir(target,src))
- node1 = target
- break
-
- update_icon()
-
- disconnect(obj/machinery/atmospherics/reference)
- if(reference == node1)
- if(istype(node1, /obj/machinery/atmospherics/pipe))
- del(parent)
- node1 = null
-
- update_icon()
-
- return null
-
- hide(var/i) //to make the little pipe section invisible, the icon changes.
- if(node1)
- icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]intact"
- dir = get_dir(src, node1)
- else
- icon_state = "exposed"
-
- manifold
- icon = 'icons/obj/atmospherics/pipe_manifold.dmi'
- icon_state = "manifold-f"
-
- name = "pipe manifold"
- desc = "A manifold composed of regular pipes"
-
- volume = 105
-
- dir = SOUTH
- initialize_directions = EAST|NORTH|WEST
-
- var/obj/machinery/atmospherics/node1
- var/obj/machinery/atmospherics/node2
- var/obj/machinery/atmospherics/node3
-
- level = 1
- layer = 2.4 //under wires with their 2.44
-
- New()
- switch(dir)
- if(NORTH)
- initialize_directions = EAST|SOUTH|WEST
- if(SOUTH)
- initialize_directions = WEST|NORTH|EAST
- if(EAST)
- initialize_directions = SOUTH|WEST|NORTH
- if(WEST)
- initialize_directions = NORTH|EAST|SOUTH
-
- ..()
-
-
-
- hide(var/i)
- if(level == 1 && istype(loc, /turf/simulated))
- invisibility = i ? 101 : 0
- update_icon()
-
- pipeline_expansion()
- return list(node1, node2, node3)
-
- process()
- if(!parent)
- ..()
- else
- . = PROCESS_KILL
-/*
- if(!node1)
- parent.mingle_with_turf(loc, 70)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
- else if(!node2)
- parent.mingle_with_turf(loc, 70)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
- else if(!node3)
- parent.mingle_with_turf(loc, 70)
- if(!nodealert)
- //world << "Missing node from [src] at [src.x],[src.y],[src.z]"
- nodealert = 1
- else if (nodealert)
- nodealert = 0
-*/
- Destroy()
- if(node1)
- node1.disconnect(src)
- if(node2)
- node2.disconnect(src)
- if(node3)
- node3.disconnect(src)
-
- ..()
-
- disconnect(obj/machinery/atmospherics/reference)
- if(reference == node1)
- if(istype(node1, /obj/machinery/atmospherics/pipe))
- del(parent)
- node1 = null
-
- if(reference == node2)
- if(istype(node2, /obj/machinery/atmospherics/pipe))
- del(parent)
- node2 = null
-
- if(reference == node3)
- if(istype(node3, /obj/machinery/atmospherics/pipe))
- del(parent)
- node3 = null
-
- update_icon()
-
- ..()
-
- update_icon()
- if(node1&&node2&&node3)
- var/C = ""
- switch(pipe_color)
- if ("red") C = "-r"
- if ("blue") C = "-b"
- if ("cyan") C = "-c"
- if ("green") C = "-g"
- if ("yellow") C = "-y"
- if ("purple") C = "-p"
- icon_state = "manifold[C][invisibility ? "-f" : ""]"
-
- else
- var/connected = 0
- var/unconnected = 0
- var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
-
- if(node1)
- connected |= get_dir(src, node1)
- if(node2)
- connected |= get_dir(src, node2)
- if(node3)
- connected |= get_dir(src, node3)
-
- unconnected = (~connected)&(connect_directions)
-
- icon_state = "manifold_[connected]_[unconnected]"
-
- if(!connected)
- qdel(src)
-
- return
-
- initialize()
- var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
-
- for(var/direction in cardinal)
- if(direction&connect_directions)
- for(var/obj/machinery/atmospherics/target in get_step(src,direction))
- if(target.initialize_directions & get_dir(target,src))
- node1 = target
- connect_directions &= ~direction
- break
- if (node1)
- break
-
-
- for(var/direction in cardinal)
- if(direction&connect_directions)
- for(var/obj/machinery/atmospherics/target in get_step(src,direction))
- if(target.initialize_directions & get_dir(target,src))
- node2 = target
- connect_directions &= ~direction
- break
- if (node2)
- break
-
-
- for(var/direction in cardinal)
- if(direction&connect_directions)
- for(var/obj/machinery/atmospherics/target in get_step(src,direction))
- if(target.initialize_directions & get_dir(target,src))
- node3 = target
- connect_directions &= ~direction
- break
- if (node3)
- break
-
- var/turf/T = src.loc // hide if turf is not intact
- hide(T.intact)
- //update_icon()
- update_icon()
-
- manifold/scrubbers
- name="Scrubbers pipe"
- pipe_color="red"
- icon_state = ""
-
- manifold/supply
- name="Air supply pipe"
- pipe_color="blue"
- icon_state = ""
-
- manifold/supplymain
- name="Main air supply pipe"
- pipe_color="purple"
- icon_state = ""
-
- manifold/general
- name="Air supply pipe"
- pipe_color="gray"
- icon_state = ""
-
- manifold/yellow
- name="Air supply pipe"
- pipe_color="yellow"
- icon_state = ""
-
- manifold/scrubbers/visible
- level = 2
- icon_state = "manifold-r"
-
- manifold/scrubbers/hidden
- level = 1
- icon_state = "manifold-r-f"
-
- manifold/supply/visible
- level = 2
- icon_state = "manifold-b"
-
- manifold/supply/hidden
- level = 1
- icon_state = "manifold-b-f"
-
- manifold/supplymain/visible
- level = 2
- icon_state = "manifold-p"
-
- manifold/supplymain/hidden
- level = 1
- icon_state = "manifold-p-f"
-
- manifold/general/visible
- level = 2
- icon_state = "manifold"
-
- manifold/general/hidden
- level = 1
- icon_state = "manifold-f"
-
- manifold/yellow/visible
- level = 2
- icon_state = "manifold-y"
-
- manifold/yellow/hidden
- level = 1
- icon_state = "manifold-y-f"
+ if (node3)
+ break
+
+ var/turf/T = src.loc // hide if turf is not intact
+ hide(T.intact)
+ //update_icon()
+ update_icon()
+
+/obj/machinery/atmospherics/pipe/manifold/scrubbers
+ name="Scrubbers pipe"
+ pipe_color="red"
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/manifold/supply
+ name="Air supply pipe"
+ pipe_color="blue"
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/manifold/supplymain
+ name="Main air supply pipe"
+ pipe_color="purple"
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/manifold/general
+ name="Air supply pipe"
+ pipe_color="gray"
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/manifold/yellow
+ name="Air supply pipe"
+ pipe_color="yellow"
+ icon_state = ""
+
+/obj/machinery/atmospherics/pipe/manifold/scrubbers/visible
+ level = 2
+ icon_state = "manifold-r"
+
+/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden
+ level = 1
+ icon_state = "manifold-r-f"
+
+/obj/machinery/atmospherics/pipe/manifold/supply/visible
+ level = 2
+ icon_state = "manifold-b"
+
+/obj/machinery/atmospherics/pipe/manifold/supply/hidden
+ level = 1
+ icon_state = "manifold-b-f"
+
+/obj/machinery/atmospherics/pipe/manifold/supplymain/visible
+ level = 2
+ icon_state = "manifold-p"
+
+/obj/machinery/atmospherics/pipe/manifold/supplymain/hidden
+ level = 1
+ icon_state = "manifold-p-f"
+
+/obj/machinery/atmospherics/pipe/manifold/general/visible
+ level = 2
+ icon_state = "manifold"
+
+/obj/machinery/atmospherics/pipe/manifold/general/hidden
+ level = 1
+ icon_state = "manifold-f"
+
+/obj/machinery/atmospherics/pipe/manifold/yellow/visible
+ level = 2
+ icon_state = "manifold-y"
+
+/obj/machinery/atmospherics/pipe/manifold/yellow/hidden
+ level = 1
+ icon_state = "manifold-y-f"
obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if (istype(W, /obj/item/device/analyzer) && get_dist(user, src) <= 1)