mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
Gives the large portable scrubber 3x3 scurbbing power
Also fixes portable scrubbers a bit Conflicts: code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm
This commit is contained in:
@@ -1,30 +1,11 @@
|
||||
/obj/machinery/atmospherics/binary
|
||||
icon = 'icons/obj/atmospherics/binary_devices.dmi'
|
||||
/obj/machinery/atmospherics/components/binary
|
||||
icon = 'icons/obj/atmospherics/components/binary_devices.dmi'
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH
|
||||
use_power = 1
|
||||
device_type = BINARY
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
|
||||
var/obj/machinery/atmospherics/node1
|
||||
var/obj/machinery/atmospherics/node2
|
||||
|
||||
var/datum/pipeline/parent1
|
||||
var/datum/pipeline/parent2
|
||||
|
||||
var/showpipe = 0
|
||||
|
||||
/obj/machinery/atmospherics/binary/New()
|
||||
..()
|
||||
|
||||
air1 = new
|
||||
air2 = new
|
||||
|
||||
air1.volume = 200
|
||||
air2.volume = 200
|
||||
|
||||
/obj/machinery/atmospherics/binary/SetInitDirections()
|
||||
/obj/machinery/atmospherics/components/binary/SetInitDirections()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
initialize_directions = NORTH|SOUTH
|
||||
@@ -34,147 +15,23 @@
|
||||
initialize_directions = EAST|WEST
|
||||
if(WEST)
|
||||
initialize_directions = EAST|WEST
|
||||
|
||||
//Separate this because we don't need to update pipe icons if we just are going to change the state
|
||||
/obj/machinery/atmospherics/binary/proc/update_icon_nopipes()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/update_icon()
|
||||
update_icon_nopipes()
|
||||
|
||||
underlays.Cut()
|
||||
if(showpipe)
|
||||
var/connected = 0
|
||||
|
||||
//Add intact pieces
|
||||
if(node1)
|
||||
connected = icon_addintact(node1, connected)
|
||||
|
||||
if(node2)
|
||||
connected = icon_addintact(node2, connected)
|
||||
|
||||
//Add broken pieces
|
||||
icon_addbroken(connected)
|
||||
|
||||
/obj/machinery/atmospherics/binary/hide(var/intact)
|
||||
/*
|
||||
Iconnery
|
||||
*/
|
||||
/obj/machinery/atmospherics/components/binary/hide(intact)
|
||||
showpipe = !intact
|
||||
update_icon()
|
||||
|
||||
..(intact)
|
||||
/*
|
||||
Housekeeping and pipe network stuff
|
||||
*/
|
||||
|
||||
// Housekeeping and pipe network stuff below
|
||||
/obj/machinery/atmospherics/binary/Destroy()
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
node1 = null
|
||||
nullifyPipenet(parent1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
node2 = null
|
||||
nullifyPipenet(parent2)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/atmosinit()
|
||||
/obj/machinery/atmospherics/components/binary/atmosinit()
|
||||
|
||||
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
|
||||
|
||||
if(level == 2)
|
||||
showpipe = 1
|
||||
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/construction()
|
||||
..()
|
||||
parent1.update = 1
|
||||
parent2.update = 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/build_network()
|
||||
if(!parent1)
|
||||
parent1 = new /datum/pipeline()
|
||||
parent1.build_pipeline(src)
|
||||
|
||||
if(!parent2)
|
||||
parent2 = new /datum/pipeline()
|
||||
parent2.build_pipeline(src)
|
||||
|
||||
/obj/machinery/atmospherics/binary/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference == node1)
|
||||
if(istype(node1, /obj/machinery/atmospherics/pipe))
|
||||
qdel(parent1)
|
||||
node1 = null
|
||||
else if(reference == node2)
|
||||
if(istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
qdel(parent2)
|
||||
node2 = null
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/nullifyPipenet(datum/pipeline/P)
|
||||
..()
|
||||
if(P == parent1)
|
||||
parent1.other_airs -= air1
|
||||
parent1 = null
|
||||
else if(P == parent2)
|
||||
parent2.other_airs -= air2
|
||||
parent2 = null
|
||||
|
||||
/obj/machinery/atmospherics/binary/returnPipenetAir(datum/pipeline/P)
|
||||
if(P == parent1)
|
||||
return air1
|
||||
else if(P == parent2)
|
||||
return air2
|
||||
|
||||
/obj/machinery/atmospherics/binary/pipeline_expansion(datum/pipeline/P)
|
||||
if(P)
|
||||
if(parent1 == P)
|
||||
return list(node1)
|
||||
else if(parent2 == P)
|
||||
return list(node2)
|
||||
else
|
||||
return list(node1, node2)
|
||||
|
||||
/obj/machinery/atmospherics/binary/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
|
||||
if(A == node1)
|
||||
parent1 = P
|
||||
else if(A == node2)
|
||||
parent2 = P
|
||||
|
||||
/obj/machinery/atmospherics/binary/returnPipenet(obj/machinery/atmospherics/A)
|
||||
if(A == node1)
|
||||
return parent1
|
||||
else if(A == node2)
|
||||
return parent2
|
||||
|
||||
/obj/machinery/atmospherics/binary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
|
||||
if(Old == parent1)
|
||||
parent1 = New
|
||||
else if(Old == parent2)
|
||||
parent2 = New
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/unsafe_pressure_release(var/mob/user,var/pressures)
|
||||
..()
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(T)
|
||||
//Remove the gas from air1+air2 and assume it
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/lost = pressures*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
lost += pressures*environment.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
|
||||
var/shared_loss = lost/2
|
||||
|
||||
var/datum/gas_mixture/to_release = air1.remove(shared_loss)
|
||||
to_release.merge(air2.remove(shared_loss))
|
||||
T.assume_air(to_release)
|
||||
air_update_turf(1)
|
||||
var/list/node_connects = new/list()
|
||||
node_connects.Add(node1_connect, node2_connect)
|
||||
..(node_connects)
|
||||
@@ -2,10 +2,9 @@
|
||||
//node1, air1, network1 correspond to output
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator
|
||||
/obj/machinery/atmospherics/components/binary/circulator
|
||||
name = "circulator/heat exchanger"
|
||||
desc = "A gas circulator pump and heat exchanger."
|
||||
icon = 'icons/obj/atmospherics/pipes/simple.dmi'
|
||||
icon_state = "circ1-off"
|
||||
|
||||
var/side = 1 // 1=left 2=right
|
||||
@@ -17,8 +16,10 @@
|
||||
density = 1
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
|
||||
/obj/machinery/atmospherics/components/binary/circulator/proc/return_transfer_air()
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
var/datum/gas_mixture/air2 = airs[AIR2]
|
||||
|
||||
var/output_starting_pressure = air1.return_pressure()
|
||||
var/input_starting_pressure = air2.return_pressure()
|
||||
@@ -41,20 +42,18 @@
|
||||
//Actually transfer the gas
|
||||
var/datum/gas_mixture/removed = air2.remove(transfer_moles)
|
||||
|
||||
parent1.update = 1
|
||||
|
||||
parent2.update = 1
|
||||
update_parents()
|
||||
|
||||
return removed
|
||||
|
||||
else
|
||||
last_pressure_delta = 0
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/process_atmos()
|
||||
/obj/machinery/atmospherics/components/binary/circulator/process_atmos()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/update_icon()
|
||||
/obj/machinery/atmospherics/components/binary/circulator/update_icon()
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
icon_state = "circ[side]-p"
|
||||
else if(last_pressure_delta > 0)
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump
|
||||
icon = 'icons/obj/atmospherics/unary_devices.dmi' //We reuse the normal vent icons!
|
||||
/*
|
||||
Acts like a normal vent, but has an input AND output.
|
||||
*/
|
||||
#define EXT_BOUND 1
|
||||
#define INPUT_MIN 2
|
||||
#define OUTPUT_MAX 4
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump
|
||||
icon = 'icons/obj/atmospherics/components/unary_devices.dmi' //We reuse the normal vent icons!
|
||||
icon_state = "dpvent_map"
|
||||
|
||||
//node2 is output port
|
||||
@@ -20,29 +27,30 @@
|
||||
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
|
||||
var/pressure_checks = EXT_BOUND
|
||||
//EXT_BOUND: Do not pass external_pressure_bound
|
||||
//INPUT_MIN: Do not pass input_pressure_min
|
||||
//OUTPUT_MAX: Do not pass output_pressure_max
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/Destroy()
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/Destroy()
|
||||
if(radio_controller)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume
|
||||
name = "large dual-port air vent"
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume/New()
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume/New()
|
||||
..()
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
var/datum/gas_mixture/air2 = airs[AIR2]
|
||||
air1.volume = 1000
|
||||
air2.volume = 1000
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes()
|
||||
overlays.Cut()
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "dpvent_cap")
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "dpvent_cap")
|
||||
|
||||
if(!on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "vent_off"
|
||||
@@ -53,11 +61,13 @@
|
||||
else
|
||||
icon_state = "vent_in"
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/process_atmos()
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/process_atmos()
|
||||
..()
|
||||
|
||||
if(!on)
|
||||
return 0
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
var/datum/gas_mixture/air2 = airs[AIR2]
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
@@ -65,9 +75,9 @@
|
||||
if(pump_direction) //input -> external
|
||||
var/pressure_delta = 10000
|
||||
|
||||
if(pressure_checks&1)
|
||||
if(pressure_checks&EXT_BOUND)
|
||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||
if(pressure_checks&2)
|
||||
if(pressure_checks&INPUT_MIN)
|
||||
pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min))
|
||||
|
||||
if(pressure_delta > 0)
|
||||
@@ -79,14 +89,15 @@
|
||||
loc.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
var/datum/pipeline/parent1 = parents[PARENT1]
|
||||
parent1.update = 1
|
||||
|
||||
else //external -> output
|
||||
var/pressure_delta = 10000
|
||||
|
||||
if(pressure_checks&1)
|
||||
if(pressure_checks&EXT_BOUND)
|
||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||
if(pressure_checks&4)
|
||||
if(pressure_checks&INPUT_MIN)
|
||||
pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure()))
|
||||
|
||||
if(pressure_delta > 0)
|
||||
@@ -98,19 +109,20 @@
|
||||
air2.merge(removed)
|
||||
air_update_turf()
|
||||
|
||||
var/datum/pipeline/parent2 = parents[PARENT2]
|
||||
parent2.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/proc/set_frequency(new_frequency)
|
||||
/obj/machinery/atmospherics/components/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()
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
@@ -133,16 +145,16 @@
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/atmosinit()
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/atmosinit()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/initialize()
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/initialize()
|
||||
..()
|
||||
broadcast_status()
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/receive_signal(datum/signal/signal)
|
||||
/obj/machinery/atmospherics/components/binary/dp_vent_pump/receive_signal(datum/signal/signal)
|
||||
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
@@ -195,3 +207,7 @@
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
|
||||
#undef EXT_BOUND
|
||||
#undef INPUT_MIN
|
||||
#undef OUTPUT_MAX
|
||||
@@ -7,7 +7,7 @@ Passive gate is similar to the regular pump except:
|
||||
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate
|
||||
icon_state = "passgate_map"
|
||||
|
||||
name = "passive gate"
|
||||
@@ -22,24 +22,27 @@ Passive gate is similar to the regular pump except:
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/Destroy()
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/Destroy()
|
||||
if(radio_controller)
|
||||
radio_controller.remove_object(src,frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/update_icon_nopipes()
|
||||
if(!on)
|
||||
icon_state = "passgate_off"
|
||||
overlays.Cut()
|
||||
return
|
||||
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "passgate_on")
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/binary_devices.dmi', "passgate_on")
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/process_atmos()
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
var/datum/gas_mixture/air2 = airs[AIR2]
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
|
||||
@@ -59,20 +62,18 @@ Passive gate is similar to the regular pump except:
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
|
||||
parent1.update = 1
|
||||
|
||||
parent2.update = 1
|
||||
update_parents()
|
||||
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/proc/set_frequency(new_frequency)
|
||||
/obj/machinery/atmospherics/components/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)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/proc/broadcast_status()
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
@@ -92,25 +93,25 @@ Passive gate is similar to the regular pump except:
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_gas_pump.tmpl", name, 400, 120, 0)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/get_ui_data()
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/get_ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
data["max_pressure"] = MAX_OUTPUT_PRESSURE
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/atmosinit()
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/atmosinit()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/receive_signal(datum/signal/signal)
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
@@ -144,7 +145,7 @@ Passive gate is similar to the regular pump except:
|
||||
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/attack_hand(user as mob)
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
@@ -155,7 +156,7 @@ Passive gate is similar to the regular pump except:
|
||||
ui_interact(user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/Topic(href,href_list)
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
@@ -172,13 +173,13 @@ Passive gate is similar to the regular pump except:
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/power_change()
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/passive_gate/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
/obj/machinery/atmospherics/components/binary/passive_gate/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (on)
|
||||
|
||||
@@ -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/components/binary/pump
|
||||
icon_state = "pump_map"
|
||||
name = "gas pump"
|
||||
desc = "A pump"
|
||||
@@ -26,28 +26,31 @@ Thus, the two variables affect pump operation are set in New():
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/Destroy()
|
||||
/obj/machinery/atmospherics/components/binary/pump/Destroy()
|
||||
if(radio_controller)
|
||||
radio_controller.remove_object(src,frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/on
|
||||
/obj/machinery/atmospherics/components/binary/pump/on
|
||||
on = 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/binary/pump/update_icon_nopipes()
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "pump_off"
|
||||
return
|
||||
|
||||
icon_state = "pump_[on?"on":"off"]"
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/process_atmos()
|
||||
/obj/machinery/atmospherics/components/binary/pump/process_atmos()
|
||||
// ..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return 0
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
var/datum/gas_mixture/air2 = airs[AIR2]
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
|
||||
if( (target_pressure - output_starting_pressure) < 0.01)
|
||||
@@ -63,21 +66,18 @@ Thus, the two variables affect pump operation are set in New():
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
|
||||
parent1.update = 1
|
||||
|
||||
|
||||
parent2.update = 1
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
//Radio remote control
|
||||
/obj/machinery/atmospherics/binary/pump/proc/set_frequency(new_frequency)
|
||||
/obj/machinery/atmospherics/components/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)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/proc/broadcast_status()
|
||||
/obj/machinery/atmospherics/components/binary/pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
@@ -97,25 +97,25 @@ Thus, the two variables affect pump operation are set in New():
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/components/binary/pump/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_gas_pump.tmpl", name, 400, 120, 0)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/get_ui_data()
|
||||
/obj/machinery/atmospherics/components/binary/pump/get_ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
data["max_pressure"] = MAX_OUTPUT_PRESSURE
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/atmosinit()
|
||||
/obj/machinery/atmospherics/components/binary/pump/atmosinit()
|
||||
..()
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/receive_signal(datum/signal/signal)
|
||||
/obj/machinery/atmospherics/components/binary/pump/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
@@ -148,7 +148,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attack_hand(user as mob)
|
||||
/obj/machinery/atmospherics/components/binary/pump/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
@@ -159,7 +159,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
ui_interact(user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/Topic(href,href_list)
|
||||
/obj/machinery/atmospherics/components/binary/pump/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
@@ -176,11 +176,11 @@ Thus, the two variables affect pump operation are set in New():
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/power_change()
|
||||
/obj/machinery/atmospherics/components/binary/pump/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
/obj/machinery/atmospherics/components/binary/pump/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
|
||||
@@ -1,89 +1,72 @@
|
||||
/obj/machinery/atmospherics/binary/valve
|
||||
icon = 'icons/obj/atmospherics/binary_devices.dmi'
|
||||
/*
|
||||
It's like a regular ol' straight pipe, but you can turn it on and off.
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/valve
|
||||
icon_state = "mvalve_map"
|
||||
name = "manual valve"
|
||||
desc = "A pipe valve"
|
||||
|
||||
can_unwrench = 1
|
||||
var/open = 0
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/open
|
||||
var/open = 0
|
||||
var/valve_type = "m" //lets us have a nice, clean, OOP update_icon_nopipes()
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/valve/open
|
||||
open = 1
|
||||
|
||||
//Separate this because we don't need to update pipe icons if we just are going to crank the handle
|
||||
/obj/machinery/atmospherics/binary/valve/update_icon_nopipes(animation = 0)
|
||||
/obj/machinery/atmospherics/components/binary/valve/update_icon_nopipes(animation = 0)
|
||||
normalize_dir()
|
||||
icon_state = "mvalve_off"
|
||||
overlays.Cut()
|
||||
if(animation)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "mvalve_[open][!open]")
|
||||
else if(open)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "mvalve_on")
|
||||
flick("[valve_type]valve_[open][!open]",src)
|
||||
icon_state = "[valve_type]valve_[open?"on":"off"]"
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/update_icon()
|
||||
update_icon_nopipes()
|
||||
var/connected = 0
|
||||
underlays.Cut()
|
||||
//Add non-broken pieces
|
||||
if(node1)
|
||||
connected = icon_addintact(node1, connected)
|
||||
if(node2)
|
||||
connected = icon_addintact(node2, connected)
|
||||
//Add broken pieces
|
||||
icon_addbroken(connected)
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/proc/open()
|
||||
/obj/machinery/atmospherics/components/binary/valve/proc/open()
|
||||
open = 1
|
||||
update_icon_nopipes()
|
||||
parent1.update = 0
|
||||
parent2.update = 0
|
||||
update_parents()
|
||||
var/datum/pipeline/parent1 = parents[PARENT1]
|
||||
parent1.reconcile_air()
|
||||
investigate_log("was opened by [usr ? key_name(usr) : "a remote signal"]", "atmos")
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/proc/close()
|
||||
/obj/machinery/atmospherics/components/binary/valve/proc/close()
|
||||
open = 0
|
||||
update_icon_nopipes()
|
||||
investigate_log("was closed by [usr ? key_name(usr) : "a remote signal"]", "atmos")
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/valve/proc/normalize_dir()
|
||||
if(dir==SOUTH)
|
||||
dir = NORTH
|
||||
else if(dir==WEST)
|
||||
dir = EAST
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/valve/attack_ai(mob/user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/proc/normalize_dir()
|
||||
if(dir==2)
|
||||
dir = 1
|
||||
else if(dir==8)
|
||||
dir = 4
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/attack_ai(mob/user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/attack_hand(mob/user)
|
||||
/obj/machinery/atmospherics/components/binary/valve/attack_hand(mob/user)
|
||||
add_fingerprint(usr)
|
||||
update_icon_nopipes(1)
|
||||
sleep(10)
|
||||
if(open)
|
||||
close()
|
||||
else
|
||||
open()
|
||||
return
|
||||
open()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/digital // can be controlled by AI
|
||||
/obj/machinery/atmospherics/components/binary/valve/digital // can be controlled by AI
|
||||
name = "digital valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon_state = "dvalve_map"
|
||||
valve_type = "d"
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/digital/attack_ai(mob/user)
|
||||
/obj/machinery/atmospherics/components/binary/valve/digital/attack_ai(mob/user)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/digital/update_icon_nopipes(animation)
|
||||
normalize_dir()
|
||||
/obj/machinery/atmospherics/components/binary/valve/digital/update_icon_nopipes(animation)
|
||||
if(stat & NOPOWER)
|
||||
normalize_dir()
|
||||
icon_state = "dvalve_nopower"
|
||||
overlays.Cut()
|
||||
return
|
||||
icon_state = "dvalve_off"
|
||||
overlays.Cut()
|
||||
if(animation)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "dvalve_[open][!open]")
|
||||
else if(open)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "dvalve_on")
|
||||
..()
|
||||
|
||||
@@ -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/components/binary/volume_pump
|
||||
icon_state = "volpump_map"
|
||||
name = "volumetric gas pump"
|
||||
desc = "A volumetric pump"
|
||||
@@ -26,28 +26,31 @@ Thus, the two variables affect pump operation are set in New():
|
||||
var/id = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/Destroy()
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/Destroy()
|
||||
if(radio_controller)
|
||||
radio_controller.remove_object(src,frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/on
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/on
|
||||
on = 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/update_icon_nopipes()
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "volpump_off"
|
||||
return
|
||||
|
||||
icon_state = "volpump_[on?"on":"off"]"
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/process_atmos()
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/process_atmos()
|
||||
// ..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
var/datum/gas_mixture/air2 = airs[AIR2]
|
||||
|
||||
// Pump mechanism just won't do anything if the pressure is too high/too low
|
||||
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
@@ -62,19 +65,17 @@ Thus, the two variables affect pump operation are set in New():
|
||||
|
||||
air2.merge(removed)
|
||||
|
||||
parent1.update = 1
|
||||
|
||||
parent2.update = 1
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/proc/set_frequency(new_frequency)
|
||||
/obj/machinery/atmospherics/components/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()
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
@@ -93,25 +94,25 @@ Thus, the two variables affect pump operation are set in New():
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_gas_pump.tmpl", name, 400, 120, 0)
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/get_ui_data()
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/get_ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["transfer_rate"] = round(transfer_rate*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
data["max_rate"] = MAX_TRANSFER_RATE
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/atmosinit()
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/atmosinit()
|
||||
..()
|
||||
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/receive_signal(datum/signal/signal)
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
@@ -124,6 +125,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
on = !on
|
||||
|
||||
if("set_transfer_rate" in signal.data)
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
transfer_rate = Clamp(
|
||||
text2num(signal.data["set_transfer_rate"]),
|
||||
0,
|
||||
@@ -143,7 +145,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/attack_hand(user as mob)
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
src.add_fingerprint(usr)
|
||||
@@ -154,7 +156,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
ui_interact(user)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/Topic(href,href_list)
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
@@ -171,13 +173,13 @@ Thus, the two variables affect pump operation are set in New():
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/power_change()
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
/obj/machinery/atmospherics/components/binary/volume_pump/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
So much of atmospherics.dm was used solely by components, so separating this makes things all a lot cleaner.
|
||||
On top of that, now people can add component-speciic procs/vars if they want!
|
||||
*/
|
||||
|
||||
#define UNARY 1
|
||||
#define BINARY 2
|
||||
#define TRINARY 3
|
||||
|
||||
#define AIR1 "a1"
|
||||
#define AIR2 "a2"
|
||||
#define AIR3 "a3"
|
||||
|
||||
#define PARENT1 "p1"
|
||||
#define PARENT2 "p2"
|
||||
#define PARENT3 "p3"
|
||||
|
||||
#define NODE1 "n1"
|
||||
#define NODE2 "n2"
|
||||
#define NODE3 "n3"
|
||||
|
||||
/obj/machinery/atmospherics/components/
|
||||
var/welded = 0 //Used on pumps and scrubbers
|
||||
var/showpipe = 0
|
||||
|
||||
var/device_type = 0//used for initialization stuff
|
||||
//UNARY = 1
|
||||
//BINARY = 2
|
||||
//TRINARY = 3
|
||||
|
||||
var/list/obj/machinery/atmospherics/nodes = list()
|
||||
var/list/datum/pipeline/parents = list()
|
||||
var/list/datum/gas_mixture/airs = list()
|
||||
|
||||
/obj/machinery/atmospherics/components/New()
|
||||
..()
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
var/datum/gas_mixture/A = new
|
||||
A.volume = 200
|
||||
airs["a[I]"] = A
|
||||
/*
|
||||
Iconnery
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/icon_addintact(var/obj/machinery/atmospherics/node, var/connected = 0)
|
||||
var/image/img = getpipeimage('icons/obj/atmospherics/components/binary_devices.dmi', "pipe_intact", get_dir(src,node), node.pipe_color)
|
||||
underlays += img
|
||||
|
||||
return connected | img.dir
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/icon_addbroken(var/connected = 0)
|
||||
var/unconnected = (~connected) & initialize_directions
|
||||
for(var/direction in cardinal)
|
||||
if(unconnected & direction)
|
||||
underlays += getpipeimage('icons/obj/atmospherics/components/binary_devices.dmi', "pipe_exposed", direction)
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/update_icon_nopipes()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/update_icon() //not working
|
||||
update_icon_nopipes()
|
||||
|
||||
underlays.Cut()
|
||||
if(!showpipe)
|
||||
return //no need to update the pipes if they aren't showing
|
||||
|
||||
var/connected = 0
|
||||
|
||||
for(var/I = 1; I <= device_type; I++) //adds intact pieces
|
||||
if(nodes["n[I]"])
|
||||
connected = icon_addintact(nodes["n[I]"], connected)
|
||||
|
||||
icon_addbroken(connected) //adds broken pieces
|
||||
|
||||
|
||||
/*
|
||||
Pipenet stuff; housekeeping
|
||||
*/
|
||||
/obj/machinery/atmospherics/components/Destroy()
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
var/obj/machinery/atmospherics/N = nodes["n[I]"]
|
||||
if(N)
|
||||
N.disconnect(src)
|
||||
N = null
|
||||
nullifyPipenet(parents["p[I]"])
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/components/atmosinit(var/list/node_connects)
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[I]))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
nodes["n[I]"] = target
|
||||
break
|
||||
if(level == 2)
|
||||
showpipe = 1
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/components/construction()
|
||||
..()
|
||||
update_parents()
|
||||
|
||||
/obj/machinery/atmospherics/components/build_network()
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
if(!parents["p[I]"])
|
||||
parents["p[I]"] = new /datum/pipeline()
|
||||
var/datum/pipeline/P = parents["p[I]"]
|
||||
P.build_pipeline(src)
|
||||
|
||||
/obj/machinery/atmospherics/components/disconnect(obj/machinery/atmospherics/reference)
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
if(reference == nodes["n[I]"])
|
||||
if(istype(nodes["n[I]"], /obj/machinery/atmospherics/pipe))
|
||||
qdel(parents["p[I]"])
|
||||
parents["p[I]"] = null
|
||||
break
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/components/nullifyPipenet(datum/pipeline/reference)
|
||||
..()
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
if(reference == parents["p[I]"])
|
||||
var/datum/pipeline/P = parents["p[I]"]
|
||||
P.other_airs -= airs["a[I]"]
|
||||
P = null
|
||||
break
|
||||
|
||||
/obj/machinery/atmospherics/components/returnPipenetAir(datum/pipeline/reference)
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
if(reference == parents["p[I]"])
|
||||
return airs["a[I]"]
|
||||
|
||||
/obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/reference)
|
||||
if(reference)
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
if(nodes["n[I]"])
|
||||
if(parents["p[I]"] == reference)
|
||||
return list("n" = nodes["n[I]"])
|
||||
|
||||
var/list/obj/machinery/atmospherics/return_nodes = list()
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
return_nodes += nodes["n[I]"]
|
||||
|
||||
return return_nodes
|
||||
|
||||
/obj/machinery/atmospherics/components/setPipenet(datum/pipeline/reference, obj/machinery/atmospherics/A)
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
if(A == nodes["n[I]"])
|
||||
parents["p[I]"] = reference
|
||||
break
|
||||
|
||||
/obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A)
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
if(A == nodes["n[I]"])
|
||||
return parents["p[I]"]
|
||||
|
||||
/obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
|
||||
for(var/datum/pipeline/P in parents)
|
||||
if(Old == P)
|
||||
P = New
|
||||
break
|
||||
|
||||
/obj/machinery/atmospherics/components/unsafe_pressure_release(var/mob/user, var/pressures) //untestable; I'll fix this last
|
||||
..()
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(T)
|
||||
//Remove the gas from airs and assume it
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/lost = null
|
||||
var/times_lost = 0
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
var/datum/gas_mixture/air = airs["a[I]"]
|
||||
lost += pressures*environment.volume/(air.temperature * R_IDEAL_GAS_EQUATION)
|
||||
times_lost++
|
||||
var/shared_loss = lost/times_lost
|
||||
|
||||
var/datum/gas_mixture/to_release
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
var/datum/gas_mixture/air = airs["a[I]"]
|
||||
if(!to_release)
|
||||
to_release = air.remove(shared_loss)
|
||||
continue
|
||||
to_release.merge(air.remove(shared_loss))
|
||||
T.assume_air(to_release)
|
||||
air_update_turf(1)
|
||||
|
||||
/*
|
||||
I think this is NanoUI?
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/safe_input(var/title, var/text, var/default_set)
|
||||
var/new_value = input(usr,text,title,default_set) as num
|
||||
if(usr.canUseTopic(src))
|
||||
return new_value
|
||||
return default_set
|
||||
|
||||
/*
|
||||
Helpers
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/update_parents()
|
||||
for(var/I = 1; I <= device_type; I++)
|
||||
var/datum/pipeline/parent = parents["p[I]"]
|
||||
parent.update = 1
|
||||
@@ -5,7 +5,7 @@
|
||||
#define FILTER_CARBONDIOXIDE 3
|
||||
#define FILTER_NITROUSOXIDE 4
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter
|
||||
/obj/machinery/atmospherics/components/trinary/filter
|
||||
icon_state = "filter_off"
|
||||
density = 0
|
||||
|
||||
@@ -28,35 +28,47 @@ Filter types:
|
||||
1: Oxygen: Oxygen ONLY
|
||||
2: Nitrogen: Nitrogen ONLY
|
||||
3: Carbon Dioxide: Carbon Dioxide ONLY
|
||||
4: Sleeping Agent (N2O)
|
||||
4: Sleeping Agent (NODE2O)
|
||||
*/
|
||||
|
||||
var/frequency = 0
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/flipped
|
||||
/obj/machinery/atmospherics/components/trinary/filter/flipped
|
||||
icon_state = "filter_off_f"
|
||||
flipped = 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/proc/set_frequency(new_frequency)
|
||||
/obj/machinery/atmospherics/components/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)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/Destroy()
|
||||
/obj/machinery/atmospherics/components/trinary/filter/Destroy()
|
||||
if(radio_controller)
|
||||
radio_controller.remove_object(src,frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/update_icon_nopipes()
|
||||
if(!(stat & NOPOWER) && on && node1 && node2 && node3)
|
||||
/obj/machinery/atmospherics/components/trinary/filter/update_icon()
|
||||
overlays.Cut()
|
||||
for(var/direction in cardinal)
|
||||
if(direction & initialize_directions)
|
||||
var/obj/machinery/atmospherics/node = findConnecting(direction)
|
||||
if(node)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/trinary_devices.dmi', "cap", direction, node.pipe_color)
|
||||
continue
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/trinary_devices.dmi', "cap", direction)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes()
|
||||
|
||||
if(!(stat & NOPOWER) && on && nodes[NODE1] && nodes[NODE2] && nodes[NODE3])
|
||||
icon_state = "filter_on[flipped?"_f":""]"
|
||||
return
|
||||
|
||||
icon_state = "filter_off[flipped?"_f":""]"
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/power_change()
|
||||
/obj/machinery/atmospherics/components/trinary/filter/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
@@ -64,10 +76,16 @@ Filter types:
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/process_atmos()
|
||||
/obj/machinery/atmospherics/components/trinary/filter/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
if(!(nodes[NODE1] && nodes[NODE2] && nodes[NODE3]))
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
var/datum/gas_mixture/air2 = airs[AIR2]
|
||||
var/datum/gas_mixture/air3 = airs[AIR3]
|
||||
|
||||
var/output_starting_pressure = air3.return_pressure()
|
||||
|
||||
@@ -130,19 +148,15 @@ Filter types:
|
||||
air2.merge(filtered_out)
|
||||
air3.merge(removed)
|
||||
|
||||
parent2.update = 1
|
||||
|
||||
parent3.update = 1
|
||||
|
||||
parent1.update = 1
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/atmosinit()
|
||||
/obj/machinery/atmospherics/components/trinary/filter/atmosinit()
|
||||
set_frequency(frequency)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob)
|
||||
/obj/machinery/atmospherics/components/trinary/filter/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
|
||||
@@ -152,13 +166,13 @@ Filter types:
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/components/trinary/filter/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_filter.tmpl", name, 400, 320, 0)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/get_ui_data()
|
||||
/obj/machinery/atmospherics/components/trinary/filter/get_ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
@@ -166,7 +180,7 @@ Filter types:
|
||||
data["filter_type"] = filter_type
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/Topic(href, href_list)
|
||||
/obj/machinery/atmospherics/components/trinary/filter/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/trinary/mixer
|
||||
/obj/machinery/atmospherics/components/trinary/mixer
|
||||
icon_state = "mixer_off"
|
||||
density = 0
|
||||
|
||||
@@ -16,19 +16,29 @@
|
||||
|
||||
//node 3 is the outlet, nodes 1 & 2 are intakes
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/flipped
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/flipped
|
||||
icon_state = "mixer_off_f"
|
||||
flipped = 1
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/update_icon()
|
||||
overlays.Cut()
|
||||
for(var/direction in cardinal)
|
||||
if(direction & initialize_directions)
|
||||
var/obj/machinery/atmospherics/node = findConnecting(direction)
|
||||
if(node)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/trinary_devices.dmi', "cap", direction, node.pipe_color)
|
||||
continue
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/trinary_devices.dmi', "cap", direction)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/update_icon_nopipes()
|
||||
if(!(stat & NOPOWER) && on && node1 && node2 && node3)
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes()
|
||||
if(!(stat & NOPOWER) && on && nodes[NODE1] && nodes[NODE2] && nodes[NODE3])
|
||||
icon_state = "mixer_on[flipped?"_f":""]"
|
||||
return
|
||||
|
||||
icon_state = "mixer_off[flipped?"_f":""]"
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/power_change()
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
@@ -36,14 +46,22 @@
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/New()
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air3 = airs[AIR3]
|
||||
air3.volume = 300
|
||||
airs[AIR3] = air3
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/process_atmos()
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
if(!(nodes[NODE1] && nodes[NODE2] && nodes[NODE3]))
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[AIR1]
|
||||
var/datum/gas_mixture/air2 = airs[AIR2]
|
||||
var/datum/gas_mixture/air3 = airs[AIR3]
|
||||
|
||||
var/output_starting_pressure = air3.return_pressure()
|
||||
|
||||
@@ -89,16 +107,19 @@
|
||||
air3.merge(removed2)
|
||||
|
||||
if(transfer_moles1)
|
||||
var/datum/pipeline/parent1 = parents[PARENT1]
|
||||
parent1.update = 1
|
||||
|
||||
if(transfer_moles2)
|
||||
var/datum/pipeline/parent2 = parents[PARENT2]
|
||||
parent2.update = 1
|
||||
|
||||
var/datum/pipeline/parent3 = parents[PARENT3]
|
||||
parent3.update = 1
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob)
|
||||
/obj/machinery/atmospherics/components/trinary/mxer/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
|
||||
@@ -108,13 +129,13 @@
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "atmos_mixer.tmpl", name, 400, 320, 0)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/get_ui_data()
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/get_ui_data()
|
||||
var/data = list()
|
||||
data["on"] = on
|
||||
data["pressure_set"] = round(target_pressure*100) //Nano UI can't handle rounded non-integers, apparently.
|
||||
@@ -123,7 +144,7 @@
|
||||
data["node2_concentration"] = round(node2_concentration*100)
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/Topic(href,href_list)
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["power"])
|
||||
on = !on
|
||||
|
||||
@@ -1,35 +1,13 @@
|
||||
/obj/machinery/atmospherics/trinary
|
||||
icon = 'icons/obj/atmospherics/trinary_devices.dmi'
|
||||
/obj/machinery/atmospherics/components/trinary
|
||||
icon = 'icons/obj/atmospherics/components/trinary_devices.dmi'
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
use_power = 1
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
var/datum/gas_mixture/air3
|
||||
|
||||
var/obj/machinery/atmospherics/node1
|
||||
var/obj/machinery/atmospherics/node2
|
||||
var/obj/machinery/atmospherics/node3
|
||||
|
||||
var/datum/pipeline/parent1
|
||||
var/datum/pipeline/parent2
|
||||
var/datum/pipeline/parent3
|
||||
device_type = TRINARY
|
||||
|
||||
var/flipped = 0
|
||||
|
||||
/obj/machinery/atmospherics/trinary/New()
|
||||
..()
|
||||
|
||||
air1 = new
|
||||
air2 = new
|
||||
air3 = new
|
||||
|
||||
air1.volume = 200
|
||||
air2.volume = 200
|
||||
air3.volume = 200
|
||||
|
||||
/obj/machinery/atmospherics/trinary/SetInitDirections()
|
||||
/obj/machinery/atmospherics/components/trinary/SetInitDirections()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
initialize_directions = EAST|NORTH|SOUTH
|
||||
@@ -39,62 +17,12 @@
|
||||
initialize_directions = EAST|WEST|SOUTH
|
||||
if(WEST)
|
||||
initialize_directions = WEST|NORTH|EAST
|
||||
/*
|
||||
Iconnery
|
||||
*/
|
||||
/obj/machinery/atmospherics/trinary/proc/update_icon_nopipes()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/trinary/icon_addintact(var/obj/machinery/atmospherics/node, var/connected)
|
||||
var/image/img = getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "intact", get_dir(src,node), node.pipe_color)
|
||||
overlays += img
|
||||
|
||||
return connected | img.dir
|
||||
|
||||
/obj/machinery/atmospherics/trinary/icon_addbroken(var/connected)
|
||||
var/unconnected = (~connected) & initialize_directions
|
||||
for(var/direction in cardinal)
|
||||
if(unconnected & direction)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "intact", direction)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/update_icon()
|
||||
update_icon_nopipes()
|
||||
|
||||
var/connected = 0
|
||||
overlays.Cut()
|
||||
|
||||
//Add non-broken pieces
|
||||
if(node1)
|
||||
connected = icon_addintact(node1, connected)
|
||||
|
||||
if(node2)
|
||||
connected = icon_addintact(node2, connected)
|
||||
|
||||
if(node3)
|
||||
connected = icon_addintact(node3, connected)
|
||||
|
||||
//Add broken pieces
|
||||
icon_addbroken(connected)
|
||||
|
||||
/*
|
||||
Housekeeping and pipe network stuff below
|
||||
Housekeeping and pipe network stuff
|
||||
*/
|
||||
/obj/machinery/atmospherics/trinary/Destroy()
|
||||
if(node1)
|
||||
node1.disconnect(src)
|
||||
node1 = null
|
||||
nullifyPipenet(parent1)
|
||||
if(node2)
|
||||
node2.disconnect(src)
|
||||
node2 = null
|
||||
nullifyPipenet(parent2)
|
||||
if(node3)
|
||||
node3.disconnect(src)
|
||||
node3 = null
|
||||
nullifyPipenet(parent3)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/atmosinit()
|
||||
/obj/machinery/atmospherics/components/trinary/atmosinit()
|
||||
|
||||
//Mixer:
|
||||
//1 and 2 is input
|
||||
@@ -115,127 +43,7 @@ Housekeeping and pipe network stuff below
|
||||
node1_connect = turn(node1_connect, 180)
|
||||
node3_connect = turn(node3_connect, 180)
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node1 = target
|
||||
break
|
||||
var/list/node_connects = new/list()
|
||||
|
||||
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/construction()
|
||||
..()
|
||||
parent1.update = 1
|
||||
parent2.update = 1
|
||||
parent3.update = 1
|
||||
|
||||
/obj/machinery/atmospherics/trinary/build_network()
|
||||
if(!parent1)
|
||||
parent1 = new /datum/pipeline()
|
||||
parent1.build_pipeline(src)
|
||||
|
||||
if(!parent2)
|
||||
parent2 = new /datum/pipeline()
|
||||
parent2.build_pipeline(src)
|
||||
|
||||
if(!parent3)
|
||||
parent3 = new /datum/pipeline()
|
||||
parent3.build_pipeline(src)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference == node1)
|
||||
if(istype(node1, /obj/machinery/atmospherics/pipe))
|
||||
qdel(parent1)
|
||||
node1 = null
|
||||
else if(reference == node2)
|
||||
if(istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
qdel(parent2)
|
||||
node2 = null
|
||||
else if(reference == node3)
|
||||
if(istype(node3, /obj/machinery/atmospherics/pipe))
|
||||
qdel(parent3)
|
||||
node3 = null
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/trinary/nullifyPipenet(datum/pipeline/P)
|
||||
..()
|
||||
if(P == parent1)
|
||||
parent1.other_airs -= air1
|
||||
parent1 = null
|
||||
else if(P == parent2)
|
||||
parent2.other_airs -= air2
|
||||
parent2 = null
|
||||
else if(P == parent3)
|
||||
parent3.other_airs -= air3
|
||||
parent3 = null
|
||||
|
||||
/obj/machinery/atmospherics/trinary/returnPipenetAir(datum/pipeline/P)
|
||||
if(P == parent1)
|
||||
return air1
|
||||
else if(P == parent2)
|
||||
return air2
|
||||
else if(P == parent3)
|
||||
return air3
|
||||
|
||||
/obj/machinery/atmospherics/trinary/pipeline_expansion(datum/pipeline/P)
|
||||
if(P)
|
||||
if(parent1 == P)
|
||||
return list(node1)
|
||||
else if(parent2 == P)
|
||||
return list(node2)
|
||||
else if(parent3 == P)
|
||||
return list(node3)
|
||||
return list(node1, node2, node3)
|
||||
|
||||
/obj/machinery/atmospherics/trinary/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
|
||||
if(A == node1)
|
||||
parent1 = P
|
||||
else if(A == node2)
|
||||
parent2 = P
|
||||
else if(A == node3)
|
||||
parent3 = P
|
||||
|
||||
/obj/machinery/atmospherics/trinary/returnPipenet(obj/machinery/atmospherics/A)
|
||||
if(A == node1)
|
||||
return parent1
|
||||
else if(A == node2)
|
||||
return parent2
|
||||
else if(A == node3)
|
||||
return parent3
|
||||
|
||||
/obj/machinery/atmospherics/trinary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
|
||||
if(Old == parent1)
|
||||
parent1 = New
|
||||
else if(Old == parent2)
|
||||
parent2 = New
|
||||
else if(Old == parent3)
|
||||
parent3 = New
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/trinary/unsafe_pressure_release(var/mob/user,var/pressures)
|
||||
..()
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(T)
|
||||
//Remove the gas from air1+air2+air3 and assume it
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/lost = pressures*environment.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||
lost += pressures*environment.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
|
||||
lost += pressures*environment.volume/(air3.temperature * R_IDEAL_GAS_EQUATION)
|
||||
var/shared_loss = lost/3
|
||||
|
||||
var/datum/gas_mixture/to_release = air1.remove(shared_loss)
|
||||
to_release.merge(air2.remove(shared_loss))
|
||||
to_release.merge(air3.remove(shared_loss))
|
||||
T.assume_air(to_release)
|
||||
air_update_turf(1)
|
||||
node_connects.Add(node1_connect, node2_connect, node3_connect)
|
||||
..(node_connects)
|
||||
@@ -0,0 +1,246 @@
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer
|
||||
name = "freezer"
|
||||
icon = 'icons/obj/Cryogenic2.dmi'
|
||||
icon_state = "freezer"
|
||||
density = 1
|
||||
var/min_temperature = 0
|
||||
anchored = 1.0
|
||||
use_power = 1
|
||||
current_heat_capacity = 1000
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/thermomachine(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/stack/cable_coil(null, 1)
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/construction()
|
||||
..(dir,dir)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/RefreshParts()
|
||||
var/H
|
||||
var/T
|
||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||
H += M.rating
|
||||
for(var/obj/item/weapon/stock_parts/micro_laser/M in component_parts)
|
||||
T += M.rating
|
||||
min_temperature = T0C - (170 + (T*15))
|
||||
current_heat_capacity = 1000 * ((H - 1) ** 2)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/attackby(obj/item/I, mob/user, params)
|
||||
if(default_deconstruction_screwdriver(user, "freezer-o", "freezer", I))
|
||||
on = 0
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
if(default_change_direction_wrench(user, I))
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/update_icon()
|
||||
if(panel_open)
|
||||
icon_state = "freezer-o"
|
||||
else if(src.on)
|
||||
icon_state = "freezer_1"
|
||||
else
|
||||
icon_state = "freezer"
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/attack_ai(mob/user) return interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/attack_paw(mob/user) return interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/attack_paw(mob/user) return interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/interact(mob/user)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
user.set_machine(src)
|
||||
var/temp_text = ""
|
||||
if(air_contents.temperature > (T0C - 20))
|
||||
temp_text = "<span class='bad'>[air_contents.temperature]</span>"
|
||||
else if(air_contents.temperature < (T0C - 20) && air_contents.temperature > (T0C - 100))
|
||||
temp_text = "<span class='average'>[air_contents.temperature]</span>"
|
||||
else
|
||||
temp_text = "<span class='good'>[air_contents.temperature]</span>"
|
||||
|
||||
var/dat = {"
|
||||
Current Status: [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <span class='linkOn'>On</span>" : "<span class='linkOn'>Off</span> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
|
||||
Current Gas Temperature: [temp_text]<BR>
|
||||
Current Air Pressure: [air_contents.return_pressure()]<BR>
|
||||
Target Gas Temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
|
||||
"}
|
||||
|
||||
//user << browse(dat, "window=freezer;size=400x500")
|
||||
//onclose(user, "freezer")
|
||||
var/datum/browser/popup = new(user, "freezer", "Cryo Gas Cooling System", 400, 240) // Set up the popup browser window
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
if (href_list["start"])
|
||||
src.on = !src.on
|
||||
use_power = 1 + src.on
|
||||
update_icon()
|
||||
if(href_list["temp"])
|
||||
var/amount = text2num(href_list["temp"])
|
||||
if(amount > 0)
|
||||
src.current_temperature = min(T20C, src.current_temperature+amount)
|
||||
else
|
||||
src.current_temperature = max(min_temperature, src.current_temperature+amount)
|
||||
active_power_usage = (current_heat_capacity * (T20C - current_temperature) / 100) + idle_power_usage
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/process()
|
||||
..()
|
||||
src.updateUsrDialog()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/freezer/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
on = 0
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/
|
||||
name = "heater"
|
||||
icon = 'icons/obj/Cryogenic2.dmi'
|
||||
icon_state = "heater"
|
||||
density = 1
|
||||
var/max_temperature = 0
|
||||
anchored = 1.0
|
||||
|
||||
current_heat_capacity = 1000
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
var/obj/item/weapon/circuitboard/thermomachine/H = new /obj/item/weapon/circuitboard/thermomachine(null)
|
||||
H.build_path = /obj/machinery/atmospherics/components/unary/heat_reservoir/heater
|
||||
H.name = "circuit board (Heater)"
|
||||
component_parts = list()
|
||||
component_parts += H
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/stack/cable_coil(null, 1)
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/construction()
|
||||
..(dir,dir)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/RefreshParts()
|
||||
var/H
|
||||
var/T
|
||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||
H += M.rating
|
||||
for(var/obj/item/weapon/stock_parts/micro_laser/M in component_parts)
|
||||
T += M.rating
|
||||
max_temperature = T20C + (140 * T)
|
||||
current_heat_capacity = 1000 * ((H - 1) ** 2)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/attackby(obj/item/I, mob/user, params)
|
||||
if(default_deconstruction_screwdriver(user, "heater-o", "heater", I))
|
||||
on = 0
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
if(default_change_direction_wrench(user, I))
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/update_icon()
|
||||
if(panel_open)
|
||||
icon_state = "heater-o"
|
||||
else if(src.on)
|
||||
icon_state = "heater_1"
|
||||
else
|
||||
icon_state = "heater"
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/attack_ai(mob/user) return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/attack_paw(mob/user) return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/attack_paw(mob/user) return interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/interact(mob/user)
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
user.set_machine(src)
|
||||
var/temp_text = ""
|
||||
if(air_contents.temperature < (T20C + 80))
|
||||
temp_text = "<span class='good'>[air_contents.temperature]</span>"
|
||||
else if(air_contents.temperature > (T20C + 80) && air_contents.temperature < (T20C + 180))
|
||||
temp_text = "<span class='average'>[air_contents.temperature]</span>"
|
||||
else
|
||||
temp_text = "<span class='bad'>[air_contents.temperature]</span>"
|
||||
|
||||
var/dat = {"
|
||||
Current Status: [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <span class='linkOn'>On</span>" : "<span class='linkOn'>Off</span> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
|
||||
Current Gas Temperature: [temp_text]<BR>
|
||||
Current Air Pressure: [air_contents.return_pressure()]<BR>
|
||||
Target Gas Temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
|
||||
"}
|
||||
|
||||
//user << browse(dat, "window=freezer;size=400x500")
|
||||
//onclose(user, "freezer")
|
||||
var/datum/browser/popup = new(user, "freezer", "Pyro Gas Heating System", 400, 240) // Set up the popup browser window
|
||||
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
if (href_list["start"])
|
||||
src.on = !src.on
|
||||
use_power = 1 + src.on
|
||||
update_icon()
|
||||
if(href_list["temp"])
|
||||
var/amount = text2num(href_list["temp"])
|
||||
if(amount > 0)
|
||||
src.current_temperature = min((max_temperature), src.current_temperature+amount)
|
||||
else
|
||||
src.current_temperature = max(T20C, src.current_temperature+amount)
|
||||
active_power_usage = (current_heat_capacity * (current_temperature - T20C) / 100) + idle_power_usage
|
||||
src.updateUsrDialog()
|
||||
src.add_fingerprint(usr)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/process()
|
||||
..()
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
on = 0
|
||||
update_icon()
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/cold_sink
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink
|
||||
|
||||
icon_state = "cold_map"
|
||||
use_power = 1
|
||||
@@ -11,22 +11,24 @@
|
||||
var/current_temperature = T20C
|
||||
var/current_heat_capacity = 50000 //totally random
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/update_icon_nopipes()
|
||||
overlays.Cut()
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now
|
||||
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "cold_off"
|
||||
return
|
||||
|
||||
else
|
||||
icon_state = "cold_on"
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/cold_sink/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
var/old_temperature = air_contents.temperature
|
||||
@@ -36,7 +38,6 @@
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
|
||||
//todo: have current temperature affected. require power to bring down current temperature again
|
||||
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
return 1
|
||||
|
||||
@@ -0,0 +1,344 @@
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell
|
||||
name = "cryo cell"
|
||||
icon = 'icons/obj/cryogenics.dmi'
|
||||
icon_state = "cell-off"
|
||||
density = 1
|
||||
anchored = 1.0
|
||||
layer = 4
|
||||
|
||||
var/on = 0
|
||||
var/temperature_archived
|
||||
var/obj/item/weapon/reagent_containers/beaker = null
|
||||
var/next_trans = 0
|
||||
var/current_heat_capacity = 50
|
||||
state_open = 0
|
||||
var/efficiency
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/cryo_tube(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/stack/cable_coil(null, 1)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/construction()
|
||||
..(dir,dir)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/RefreshParts()
|
||||
var/C
|
||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||
C += M.rating
|
||||
current_heat_capacity = 50 * C
|
||||
efficiency = C
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/Destroy()
|
||||
var/turf/T = loc
|
||||
T.contents += contents
|
||||
|
||||
if(beaker)
|
||||
beaker.loc = get_step(loc, SOUTH) //Beaker is carefully ejected from the wreckage of the cryotube
|
||||
beaker = null
|
||||
..()
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
if(air_contents)
|
||||
temperature_archived = air_contents.temperature
|
||||
heat_gas_contents()
|
||||
if(abs(temperature_archived-air_contents.temperature) > 1)
|
||||
update_parents()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/process()
|
||||
..()
|
||||
if(occupant)
|
||||
if(occupant.health >= 100)
|
||||
on = 0
|
||||
open_machine()
|
||||
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
|
||||
if(!nodes[NODE1] || !is_operational())
|
||||
return
|
||||
|
||||
if(!on)
|
||||
updateDialog()
|
||||
return
|
||||
|
||||
if(airs[AIR1])
|
||||
if (occupant)
|
||||
process_occupant()
|
||||
expel_gas()
|
||||
|
||||
updateDialog()
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/MouseDrop_T(mob/target, mob/user)
|
||||
if(user.stat || user.lying || !Adjacent(user) || !target.Adjacent(user) || !iscarbon(target))
|
||||
return
|
||||
close_machine(target)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(mob/user) open_machine()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/container_resist()
|
||||
open_machine()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/verb/move_eject()
|
||||
set name = "Eject Cryo Cell"
|
||||
set desc = "Begin the release sequence inside the cryo tube."
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
if(usr == occupant || contents.Find(usr)) //If the user is inside the tube...
|
||||
if(usr.stat == DEAD) //and he's not dead....
|
||||
return
|
||||
usr << "<span class='notice'>Release sequence activated. This will take about a minute.</span>"
|
||||
sleep(600)
|
||||
if(!src || !usr || (!occupant && !contents.Find(usr))) //Check if someone's released/replaced/bombed him already
|
||||
return
|
||||
open_machine()
|
||||
add_fingerprint(usr)
|
||||
else
|
||||
if(!istype(usr, /mob/living) || usr.stat)
|
||||
usr << "<span class='warning'>You can't do that!</span>"
|
||||
return
|
||||
open_machine()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/examine(mob/user)
|
||||
..()
|
||||
|
||||
var/list/otherstuff = contents - beaker
|
||||
if(otherstuff.len > 0)
|
||||
user << "You can just about make out some loose objects floating in the murk:"
|
||||
for(var/atom/movable/floater in otherstuff)
|
||||
user << "\icon[floater] [floater.name]"
|
||||
else
|
||||
user << "Seems empty."
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
|
||||
/**
|
||||
* The ui_interact proc is used to open and update Nano UIs
|
||||
* If ui_interact is not used then the UI will not update correctly
|
||||
* ui_interact is currently defined for /atom/movable
|
||||
*
|
||||
* @param user /mob The mob who is interacting with this ui
|
||||
* @param ui_key string A string key to use for this ui. Allows for multiple unique uis on one obj/mob (defaut value "main")
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
/obj/machinery/atmospherics/components/unary/cry_cell/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null)
|
||||
if(user == occupant || user.stat || panel_open)
|
||||
return
|
||||
|
||||
ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "cryo.tmpl", "Cryo Cell Control System", 520, 410, 1)
|
||||
//user.set_machine(src)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/get_ui_data()
|
||||
// this is the data which will be sent to the ui
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
var/data = list()
|
||||
data["isOperating"] = on
|
||||
data["hasOccupant"] = occupant ? 1 : 0
|
||||
|
||||
var/occupantData = list()
|
||||
if (!occupant)
|
||||
occupantData["name"] = null
|
||||
occupantData["stat"] = null
|
||||
occupantData["health"] = null
|
||||
occupantData["maxHealth"] = null
|
||||
occupantData["minHealth"] = null
|
||||
occupantData["bruteLoss"] = null
|
||||
occupantData["oxyLoss"] = null
|
||||
occupantData["toxLoss"] = null
|
||||
occupantData["fireLoss"] = null
|
||||
occupantData["bodyTemperature"] = null
|
||||
else
|
||||
occupantData["name"] = occupant.name
|
||||
occupantData["stat"] = occupant.stat
|
||||
occupantData["health"] = occupant.health
|
||||
occupantData["maxHealth"] = occupant.maxHealth
|
||||
occupantData["minHealth"] = config.health_threshold_dead
|
||||
occupantData["bruteLoss"] = occupant.getBruteLoss()
|
||||
occupantData["oxyLoss"] = occupant.getOxyLoss()
|
||||
occupantData["toxLoss"] = occupant.getToxLoss()
|
||||
occupantData["fireLoss"] = occupant.getFireLoss()
|
||||
occupantData["bodyTemperature"] = occupant.bodytemperature
|
||||
data["occupant"] = occupantData
|
||||
|
||||
data["isOpen"] = state_open
|
||||
data["cellTemperature"] = round(air_contents.temperature)
|
||||
data["cellTemperatureStatus"] = "good"
|
||||
if(air_contents.temperature > T0C) // if greater than 273.15 kelvin (0 celcius)
|
||||
data["cellTemperatureStatus"] = "bad"
|
||||
else if(air_contents.temperature > 225)
|
||||
data["cellTemperatureStatus"] = "average"
|
||||
|
||||
data["isBeakerLoaded"] = beaker ? 1 : 0
|
||||
var beakerContents[0]
|
||||
if(beaker && beaker:reagents && beaker:reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in beaker:reagents.reagent_list)
|
||||
beakerContents.Add(list(list("name" = R.name, "volume" = R.volume))) // list in a list because Byond merges the first list...
|
||||
data["beakerContents"] = beakerContents
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/Topic(href, href_list)
|
||||
if(usr == occupant || panel_open)
|
||||
return 0 // don't update UIs attached to this object
|
||||
|
||||
if(..())
|
||||
return 0 // don't update UIs attached to this object
|
||||
|
||||
if(href_list["switchOn"])
|
||||
if(!state_open)
|
||||
on = 1
|
||||
|
||||
if(href_list["open"])
|
||||
open_machine()
|
||||
|
||||
if(href_list["close"])
|
||||
if(close_machine() == usr)
|
||||
var/datum/nanoui/ui = SSnano.get_open_ui(usr, src, "main")
|
||||
ui.close()
|
||||
on = 1
|
||||
if(href_list["switchOff"])
|
||||
on = 0
|
||||
|
||||
if(href_list["ejectBeaker"])
|
||||
if(beaker)
|
||||
var/obj/item/weapon/reagent_containers/glass/B = beaker
|
||||
B.loc = get_step(loc, SOUTH)
|
||||
beaker = null
|
||||
update_icon()
|
||||
add_fingerprint(usr)
|
||||
return 1 // update UIs attached to this object
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/weapon/reagent_containers/glass))
|
||||
if(isrobot(user))
|
||||
return
|
||||
if(beaker)
|
||||
user << "<span class='warning'>A beaker is already loaded into [src]!</span>"
|
||||
return
|
||||
if(!user.drop_item())
|
||||
return
|
||||
|
||||
beaker = I
|
||||
I.loc = src
|
||||
user.visible_message("[user] places [I] in [src].", \
|
||||
"<span class='notice'>You place [I] in [src].</span>")
|
||||
|
||||
if(!(on || occupant || state_open))
|
||||
if(default_deconstruction_screwdriver(user, "cell-o", "cell-off", I))
|
||||
return
|
||||
|
||||
if(default_change_direction_wrench(user, I))
|
||||
return
|
||||
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
|
||||
if(default_pry_open(I))
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine()
|
||||
if(!state_open && !panel_open)
|
||||
on = 0
|
||||
layer = 3
|
||||
if(occupant)
|
||||
occupant.bodytemperature = Clamp(occupant.bodytemperature, 261, 360)
|
||||
..()
|
||||
if(beaker)
|
||||
beaker.loc = src
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/close_machine(mob/living/carbon/M)
|
||||
if(state_open && !panel_open)
|
||||
layer = 4
|
||||
..(M)
|
||||
return occupant
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/update_icon()
|
||||
if(panel_open)
|
||||
icon_state = "cell-o"
|
||||
return
|
||||
if(state_open)
|
||||
icon_state = "cell-open"
|
||||
return
|
||||
if(on && is_operational())
|
||||
if(occupant)
|
||||
icon_state = "cell-occupied"
|
||||
else
|
||||
icon_state = "cell-on"
|
||||
else
|
||||
icon_state = "cell-off"
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/power_change()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/process_occupant()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
if(air_contents.total_moles() < 10)
|
||||
return
|
||||
if(occupant)
|
||||
if(occupant.stat == 2 || occupant.health >= 100) //Why waste energy on dead or healthy people
|
||||
occupant.bodytemperature = T0C
|
||||
return
|
||||
occupant.bodytemperature += 2*(air_contents.temperature - occupant.bodytemperature) * current_heat_capacity / (current_heat_capacity + air_contents.heat_capacity())
|
||||
occupant.bodytemperature = max(occupant.bodytemperature, air_contents.temperature) // this is so ugly i'm sorry for doing it i'll fix it later i promise //TODO: fix someone else's broken promise - duncathan
|
||||
if(occupant.bodytemperature < T0C)
|
||||
// occupant.sleeping = max(5/efficiency, (1 / occupant.bodytemperature)*2000/efficiency)
|
||||
// occupant.Paralyse(max(5/efficiency, (1 / occupant.bodytemperature)*3000/efficiency))
|
||||
if(air_contents.oxygen > 2)
|
||||
if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1)
|
||||
else
|
||||
occupant.adjustOxyLoss(-1)
|
||||
//severe damage should heal waaay slower without proper chemicals
|
||||
if(occupant.bodytemperature < 225)
|
||||
if(occupant.getToxLoss())
|
||||
occupant.adjustToxLoss(max(-efficiency, (-20*(efficiency ** 2)) / occupant.getToxLoss()))
|
||||
var/heal_brute = occupant.getBruteLoss() ? min(efficiency, 20*(efficiency**2) / occupant.getBruteLoss()) : 0
|
||||
var/heal_fire = occupant.getFireLoss() ? min(efficiency, 20*(efficiency**2) / occupant.getFireLoss()) : 0
|
||||
occupant.heal_organ_damage(heal_brute,heal_fire)
|
||||
if(beaker && next_trans == 0)
|
||||
beaker.reagents.trans_to(occupant, 1, 10)
|
||||
beaker.reagents.reaction(occupant)
|
||||
next_trans++
|
||||
if(next_trans == 10)
|
||||
next_trans = 0
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/heat_gas_contents()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
if(air_contents.total_moles() < 1)
|
||||
return
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = T20C * current_heat_capacity + air_heat_capacity * air_contents.temperature
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/cryo_cell/proc/expel_gas()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
if(air_contents.total_moles() < 1)
|
||||
return
|
||||
var/datum/gas_mixture/expel_gas = new
|
||||
var/remove_amount = air_contents.total_moles() / 100
|
||||
expel_gas = air_contents.remove(remove_amount)
|
||||
expel_gas.temperature = T20C //Lets expel hot gas and see if that helps people not die as they are removed
|
||||
loc.assume_air(expel_gas)
|
||||
air_update_turf()
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/generator_input
|
||||
/obj/machinery/atmospherics/components/unary/generator_input
|
||||
|
||||
icon_state = "he_intact"
|
||||
density = 1
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
var/update_cycle
|
||||
|
||||
/obj/machinery/atmospherics/unary/generator_input/update_icon()
|
||||
if(node)
|
||||
/obj/machinery/atmospherics/components/unary/generator_input/update_icon()
|
||||
if(nodes[NODE1])
|
||||
icon_state = "intact"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/generator_input/proc/return_exchange_air()
|
||||
return air_contents
|
||||
/obj/machinery/atmospherics/components/unary/generator_input/proc/return_exchange_air()
|
||||
return airs[AIR1]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/heat_exchanger
|
||||
/obj/machinery/atmospherics/components/unary/heat_exchanger
|
||||
|
||||
icon_state = "he_intact"
|
||||
|
||||
@@ -7,23 +7,24 @@
|
||||
|
||||
can_unwrench = 1
|
||||
|
||||
var/obj/machinery/atmospherics/unary/heat_exchanger/partner = null
|
||||
var/obj/machinery/atmospherics/components/unary/heat_exchanger/partner = null
|
||||
var/update_cycle
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_exchanger/update_icon()
|
||||
if(node)
|
||||
/obj/machinery/atmospherics/components/unary/heat_exchanger/update_icon()
|
||||
if(nodes[NODE1])
|
||||
icon_state = "he_intact"
|
||||
var/obj/machinery/atmospherics/node = nodes[NODE1]
|
||||
color = node.color
|
||||
else
|
||||
icon_state = "he_exposed"
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_exchanger/atmosinit()
|
||||
/obj/machinery/atmospherics/components/unary/heat_exchanger/atmosinit()
|
||||
if(!partner)
|
||||
var/partner_connect = turn(dir,180)
|
||||
|
||||
for(var/obj/machinery/atmospherics/unary/heat_exchanger/target in get_step(src,partner_connect))
|
||||
for(var/obj/machinery/atmospherics/components/unary/heat_exchanger/target in get_step(src,partner_connect))
|
||||
if(target.dir & get_dir(src,target))
|
||||
partner = target
|
||||
partner.partner = src
|
||||
@@ -31,7 +32,7 @@
|
||||
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_exchanger/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/heat_exchanger/process_atmos()
|
||||
..()
|
||||
if(!partner)
|
||||
return 0
|
||||
@@ -42,24 +43,27 @@
|
||||
update_cycle = SSair.times_fired
|
||||
partner.update_cycle = SSair.times_fired
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
var/datum/gas_mixture/partner_air_contents = partner.airs[AIR1]
|
||||
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/other_air_heat_capacity = partner.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/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
|
||||
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
|
||||
partner_air_contents.temperature = new_temperature
|
||||
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
|
||||
partner.parent.update = 1
|
||||
if(abs(other_old_temperature-partner_air_contents.temperature) > 1)
|
||||
partner.update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir
|
||||
//currently the same code as cold_sink but anticipating process() changes
|
||||
|
||||
icon_state = "cold_map"
|
||||
@@ -12,22 +12,25 @@
|
||||
var/current_temperature = T20C
|
||||
var/current_heat_capacity = 50000 //totally random
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/update_icon_nopipes()
|
||||
overlays.Cut()
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now
|
||||
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "cold_off"
|
||||
return
|
||||
|
||||
else
|
||||
icon_state = "cold_on"
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/heat_reservoir/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
var/old_temperature = air_contents.temperature
|
||||
@@ -39,5 +42,5 @@
|
||||
//todo: have current temperature affected. require power to bring up current temperature again
|
||||
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
return 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/outlet_injector
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector
|
||||
icon_state = "inje_map"
|
||||
use_power = 1
|
||||
|
||||
@@ -16,35 +16,37 @@
|
||||
|
||||
level = 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/Destroy()
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/Destroy()
|
||||
if(radio_controller)
|
||||
radio_controller.remove_object(src,frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/on
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/on
|
||||
on = 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/update_icon_nopipes()
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/update_icon_nopipes()
|
||||
if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "inje_off"
|
||||
return
|
||||
|
||||
icon_state = "inje_on"
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/power_change()
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/power_change()
|
||||
var/old_stat = stat
|
||||
..()
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/process_atmos()
|
||||
..()
|
||||
injecting = 0
|
||||
|
||||
if(!on || stat & NOPOWER)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
if(air_contents.temperature > 0)
|
||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
@@ -53,14 +55,16 @@
|
||||
loc.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/proc/inject()
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/proc/inject()
|
||||
if(on || injecting)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
injecting = 1
|
||||
|
||||
if(air_contents.temperature > 0)
|
||||
@@ -70,17 +74,17 @@
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
flick("inje_inject", src)
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/proc/set_frequency(new_frequency)
|
||||
/obj/machinery/atmospherics/components/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()
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
@@ -101,16 +105,16 @@
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/atmosinit()
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/atmosinit()
|
||||
set_frequency(frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/initialize()
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/initialize()
|
||||
..()
|
||||
broadcast_status()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/receive_signal(datum/signal/signal)
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
@@ -126,6 +130,7 @@
|
||||
|
||||
if("set_volume_rate" in signal.data)
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
volume_rate = Clamp(number, 0, air_contents.volume)
|
||||
|
||||
if("status" in signal.data)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/oxygen_generator
|
||||
/obj/machinery/atmospherics/components/unary/oxygen_generator
|
||||
|
||||
icon_state = "o2gen_map"
|
||||
|
||||
@@ -12,29 +12,32 @@
|
||||
|
||||
var/oxygen_content = 10
|
||||
|
||||
/obj/machinery/atmospherics/unary/oxygen_generator/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/unary/oxygen_generator/update_icon_nopipes()
|
||||
|
||||
overlays.Cut()
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //it works for now
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "scrub_cap", initialize_directions) //it works for now
|
||||
|
||||
if(!node || !on || stat & BROKEN)
|
||||
if(!nodes[NODE1] || !on || stat & BROKEN)
|
||||
icon_state = "o2gen_off"
|
||||
return
|
||||
|
||||
else
|
||||
icon_state = "o2gen_on"
|
||||
|
||||
/obj/machinery/atmospherics/unary/oxygen_generator/New()
|
||||
/obj/machinery/atmospherics/components/unary/oxygen_generator/New()
|
||||
..()
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
air_contents.volume = 50
|
||||
airs[AIR1] = air_contents
|
||||
|
||||
/obj/machinery/atmospherics/unary/oxygen_generator/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/oxygen_generator/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
var/total_moles = air_contents.total_moles()
|
||||
|
||||
if(total_moles < oxygen_content)
|
||||
@@ -45,6 +48,6 @@
|
||||
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
|
||||
air_contents.oxygen += added_oxygen
|
||||
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
@@ -1,47 +1,34 @@
|
||||
/obj/machinery/atmospherics/unary/portables_connector
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector
|
||||
name = "connector port"
|
||||
desc = "For connecting portables devices related to atmospherics control."
|
||||
icon = 'icons/obj/atmospherics/unary_devices.dmi'
|
||||
icon = 'icons/obj/atmospherics/components/unary_devices.dmi'
|
||||
icon_state = "connector_map" //Only for mapping purposes, so mappers can see direction
|
||||
can_unwrench = 1
|
||||
var/obj/machinery/portable_atmospherics/connected_device
|
||||
use_power = 0
|
||||
level = 0
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/visible
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/visible
|
||||
level = 2
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/update_icon()
|
||||
icon_state = "connector"
|
||||
underlays.Cut()
|
||||
if(showpipe)
|
||||
var/state
|
||||
var/col
|
||||
if(node)
|
||||
state = "pipe_intact"
|
||||
col = node.pipe_color
|
||||
else
|
||||
state = "pipe_exposed"
|
||||
underlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', state, initialize_directions, col)
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/process_atmos()
|
||||
if(!connected_device)
|
||||
return
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/Destroy()
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/Destroy()
|
||||
if(connected_device)
|
||||
connected_device.disconnect()
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/attackby(obj/item/weapon/W, mob/user, params)
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(connected_device)
|
||||
user << "<span class='warning'>You cannot unwrench this [src], dettach [connected_device] first!</span>"
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/portableConnectorReturnAir()
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/portableConnectorReturnAir()
|
||||
return connected_device.portableConnectorReturnAir()
|
||||
|
||||
/obj/proc/portableConnectorReturnAir()
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/obj/machinery/atmospherics/components/unary/tank
|
||||
icon = 'icons/obj/atmospherics/pipes/pressure_tank.dmi'
|
||||
icon_state = "generic"
|
||||
name = "pressure tank"
|
||||
desc = "A large vessel containing pressurized gas."
|
||||
var/volume = 10000 //in liters, 1 meters by 1 meters by 2 meters
|
||||
density = 1
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
|
||||
name = "pressure tank (Carbon Dioxide)"
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.carbon_dioxide = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/toxins
|
||||
icon_state = "orange"
|
||||
name = "pressure tank (Plasma)"
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/toxins/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.toxins = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b
|
||||
icon_state = "orange_2"
|
||||
name = "pressure tank (Oxygen + Plasma)"
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T0C
|
||||
var/datum/gas/oxygen_agent_b/trace_gas = new
|
||||
trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.trace_gases += trace_gas
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/oxygen
|
||||
icon_state = "blue"
|
||||
name = "pressure tank (Oxygen)"
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/oxygen/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.oxygen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/nitrogen
|
||||
icon_state = "red"
|
||||
name = "pressure tank (Nitrogen)"
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/nitrogen/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.nitrogen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/air
|
||||
icon_state = "grey"
|
||||
name = "pressure tank (Air)"
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/air/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
@@ -1,47 +1,18 @@
|
||||
/obj/machinery/atmospherics/unary
|
||||
icon = 'icons/obj/atmospherics/unary_devices.dmi'
|
||||
/obj/machinery/atmospherics/components/unary
|
||||
icon = 'icons/obj/atmospherics/components/unary_devices.dmi'
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH
|
||||
layer = TURF_LAYER+0.1
|
||||
var/datum/gas_mixture/air_contents
|
||||
var/obj/machinery/atmospherics/node
|
||||
var/showpipe = 0
|
||||
device_type = UNARY
|
||||
|
||||
/obj/machinery/atmospherics/unary/New()
|
||||
..()
|
||||
air_contents = new
|
||||
air_contents.volume = 200
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/SetInitDirections()
|
||||
/obj/machinery/atmospherics/components/unary/SetInitDirections()
|
||||
initialize_directions = dir
|
||||
|
||||
/*
|
||||
Iconnery
|
||||
*/
|
||||
|
||||
//Separate this because we don't need to update pipe icons if we just are going to change the state
|
||||
/obj/machinery/atmospherics/unary/proc/update_icon_nopipes()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/update_icon()
|
||||
update_icon_nopipes()
|
||||
|
||||
//This code might be a bit specific to scrubber, vents and injectors, but honestly they are basically the only ones used in the unary branch.
|
||||
|
||||
underlays.Cut()
|
||||
|
||||
if(showpipe)
|
||||
var/state
|
||||
var/col
|
||||
if(node)
|
||||
state = "pipe_intact"
|
||||
col = node.pipe_color
|
||||
else
|
||||
state = "pipe_exposed"
|
||||
|
||||
underlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', state, initialize_directions, col)
|
||||
|
||||
/obj/machinery/atmospherics/unary/hide(var/intact)
|
||||
/obj/machinery/atmospherics/components/unary/hide(var/intact)
|
||||
showpipe = !intact
|
||||
update_icon()
|
||||
|
||||
@@ -51,86 +22,26 @@ Iconnery
|
||||
Housekeeping and pipe network stuff below
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/unary/Destroy()
|
||||
/obj/machinery/atmospherics/components/unary/atmosinit()
|
||||
var/list/node_connects = new/list()
|
||||
node_connects.Add(dir)
|
||||
..(node_connects)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/default_change_direction_wrench(mob/user, obj/item/weapon/wrench/W)
|
||||
if(..())
|
||||
return 0
|
||||
initialize_directions = dir
|
||||
var/obj/machinery/atmospherics/node = nodes[NODE1]
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
node = null
|
||||
nullifyPipenet(parent)
|
||||
..()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/atmosinit()
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src, dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node = target
|
||||
break
|
||||
if(level == 2)
|
||||
showpipe = 1
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/construction()
|
||||
..()
|
||||
parent.update = 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/default_change_direction_wrench(mob/user, obj/item/weapon/wrench/W)
|
||||
if(..())
|
||||
initialize_directions = dir
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
node = null
|
||||
nullifyPipenet(parent)
|
||||
atmosinit()
|
||||
initialize()
|
||||
if(node)
|
||||
node.atmosinit()
|
||||
node.initialize()
|
||||
node.addMember(src)
|
||||
build_network()
|
||||
. = 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/build_network()
|
||||
if(!parent)
|
||||
parent = new /datum/pipeline()
|
||||
parent.build_pipeline(src)
|
||||
|
||||
/obj/machinery/atmospherics/unary/disconnect(obj/machinery/atmospherics/reference)
|
||||
if(reference == node)
|
||||
if(istype(node, /obj/machinery/atmospherics/pipe))
|
||||
qdel(parent)
|
||||
node = null
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/nullifyPipenet()
|
||||
..()
|
||||
parent.other_airs -= air_contents
|
||||
parent = null
|
||||
|
||||
/obj/machinery/atmospherics/unary/returnPipenetAir()
|
||||
return air_contents
|
||||
|
||||
/obj/machinery/atmospherics/unary/pipeline_expansion()
|
||||
return list(node)
|
||||
|
||||
/obj/machinery/atmospherics/unary/setPipenet(datum/pipeline/P)
|
||||
parent = P
|
||||
|
||||
/obj/machinery/atmospherics/unary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
|
||||
if(Old == parent)
|
||||
parent = New
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/unsafe_pressure_release(var/mob/user,var/pressures)
|
||||
..()
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(T)
|
||||
//Remove the gas from air_contents and assume it
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/lost = pressures*environment.volume/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
var/datum/gas_mixture/to_release = air_contents.remove(lost)
|
||||
T.assume_air(to_release)
|
||||
air_update_turf(1)
|
||||
|
||||
|
||||
node = null
|
||||
nullifyPipenet(parents[PARENT1])
|
||||
atmosinit()
|
||||
initialize()
|
||||
if(node)
|
||||
node.atmosinit()
|
||||
node.initialize()
|
||||
node.addMember(src)
|
||||
build_network()
|
||||
. = 1
|
||||
nodes[NODE1] = node
|
||||
@@ -1,4 +1,8 @@
|
||||
/obj/machinery/atmospherics/unary/vent_pump
|
||||
#define EXT_BOUND 1
|
||||
#define INT_BOUND 2
|
||||
#define NO_BOUND 3
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump
|
||||
icon_state = "vent_map"
|
||||
|
||||
name = "air vent"
|
||||
@@ -19,9 +23,9 @@
|
||||
var/internal_pressure_bound = 0
|
||||
|
||||
var/pressure_checks = 1
|
||||
//1: Do not pass external_pressure_bound
|
||||
//2: Do not pass internal_pressure_bound
|
||||
//3: Do not pass either
|
||||
//EXT_BOUND: Do not pass external_pressure_bound
|
||||
//INT_BOUND: Do not pass internal_pressure_bound
|
||||
//NO_BOUND: Do not pass either
|
||||
|
||||
var/frequency = 1439
|
||||
var/datum/radio_frequency/radio_connection
|
||||
@@ -29,18 +33,18 @@
|
||||
var/radio_filter_out
|
||||
var/radio_filter_in
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/on
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/on
|
||||
on = 1
|
||||
icon_state = "vent_out"
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/siphon
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/siphon
|
||||
pump_direction = 0
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/siphon/on
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/siphon/on
|
||||
on = 1
|
||||
icon_state = "vent_in"
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/New()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/New()
|
||||
..()
|
||||
initial_loc = get_area(loc)
|
||||
if (initial_loc.master)
|
||||
@@ -54,29 +58,30 @@
|
||||
src.initialize()
|
||||
src.broadcast_status()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/Destroy()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/Destroy()
|
||||
if(radio_controller)
|
||||
radio_controller.remove_object(src,frequency)
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/high_volume
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/high_volume
|
||||
name = "large air vent"
|
||||
power_channel = EQUIP
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/high_volume/New()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/high_volume/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
air_contents.volume = 1000
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/update_icon_nopipes()
|
||||
overlays.Cut()
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "vent_cap", initialize_directions)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "vent_cap", initialize_directions)
|
||||
|
||||
if(welded)
|
||||
icon_state = "vent_welded"
|
||||
return
|
||||
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "vent_off"
|
||||
return
|
||||
|
||||
@@ -85,11 +90,11 @@
|
||||
else
|
||||
icon_state = "vent_in"
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/process_atmos()
|
||||
..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if (!node)
|
||||
if (!nodes[NODE1])
|
||||
on = 0
|
||||
//broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
|
||||
if(!on)
|
||||
@@ -98,15 +103,16 @@
|
||||
if(welded)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
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)
|
||||
if(pressure_checks&EXT_BOUND)
|
||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||
if(pressure_checks&2)
|
||||
if(pressure_checks&INT_BOUND)
|
||||
pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
|
||||
|
||||
if(pressure_delta > 0)
|
||||
@@ -118,13 +124,11 @@
|
||||
loc.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
|
||||
else //external -> internal
|
||||
var/pressure_delta = 10000
|
||||
if(pressure_checks&1)
|
||||
if(pressure_checks&EXT_BOUND)
|
||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||
if(pressure_checks&2)
|
||||
if(pressure_checks&INT_BOUND)
|
||||
pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure()))
|
||||
|
||||
if(pressure_delta > 0)
|
||||
@@ -137,20 +141,19 @@
|
||||
|
||||
air_contents.merge(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
//Radio remote control
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/proc/set_frequency(new_frequency)
|
||||
/obj/machinery/atmospherics/components/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()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
@@ -182,30 +185,30 @@
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/atmosinit()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/atmosinit()
|
||||
//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/initialize()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/initialize()
|
||||
..()
|
||||
broadcast_status()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/receive_signal(datum/signal/signal)
|
||||
/obj/machinery/atmospherics/components/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()])")
|
||||
//log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/components/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
|
||||
pressure_checks &= ~EXT_BOUND
|
||||
pump_direction = 0
|
||||
|
||||
if("stabalize" in signal.data)
|
||||
pressure_checks |= 1
|
||||
pressure_checks |= EXT_BOUND
|
||||
pump_direction = 1
|
||||
|
||||
if("power" in signal.data)
|
||||
@@ -218,7 +221,7 @@
|
||||
pressure_checks = text2num(signal.data["checks"])
|
||||
|
||||
if("checks_toggle" in signal.data)
|
||||
pressure_checks = (pressure_checks?0:3)
|
||||
pressure_checks = (pressure_checks?0:NO_BOUND)
|
||||
|
||||
if("direction" in signal.data)
|
||||
pump_direction = text2num(signal.data["direction"])
|
||||
@@ -266,7 +269,7 @@
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/attackby(obj/item/W, mob/user, params)
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/attackby(obj/item/W, mob/user, params)
|
||||
if (istype(W, /obj/item/weapon/wrench)&& !(stat & NOPOWER) && on)
|
||||
user << "<span class='warning'>You cannot unwrench this [src], turn it off first!</span>"
|
||||
return 1
|
||||
@@ -290,24 +293,24 @@
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/examine(mob/user)
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/examine(mob/user)
|
||||
..()
|
||||
if(welded)
|
||||
user << "It seems welded shut."
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/power_change()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/power_change()
|
||||
if(powered(power_channel))
|
||||
stat &= ~NOPOWER
|
||||
else
|
||||
stat |= NOPOWER
|
||||
update_icon_nopipes()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/Destroy()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/Destroy()
|
||||
if(initial_loc)
|
||||
initial_loc.air_vent_info -= id_tag
|
||||
initial_loc.air_vent_names -= id_tag
|
||||
..()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/can_crawl_through()
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/can_crawl_through()
|
||||
return !welded
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber
|
||||
icon_state = "scrub_map"
|
||||
|
||||
name = "air scrubber"
|
||||
@@ -33,7 +33,7 @@
|
||||
var/radio_filter_in
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/New()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/New()
|
||||
..()
|
||||
initial_loc = get_area(loc)
|
||||
if (initial_loc.master)
|
||||
@@ -47,11 +47,14 @@
|
||||
src.initialize()
|
||||
src.broadcast_status()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/Destroy()
|
||||
if(radio_controller)
|
||||
radio_controller.remove_object(src,frequency)
|
||||
if(initial_loc)
|
||||
initial_loc.air_scrub_info -= id_tag
|
||||
initial_loc.air_scrub_names -= id_tag
|
||||
..()
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/auto_use_power()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/auto_use_power()
|
||||
if(!powered(power_channel))
|
||||
return 0
|
||||
if (!on || welded)
|
||||
@@ -76,16 +79,16 @@
|
||||
use_power(amount, power_channel)
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/update_icon_nopipes()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/update_icon_nopipes()
|
||||
overlays.Cut()
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/components/unary_devices.dmi', "scrub_cap", initialize_directions)
|
||||
|
||||
if(welded)
|
||||
icon_state = "scrub_welded"
|
||||
return
|
||||
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "scrub_off"
|
||||
return
|
||||
|
||||
@@ -94,12 +97,12 @@
|
||||
else
|
||||
icon_state = "scrub_purge"
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/proc/set_frequency(new_frequency)
|
||||
/obj/machinery/atmospherics/components/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)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/proc/broadcast_status()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/broadcast_status()
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
|
||||
@@ -116,7 +119,7 @@
|
||||
"widenet" = widenet,
|
||||
"filter_co2" = scrub_CO2,
|
||||
"filter_toxins" = scrub_Toxins,
|
||||
"filter_n2o" = scrub_N2O,
|
||||
"filter_NODE2o" = scrub_N2O,
|
||||
"sigtype" = "status"
|
||||
)
|
||||
if(!initial_loc.air_scrub_names[id_tag])
|
||||
@@ -128,23 +131,23 @@
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/atmosinit()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/atmosinit()
|
||||
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)
|
||||
check_turfs()
|
||||
..()
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/initialize()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/initialize()
|
||||
..()
|
||||
broadcast_status()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos()
|
||||
..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if (!node)
|
||||
if (!nodes[NODE1])
|
||||
on = 0
|
||||
//broadcast_status()
|
||||
if(!on || welded)
|
||||
@@ -155,11 +158,13 @@
|
||||
scrub(tile)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/proc/scrub(var/turf/simulated/tile)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(var/turf/simulated/tile)
|
||||
if (!tile || !istype(tile))
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/environment = tile.return_air()
|
||||
var/datum/gas_mixture/air_contents = airs[AIR1]
|
||||
|
||||
if(scrubbing)
|
||||
if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0))
|
||||
@@ -196,8 +201,6 @@
|
||||
tile.assume_air(removed)
|
||||
tile.air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
|
||||
else //Just siphoning all air
|
||||
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
|
||||
return
|
||||
@@ -209,52 +212,27 @@
|
||||
air_contents.merge(removed)
|
||||
tile.air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
//There is no easy way for an object to be notified of changes to atmos can pass flags
|
||||
// So we check every machinery process (2 seconds)
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/process()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/process()
|
||||
if (widenet)
|
||||
check_turfs()
|
||||
|
||||
//we populate a list of turfs with nonatmos-blocked cardinal turfs AND
|
||||
// diagonal turfs that can share atmos with *both* of the cardinal turfs
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/proc/check_turfs()
|
||||
if (!loc || !istype(loc, /turf/simulated))
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/check_turfs()
|
||||
adjacent_turfs.Cut()
|
||||
var/turf/simulated/curloc = loc
|
||||
|
||||
for (var/direction in cardinal)
|
||||
if(!(curloc.atmos_adjacent_turfs & direction))
|
||||
continue
|
||||
|
||||
var/turf/simulated/S = get_step(loc, direction)
|
||||
if (istype(S))
|
||||
adjacent_turfs += S
|
||||
|
||||
for (var/direction in diagonals)
|
||||
var/matchingDirections = 0
|
||||
var/turf/simulated/S = get_step(curloc, direction)
|
||||
|
||||
for (var/checkDirection in cardinal)
|
||||
if(!(S.atmos_adjacent_turfs & checkDirection))
|
||||
continue
|
||||
var/turf/simulated/checkTurf = get_step(S, checkDirection)
|
||||
|
||||
if (checkTurf in adjacent_turfs)
|
||||
matchingDirections++
|
||||
|
||||
if (matchingDirections >= 2)
|
||||
adjacent_turfs += S
|
||||
break
|
||||
var/turf/T = loc
|
||||
if (istype(T))
|
||||
adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir=1)
|
||||
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal)
|
||||
/obj/machinery/atmospherics/components/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"))
|
||||
@@ -285,9 +263,9 @@
|
||||
if("toggle_tox_scrub" in signal.data)
|
||||
scrub_Toxins = !scrub_Toxins
|
||||
|
||||
if("n2o_scrub" in signal.data)
|
||||
if("NODE2o_scrub" in signal.data)
|
||||
scrub_N2O = text2num(signal.data["n2o_scrub"])
|
||||
if("toggle_n2o_scrub" in signal.data)
|
||||
if("toggle_NODE2o_scrub" in signal.data)
|
||||
scrub_N2O = !scrub_N2O
|
||||
|
||||
if("init" in signal.data)
|
||||
@@ -304,14 +282,14 @@
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/power_change()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/power_change()
|
||||
if(powered(power_channel))
|
||||
stat &= ~NOPOWER
|
||||
else
|
||||
stat |= NOPOWER
|
||||
update_icon_nopipes()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(WT.remove_fuel(0,user))
|
||||
@@ -337,13 +315,5 @@
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/Destroy()
|
||||
if(initial_loc)
|
||||
initial_loc.air_scrub_info -= id_tag
|
||||
initial_loc.air_scrub_names -= id_tag
|
||||
..()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/can_crawl_through()
|
||||
/obj/machinery/atmospherics/components/unary/vent_scrubber/can_crawl_through()
|
||||
return !welded
|
||||
|
||||
Reference in New Issue
Block a user