diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm index 16cebb0ac1a..a63f0147b77 100644 --- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm +++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm @@ -3,7 +3,7 @@ dir = SOUTH initialize_directions = SOUTH|NORTH use_power = 1 - node_amount = 2 + device_type = BINARY /obj/machinery/atmospherics/components/binary/SetInitDirections() switch(dir) @@ -27,9 +27,8 @@ Iconnery Helpers */ -/obj/machinery/atmospherics/components/trinary/update_airs(var/a1, var/a2) - ..(list(1 = a1, 2 = a2)) - +/obj/machinery/atmospherics/components/binary/update_airs(var/a1, var/a2) + ..(list("a1" = a1, "a2" = a2)) /* Housekeeping and pipe network stuff */ @@ -39,13 +38,6 @@ Housekeeping and pipe network stuff var/node2_connect = dir var/node1_connect = turn(dir, 180) - var/node_connects[] = list(1 = node1_connect, 2 = node2_connect) - /* for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect)) - if(target.initialize_directions & get_dir(target,src)) - nodes[1] = target - break - for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect)) - if(target.initialize_directions & get_dir(target,src)) - nodes[2] = target - break */ + var/list/node_connects = new/list() + node_connects.Add(node1_connect, node2_connect) ..(node_connects) \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm index 1a19a8f3d1a..67b2420fbf5 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -18,8 +18,8 @@ /obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air() - var/datum/gas_mixture/air1 = airs[1] - var/datum/gas_mixture/air2 = airs[2] + var/datum/gas_mixture/air1 = airs["a1"] + var/datum/gas_mixture/air2 = airs["a2"] var/output_starting_pressure = air1.return_pressure() var/input_starting_pressure = air2.return_pressure() diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index 296e02b20d3..975a3067855 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -42,8 +42,8 @@ Acts like a normal vent, but has an input AND output. /obj/machinery/atmospherics/binary/dp_vent_pump/high_volume/New() ..() - var/datum/gas_mixture/air1 = airs[1] ; air1.volume = 1000 - var/datum/gas_mixture/air2 = airs[2] ; air2.volume = 1000 + var/datum/gas_mixture/air1 = airs["a1"] ; air1.volume = 1000 + var/datum/gas_mixture/air2 = airs["a2"] ; air2.volume = 1000 update_airs(air1, air2) /obj/machinery/atmospherics/binary/dp_vent_pump/update_icon_nopipes() @@ -65,8 +65,8 @@ Acts like a normal vent, but has an input AND output. if(!on) return 0 - var/datum/gas_mixture/air1 = airs[1] - var/datum/gas_mixture/air2 = airs[2] + var/datum/gas_mixture/air1 = airs["a1"] + var/datum/gas_mixture/air2 = airs["a2"] var/datum/gas_mixture/environment = loc.return_air() var/environment_pressure = environment.return_pressure() @@ -88,7 +88,7 @@ Acts like a normal vent, but has an input AND output. loc.assume_air(removed) air_update_turf() - update_parents(list(1 = parents[1])) //this looks disgusting, but it works + update_parents(list("p1" = parents["p1"])) //this looks disgusting, but it works else //external -> output var/pressure_delta = 10000 @@ -107,7 +107,7 @@ Acts like a normal vent, but has an input AND output. air2.merge(removed) air_update_turf() - update_parents(list(2 = parents[2])) + update_parents(list("p2" = parents["p2"])) update_airs(air1, air2) diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index 130f0bf2e44..058dd3d088f 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -40,8 +40,8 @@ Passive gate is similar to the regular pump except: if(!on) return 0 - var/datum/gas_mixture/air1 = airs[1] - var/datum/gas_mixture/air2 = airs[2] + var/datum/gas_mixture/air1 = airs["a1"] + var/datum/gas_mixture/air2 = airs["a2"] var/output_starting_pressure = air2.return_pressure() var/input_starting_pressure = air1.return_pressure() diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index 36bc3e5242d..8f391d9cd33 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -48,8 +48,8 @@ Thus, the two variables affect pump operation are set in New(): if(!on) return 0 - var/datum/gas_mixture/air1 = airs[1] - var/datum/gas_mixture/air2 = airs[2] + var/datum/gas_mixture/air1 = airs["a1"] + var/datum/gas_mixture/air2 = airs["a2"] var/output_starting_pressure = air2.return_pressure() diff --git a/code/ATMOSPHERICS/components/binary_devices/valve.dm b/code/ATMOSPHERICS/components/binary_devices/valve.dm index d441c659da8..61749cd2bf3 100644 --- a/code/ATMOSPHERICS/components/binary_devices/valve.dm +++ b/code/ATMOSPHERICS/components/binary_devices/valve.dm @@ -28,8 +28,8 @@ It's like a regular ol' straight pipe, but you can turn it on and off. open = 1 update_icon_nopipes() update_parents() - var/datum/pipeline/parent1 = parents[1] ; parent1.reconcile_air() - parents[1] = parent1 + var/datum/pipeline/parent1 = parents["p1"] ; parent1.reconcile_air() + parents["p1"] = parent1 investigate_log("was opened by [usr ? key_name(usr) : "a remote signal"]", "atmos") /obj/machinery/atmospherics/binary/valve/proc/close() diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index 58abf65eddc..a5ace7d427c 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -48,8 +48,8 @@ Thus, the two variables affect pump operation are set in New(): if(!on) return 0 - var/datum/gas_mixture/air1 = airs[1] - var/datum/gas_mixture/air2 = airs[2] + var/datum/gas_mixture/air1 = airs["a1"] + var/datum/gas_mixture/air2 = airs["a2"] // Pump mechanism just won't do anything if the pressure is too high/too low @@ -126,7 +126,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[1] + var/datum/gas_mixture/air1 = airs["a1"] transfer_rate = Clamp( text2num(signal.data["set_transfer_rate"]), 0, diff --git a/code/ATMOSPHERICS/components/components_base.dm b/code/ATMOSPHERICS/components/components_base.dm index 2c0a9e2cc5e..1278760777d 100644 --- a/code/ATMOSPHERICS/components/components_base.dm +++ b/code/ATMOSPHERICS/components/components_base.dm @@ -2,31 +2,40 @@ 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 + /obj/machinery/atmospherics/components/ var/welded = 0 //Used on pumps and scrubbers var/showpipe = 0 - var/list/nodes - var/list/parents - var/list/airs - var/node_amount -/obj/machinery/atmospherics/components/New() //doesn't work properly + var/list/nodes = new/list() + var/list/parents = new/list() + var/list/airs = new/list() + + var/device_type //used for initialization stuff + //UNARY = 1 + //BINARY = 2 + //TRINARY = 3 + +/obj/machinery/atmospherics/components/New() //it's workiiiing ..() - for(var/A = 1; A <= node_amount; A++) - var/datum/gas_mixture/air = A - - air = new - air.volume = 200 - airs[A] = air + for(var/I = 1; I <= device_type; I++) + var/datum/gas_mixture/A + 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) +/obj/machinery/atmospherics/components/proc/icon_addintact(var/obj/machinery/atmospherics/node) var/image/img = getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "pipe_intact", get_dir(src,node), node.pipe_color) underlays += img - return connected | img.dir + return img.dir /obj/machinery/atmospherics/components/proc/icon_addbroken(var/connected = 0) var/unconnected = (~connected) & initialize_directions @@ -46,10 +55,9 @@ Iconnery var/connected = 0 - for(var/N in nodes) //adds intact pieces - var/obj/machinery/atmospherics/node = N - if(node) - connected = icon_addintact(node, connected) + for(var/obj/machinery/atmospherics/N in nodes) //adds intact pieces + if(N) + connected |= icon_addintact(N) icon_addbroken(connected) //adds broken pieces @@ -57,110 +65,102 @@ Iconnery Pipenet stuff; housekeeping */ /obj/machinery/atmospherics/components/Destroy() //works somewhat - for(var/N in nodes) - var/obj/machinery/atmospherics/node = N - var/datum/pipeline/parent = parents[N] - - if(node) - node.disconnect(src) - node = null - nullifyPipenet(parent) - nodes[N] = node - parents[N] = parent + var/I = 1 + for(var/obj/machinery/atmospherics/N in nodes) + if(N) + N.disconnect(src) + N = null + nullifyPipenet(parents["p[I]"]) + nodes["n[I]"] = N + I++ ..() -/obj/machinery/atmospherics/components/atmosinit(var/list/node_connects) //doesn't work for another reason - for(var/N = 1; N <= node_amount; N++) - for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[N])) +/obj/machinery/atmospherics/components/atmosinit(var/list/node_connects) //doesn't get called properly + var/I = 1 + for(var/N in node_connects) + for(var/obj/machinery/atmospherics/target in get_step(src,N)) if(target.initialize_directions & get_dir(target,src)) - nodes[N] = target + nodes["n[I]"] = target + break + I++ if(level == 2) showpipe = 1 update_icon() - return -/obj/machinery/atmospherics/components/construction() //doesn't work +/obj/machinery/atmospherics/components/construction() ..() - for(var/P in parents) - var/datum/pipeline/parent = P - parent.update = 1 - parents[P] = parent + for(var/I = 1; I <= device_type; I++) + var/datum/pipeline/P = new + P.update = 1 + parents["p[I]"] = P + I++ /obj/machinery/atmospherics/components/build_network() //doesn't work - for(var/P in parents) - var/datum/pipeline/parent = P - - if(parent) + for(var/I = 1; I <= device_type; I++) + var/datum/pipeline/P = parents["p[I]"] + if(P) return - parent = new /datum/pipeline() - parent.build_pipeline(src) - parents[P] = parent + P = new /datum/pipeline() + P.build_pipeline(src) + parents["p[I]"] = P /obj/machinery/atmospherics/components/disconnect(obj/machinery/atmospherics/reference) //works - for(var/N in nodes) - var/obj/machinery/atmospherics/node = N - var/datum/pipeline/parent = parents[N] - - if(reference == node) - if(istype(node, /obj/machinery/atmospherics/pipe)) - qdel(parent) - parent = null - parents[N] = parent + var/I = 1 + for(var/obj/machinery/atmospherics/N in nodes) + if(reference == N) + if(istype(N, /obj/machinery/atmospherics/pipe)) + qdel(parents["p[I]"]) + parents["p[I]"] = null + I++ update_icon() -/obj/machinery/atmospherics/components/nullifyPipenet(datum/pipeline/pipeline) //untestable +/obj/machinery/atmospherics/components/nullifyPipenet(datum/pipeline/reference) //untestable ..() - for(var/P in parents) - var/datum/pipeline/parent = P - var/datum/gas_mixture/air = airs[P] + var/I = 1 + for(var/datum/pipeline/P in parents) + if(reference == P) + P.other_airs -= airs[I] + P = null + parents["p[I]"] = P + I++ - if(pipeline == parent) - parent.other_airs -= air - parent = null - parents[P] = parent +/obj/machinery/atmospherics/components/returnPipenetAir(datum/pipeline/reference) //untestable; should work + var/I = 1 + for(var/datum/pipeline/P in parents) + if(reference == parent) + return airs["a[I]"] + I++ -/obj/machinery/atmospherics/components/returnPipenetAir(datum/pipeline/pipeline) //untestable; should work - for(var/P in parents) - var/datum/pipeline/parent = P - var/datum/gas_mixture/air = airs[P] - - if(pipeline == parent) - return air - -/obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/pipeline) - if(!pipeline) - return nodes //works - for(var/N in nodes) - var/obj/machinery/atmospherics/node = N - var/datum/pipeline/parent = parents[N] - - if(parent == pipeline) - return list(node) //untestable; should work +/obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/reference) + if(!reference) + return nodes + var/I = 1 + for(var/obj/machinery/atmospherics/N in nodes) + if(parents["p[I]"] == reference) + return list(N) //untestable; should work + I++ /obj/machinery/atmospherics/components/setPipenet(datum/pipeline/pipeline, obj/machinery/atmospherics/A) - for(var/N in nodes) - var/obj/machinery/atmospherics/node = N - var/datum/pipeline/parent = parents[N] - - if(A == node) - parent = pipeline - parents[N] = parent + var/I = 1 + for(var/obj/machinery/atmospherics/N in nodes) + if(A == N) + parents["p[I]"] = pipeline + I++ /obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A) - for(var/N in nodes) - var/obj/machinery/atmospherics/node = N - var/datum/pipeline/parent = parents[N] - - if(A == node) - return parent //probably works + var/I = 1 + for(var/obj/machinery/atmospherics/N in nodes) + if(A == N) + return parents["p[I]"] //probably works + I++ /obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New) - for(var/P in parents) - var/datum/pipeline/parent = P - - if(Old == parent) - parent = New - parents[P] = parent + var/I + for(var/datum/pipeline/P in parents) + if(Old == P) + P = New + parents["p[I]"] = P + I++ /obj/machinery/atmospherics/components/unsafe_pressure_release(var/mob/user, var/pressures) //untestable; I'll fix this last ..() @@ -171,15 +171,15 @@ Pipenet stuff; housekeeping var/datum/gas_mixture/environment = T.return_air() var/lost = null var/times_lost = 0 - for(var/A in airs) - var/datum/gas_mixture/air = A + for(var/A = 1; A <= device_type; A++) + var/datum/gas_mixture/air = airs[A] 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/A in airs) - var/datum/gas_mixture/air = A + for(var/A = 1; A <= device_type; A++) + var/datum/gas_mixture/air = airs[A] if(!to_release) to_release = air.remove(shared_loss) continue @@ -201,21 +201,23 @@ I think this is NanoUI? /* Helpers */ -/obj/machinery/atmospherics/components/proc/get_airs() - return -/obj/machinery/atmospherics/components/proc/get_nodes() - return -/obj/machinery/atmospherics/components/proc/get_parents() - return - /obj/machinery/atmospherics/components/proc/update_airs(var/list/L) - for(var/N in L) - var/datum/gas_mixture/air = L[N] - airs[N] = air + var/I = 1 + for(var/datum/gas_mixture/air in L) + airs["a[I]"] = air + I++ /obj/machinery/atmospherics/components/proc/update_parents(var/list/L = parents) - for(var/N in L) - if(!N) + var/I = 1 + for(var/datum/pipeline/parent in L) + if(!parent) continue - var/datum/pipeline/parent = N ; parent.update = 1 - parents[N] = parent \ No newline at end of file + parent.update = 1 + parents["p[I]"] = parent + I++ +/obj/machinery/atmospherics/components/proc/init_airs() + return +/obj/machinery/atmospherics/components/proc/init_nodes() + return +/obj/machinery/atmospherics/components/proc/init_parents() + return \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index 5841c279c02..0047cb3d359 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -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 @@ -34,46 +34,41 @@ Filter types: 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/icon_addintact(var/obj/machinery/atmospherics/node, var/connected) - var/image/img = getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "cap", get_dir(src,node), node.pipe_color) - overlays += img - return ..() - -/obj/machinery/atmospherics/trinary/filter/icon_addbroken(var/connected) - var/unconnected = (~connected) & initialize_directions - for(var/direction in cardinal) - if(unconnected & direction) - underlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "pipe_exposed", direction) - overlays += getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "cap", direction) - -/obj/machinery/atmospherics/trinary/filter/update_icon() +/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/trinary_devices.dmi', "cap", direction, node.pipe_color) + continue + overlays += getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "cap", direction) ..() -/obj/machinery/atmospherics/trinary/filter/update_icon_nopipes() +/obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes() - if(!(stat & NOPOWER) && on && nodes[1] && nodes[2] && nodes[3]) + if(!(stat & NOPOWER) && on && nodes["n1"] && nodes["n2"] && nodes["n3"]) 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) @@ -81,14 +76,14 @@ 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 - var/datum/gas_mixture/air1 = airs[1] - var/datum/gas_mixture/air2 = airs[2] - var/datum/gas_mixture/air3 = airs[3] + var/datum/gas_mixture/air1 = airs["a1"] + var/datum/gas_mixture/air2 = airs["a2"] + var/datum/gas_mixture/air3 = airs["a3"] var/output_starting_pressure = air3.return_pressure() @@ -156,11 +151,11 @@ Filter types: 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(user as mob) if(..()) return @@ -170,13 +165,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", var/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. @@ -184,7 +179,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) diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index 54f9995ccdb..1a05dac6625 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -1,4 +1,4 @@ -/obj/machinery/atmospherics/trinary/mixer +/obj/machinery/atmospherics/components/trinary/mixer icon_state = "mixer_off" density = 0 @@ -16,39 +16,27 @@ //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/trinary/mixer/icon_addintact(var/obj/machinery/atmospherics/node, var/connected) - var/image/img = getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "cap", get_dir(src,node), node.pipe_color) - overlays += img - return ..() - -/obj/machinery/atmospherics/trinary/mixer/icon_addbroken(var/connected) - var/unconnected = (~connected) & initialize_directions - for(var/direction in cardinal) - if(unconnected & direction) - underlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', "pipe_exposed", direction) - overlays += getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "cap", direction) - -/obj/machinery/atmospherics/trinary/mixer/update_icon() +/obj/machinery/atmospherics/components/trinary/mixer/update_icon() overlays.Cut() - ..() + for(var/direction in cardinal) + if(direction & (get_dir(src,nodes["n1"]) || get_dir(src,nodes["n2"]) || get_dir(src,nodes["n3"]))) + var/obj/machinery/atmospherics/node = findConnecting(direction) + overlays += getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "cap", direction, node.pipe_color) + continue + overlays += getpipeimage('icons/obj/atmospherics/trinary_devices.dmi', "cap", direction) -<<<<<<< HEAD -/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[1] && nodes[2] && nodes[3]) ->>>>>>> 3ee8754... 3rd pass OOP + if(!(stat & NOPOWER) && on && nodes["n1"] && nodes["n2"] && nodes["n3"]) 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) @@ -56,19 +44,19 @@ 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[3] ; air3.volume = 300 - airs[3] = air3 + var/datum/gas_mixture/air3 = airs["a3"] ; air3.volume = 300 + airs["a3"] = air3 -/obj/machinery/atmospherics/trinary/mixer/process_atmos() +/obj/machinery/atmospherics/components/trinary/mixer/process_atmos() ..() if(!on) return 0 - var/datum/gas_mixture/air1 = airs[1] - var/datum/gas_mixture/air2 = airs[2] - var/datum/gas_mixture/air3 = airs[3] + var/datum/gas_mixture/air1 = airs["a1"] + var/datum/gas_mixture/air2 = airs["a2"] + var/datum/gas_mixture/air3 = airs["a3"] var/output_starting_pressure = air3.return_pressure() @@ -114,17 +102,17 @@ air3.merge(removed2) if(transfer_moles1) - update_parents(list(1 = parents[1])) + update_parents(list("p1" = parents["p1"])) if(transfer_moles2) - update_parents(list(2 = parents[2])) + update_parents(list("p2" = parents["p2"])) update_airs(air1, air2, air3) - update_parents(list(3 = parents[3])) + update_parents(list("p3" = parents["p3"])) return 1 -/obj/machinery/atmospherics/trinary/mixer/attack_hand(user as mob) +/obj/machinery/atmospherics/components/trinary/mixer/attack_hand(user as mob) if(..()) return @@ -134,13 +122,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", var/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. @@ -149,7 +137,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 diff --git a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm index cf548dd43b0..dda2ea802f1 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm @@ -3,7 +3,7 @@ dir = SOUTH initialize_directions = SOUTH|NORTH|WEST use_power = 1 - node_amount = 3 + device_type = TRINARY var/flipped = 0 @@ -21,24 +21,10 @@ /* Helpers */ - /obj/machinery/atmospherics/components/trinary/update_airs(var/a1, var/a2, var/a3) - ..(list(1 = a1, 2 = a2, 3 = a3)) -/* -/obj/machinery/atmospherics/components/trinary/set_nodes(var/list/L) - var/obj/machinery/atmospherics/n1 = L[1] - var/obj/machinery/atmospherics/n2 = L[2] - var/obj/machinery/atmospherics/n3 = L[3] - - node1 = n1 - node2 = n2 - node3 = n3 -*/ - - + ..(list("a1" = a1, "a2" = a2, "a3" = a3)) /* Housekeeping and pipe network stuff -//WOW this got cut down thank you based OOP - duncathan */ /obj/machinery/atmospherics/components/trinary/atmosinit() @@ -62,18 +48,6 @@ Housekeeping and pipe network stuff node1_connect = turn(node1_connect, 180) node3_connect = turn(node3_connect, 180) - var/node_connects[] = list(1 = node1_connect, 2 = node2_connect, 3 = node3_connect) - - /* for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect)) - if(target.initialize_directions & get_dir(target,src)) - nodes[1] = target - break - for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect)) - if(target.initialize_directions & get_dir(target,src)) - nodes[2] = target - break - for(var/obj/machinery/atmospherics/target in get_step(src,node3_connect)) - if(target.initialize_directions & get_dir(target,src)) - nodes[3] = target - break */ + var/list/node_connects = new/list() + node_connects.Add(node1_connect, node2_connect, node3_connect) ..(node_connects) \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary_devices/Freezer.dm b/code/ATMOSPHERICS/components/unary_devices/Freezer.dm index bf3b888b1f3..025e5418735 100644 --- a/code/ATMOSPHERICS/components/unary_devices/Freezer.dm +++ b/code/ATMOSPHERICS/components/unary_devices/Freezer.dm @@ -1,4 +1,4 @@ -/obj/machinery/atmospherics/unary/cold_sink/freezer +/obj/machinery/atmospherics/components/unary/cold_sink/freezer name = "freezer" icon = 'icons/obj/Cryogenic2.dmi' icon_state = "freezer" @@ -8,7 +8,7 @@ use_power = 1 current_heat_capacity = 1000 -/obj/machinery/atmospherics/unary/cold_sink/freezer/New() +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/New() ..() initialize_directions = dir component_parts = list() @@ -21,20 +21,20 @@ component_parts += new /obj/item/stack/cable_coil(null, 1) RefreshParts() -/obj/machinery/atmospherics/unary/cold_sink/freezer/construction() +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/construction() ..(dir,dir) -/obj/machinery/atmospherics/unary/cold_sink/freezer/RefreshParts() +/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 = max(T0C - (170 + (T*15)), 1) + min_temperature = T0C - (170 + (T*15)) current_heat_capacity = 1000 * ((H - 1) ** 2) -/obj/machinery/atmospherics/unary/cold_sink/freezer/attackby(obj/item/I, mob/user, params) +/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() @@ -48,7 +48,7 @@ if(default_change_direction_wrench(user, I)) return -/obj/machinery/atmospherics/unary/cold_sink/freezer/update_icon() +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/update_icon() if(panel_open) icon_state = "freezer-o" else if(src.on) @@ -57,19 +57,19 @@ icon_state = "freezer" return -/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_ai(mob/user as mob) +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/attack_ai(mob/user as mob) return interact(user) -/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_paw(mob/user as mob) +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/attack_paw(mob/user as mob) return interact(user) -/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_hand(mob/user as mob) +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/attack_hand(mob/user as mob) return interact(user) -/obj/machinery/atmospherics/unary/cold_sink/freezer/interact(mob/user) +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/interact(mob/user) if(stat & (NOPOWER|BROKEN)) return - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] user.set_machine(src) var/temp_text = "" if(air_contents.temperature > (T0C - 20)) @@ -93,7 +93,7 @@ popup.set_content(dat) popup.open() -/obj/machinery/atmospherics/unary/cold_sink/freezer/Topic(href, href_list) +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/Topic(href, href_list) if(..()) return usr.set_machine(src) @@ -110,19 +110,19 @@ active_power_usage = (current_heat_capacity * (T20C - current_temperature) / 100) + idle_power_usage src.updateUsrDialog() -/obj/machinery/atmospherics/unary/cold_sink/freezer/process() +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/process() ..() src.updateUsrDialog() -/obj/machinery/atmospherics/unary/cold_sink/freezer/power_change() +/obj/machinery/atmospherics/components/unary/cold_sink/freezer/power_change() ..() if(stat & NOPOWER) on = 0 update_icon() -/obj/machinery/atmospherics/unary/heat_reservoir/heater/ +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/ name = "heater" icon = 'icons/obj/Cryogenic2.dmi' icon_state = "heater" @@ -132,11 +132,11 @@ current_heat_capacity = 1000 -/obj/machinery/atmospherics/unary/heat_reservoir/heater/New() +/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/unary/heat_reservoir/heater + H.build_path = /obj/machinery/atmospherics/components/unary/heat_reservoir/heater H.name = "circuit board (Heater)" component_parts = list() component_parts += H @@ -148,10 +148,10 @@ component_parts += new /obj/item/stack/cable_coil(null, 1) RefreshParts() -/obj/machinery/atmospherics/unary/heat_reservoir/heater/construction() +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/construction() ..(dir,dir) -/obj/machinery/atmospherics/unary/heat_reservoir/heater/RefreshParts() +/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) @@ -161,7 +161,7 @@ max_temperature = T20C + (140 * T) current_heat_capacity = 1000 * ((H - 1) ** 2) -/obj/machinery/atmospherics/unary/heat_reservoir/heater/attackby(obj/item/I, mob/user, params) +/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() @@ -175,7 +175,7 @@ if(default_change_direction_wrench(user, I)) return -/obj/machinery/atmospherics/unary/heat_reservoir/heater/update_icon() +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/update_icon() if(panel_open) icon_state = "heater-o" else if(src.on) @@ -184,17 +184,17 @@ icon_state = "heater" return -/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_ai(mob/user as mob) +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/attack_ai(mob/user as mob) return src.attack_hand(user) -/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_paw(mob/user as mob) +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/attack_paw(mob/user as mob) return src.attack_hand(user) -/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_hand(mob/user as mob) +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/attack_hand(mob/user as mob) return interact(user) -/obj/machinery/atmospherics/unary/heat_reservoir/heater/interact(mob/user) - var/datum/gas_mixture/air_contents = airs[1] +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/interact(mob/user) + var/datum/gas_mixture/air_contents = airs["a1"] if(stat & (NOPOWER|BROKEN)) return @@ -222,7 +222,7 @@ popup.set_content(dat) popup.open() -/obj/machinery/atmospherics/unary/heat_reservoir/heater/Topic(href, href_list) +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/Topic(href, href_list) if(..()) return usr.set_machine(src) @@ -241,11 +241,11 @@ src.add_fingerprint(usr) return -/obj/machinery/atmospherics/unary/heat_reservoir/heater/process() +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/process() ..() src.updateUsrDialog() -/obj/machinery/atmospherics/unary/heat_reservoir/heater/power_change() +/obj/machinery/atmospherics/components/unary/heat_reservoir/heater/power_change() ..() if(stat & NOPOWER) on = 0 diff --git a/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm b/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm index 5f1254d37cd..15ddc423edd 100644 --- a/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm +++ b/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm @@ -16,7 +16,7 @@ if(showpipe) overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now - if(!nodes[1] || !on || stat & (NOPOWER|BROKEN)) + if(!nodes["n1"] || !on || stat & (NOPOWER|BROKEN)) icon_state = "cold_off" return @@ -27,7 +27,7 @@ ..() if(!on) return 0 - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] var/air_heat_capacity = air_contents.heat_capacity() var/combined_heat_capacity = current_heat_capacity + air_heat_capacity diff --git a/code/ATMOSPHERICS/components/unary_devices/cryo.dm b/code/ATMOSPHERICS/components/unary_devices/cryo.dm index 54b920c8e21..522826535b7 100644 --- a/code/ATMOSPHERICS/components/unary_devices/cryo.dm +++ b/code/ATMOSPHERICS/components/unary_devices/cryo.dm @@ -1,4 +1,4 @@ -/obj/machinery/atmospherics/unary/cryo_cell +/obj/machinery/atmospherics/components/unary/cryo_cell name = "cryo cell" icon = 'icons/obj/cryogenics.dmi' icon_state = "cell-off" @@ -14,7 +14,7 @@ state_open = 0 var/efficiency -/obj/machinery/atmospherics/unary/cryo_cell/New() +/obj/machinery/atmospherics/components/unary/cryo_cell/New() ..() initialize_directions = dir component_parts = list() @@ -27,17 +27,17 @@ component_parts += new /obj/item/stack/cable_coil(null, 1) -/obj/machinery/atmospherics/unary/cryo_cell/construction() +/obj/machinery/atmospherics/components/unary/cryo_cell/construction() ..(dir,dir) -/obj/machinery/atmospherics/unary/cryo_cell/RefreshParts() +/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/unary/cryo_cell/Destroy() +/obj/machinery/atmospherics/components/unary/cryo_cell/Destroy() var/turf/T = loc T.contents += contents @@ -45,9 +45,9 @@ beaker.loc = get_step(loc, SOUTH) //Beaker is carefully ejected from the wreckage of the cryotube beaker = null ..() -/obj/machinery/atmospherics/unary/cryo_cell/process_atmos() +/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos() ..() - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] if(air_contents) temperature_archived = air_contents.temperature @@ -55,21 +55,21 @@ if(abs(temperature_archived-air_contents.temperature) > 1) update_parents() -/obj/machinery/atmospherics/unary/cryo_cell/process() +/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[1] || !is_operational()) + if(!nodes["n1"] || !is_operational()) return if(!on) updateDialog() return - if(airs[1]) + if(airs["a1"]) if (occupant) process_occupant() expel_gas() @@ -77,19 +77,19 @@ updateDialog() return 1 -/obj/machinery/atmospherics/unary/cryo_cell/MouseDrop_T(mob/target, mob/user) +/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/unary/cryo_cell/relaymove(var/mob/user) +/obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(var/mob/user) open_machine() -/obj/machinery/atmospherics/unary/cryo_cell/container_resist() +/obj/machinery/atmospherics/components/unary/cryo_cell/container_resist() open_machine() return -/obj/machinery/atmospherics/unary/cryo_cell/verb/move_eject() +/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" @@ -109,7 +109,7 @@ return open_machine() -/obj/machinery/atmospherics/unary/cryo_cell/examine(mob/user) +/obj/machinery/atmospherics/components/unary/cryo_cell/examine(mob/user) ..() var/list/otherstuff = contents - beaker @@ -120,7 +120,7 @@ else user << "Seems empty." -/obj/machinery/atmospherics/unary/cryo_cell/attack_hand(mob/user) +/obj/machinery/atmospherics/components/unary/cryo_cell/attack_hand(mob/user) if(..()) return @@ -137,16 +137,16 @@ * * @return nothing */ -/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) +/obj/machinery/atmospherics/components/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", var/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/unary/cryo_cell/get_ui_data() +/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[1] + var/datum/gas_mixture/air_contents = airs["a1"] var/data = list() data["isOperating"] = on @@ -193,7 +193,7 @@ data["beakerContents"] = beakerContents return data -/obj/machinery/atmospherics/unary/cryo_cell/Topic(href, href_list) +/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 @@ -224,7 +224,7 @@ add_fingerprint(usr) return 1 // update UIs attached to this object -/obj/machinery/atmospherics/unary/cryo_cell/attackby(obj/item/I, mob/user, params) +/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 @@ -254,7 +254,7 @@ default_deconstruction_crowbar(I) -/obj/machinery/atmospherics/unary/cryo_cell/open_machine() +/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine() if(!state_open && !panel_open) on = 0 layer = 3 @@ -264,13 +264,13 @@ if(beaker) beaker.loc = src -/obj/machinery/atmospherics/unary/cryo_cell/close_machine(mob/living/carbon/M) +/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/unary/cryo_cell/update_icon() +/obj/machinery/atmospherics/components/unary/cryo_cell/update_icon() if(panel_open) icon_state = "cell-o" return @@ -285,12 +285,12 @@ else icon_state = "cell-off" -/obj/machinery/atmospherics/unary/cryo_cell/power_change() +/obj/machinery/atmospherics/components/unary/cryo_cell/power_change() ..() update_icon() -/obj/machinery/atmospherics/unary/cryo_cell/proc/process_occupant() - var/datum/gas_mixture/air_contents = airs[1] +/obj/machinery/atmospherics/components/unary/cryo_cell/proc/process_occupant() + var/datum/gas_mixture/air_contents = airs["a1"] if(air_contents.total_moles() < 10) return if(occupant) @@ -321,8 +321,8 @@ next_trans = 0 -/obj/machinery/atmospherics/unary/cryo_cell/proc/heat_gas_contents() - var/datum/gas_mixture/air_contents = airs[1] +/obj/machinery/atmospherics/components/unary/cryo_cell/proc/heat_gas_contents() + var/datum/gas_mixture/air_contents = airs["a1"] if(air_contents.total_moles() < 1) return @@ -334,8 +334,8 @@ update_airs(air_contents) -/obj/machinery/atmospherics/unary/cryo_cell/proc/expel_gas() - var/datum/gas_mixture/air_contents = airs[1] +/obj/machinery/atmospherics/components/unary/cryo_cell/proc/expel_gas() + var/datum/gas_mixture/air_contents = airs["a1"] if(air_contents.total_moles() < 1) return diff --git a/code/ATMOSPHERICS/components/unary_devices/generator_input.dm b/code/ATMOSPHERICS/components/unary_devices/generator_input.dm index 4ada963f9ee..e5c64ef8cab 100644 --- a/code/ATMOSPHERICS/components/unary_devices/generator_input.dm +++ b/code/ATMOSPHERICS/components/unary_devices/generator_input.dm @@ -9,7 +9,7 @@ var/update_cycle /obj/machinery/atmospherics/unary/generator_input/update_icon() - if(nodes[1]) + if(nodes["n1"]) icon_state = "intact" else icon_state = "exposed" @@ -17,4 +17,4 @@ return /obj/machinery/atmospherics/unary/generator_input/proc/return_exchange_air() - return airs[1] + return airs["a1"] diff --git a/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm b/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm index adfbf6760cb..69c975f68ed 100644 --- a/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm +++ b/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm @@ -11,9 +11,9 @@ var/update_cycle /obj/machinery/atmospherics/unary/heat_exchanger/update_icon() - if(nodes[1]) + if(nodes["n1"]) icon_state = "he_intact" - var/obj/machinery/atmospherics/node = nodes[1] + var/obj/machinery/atmospherics/node = nodes["n1"] color = node.color else icon_state = "he_exposed" @@ -43,8 +43,8 @@ update_cycle = SSair.times_fired partner.update_cycle = SSair.times_fired - var/datum/gas_mixture/air_contents = airs[1] - var/datum/gas_mixture/partner_air_contents = partner.airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] + var/datum/gas_mixture/partner_air_contents = partner.airs["a1"] var/air_heat_capacity = air_contents.heat_capacity() var/other_air_heat_capacity = partner_air_contents.heat_capacity() diff --git a/code/ATMOSPHERICS/components/unary_devices/heat_source.dm b/code/ATMOSPHERICS/components/unary_devices/heat_source.dm index 838b8b6589d..8a8a1daa322 100644 --- a/code/ATMOSPHERICS/components/unary_devices/heat_source.dm +++ b/code/ATMOSPHERICS/components/unary_devices/heat_source.dm @@ -17,7 +17,7 @@ if(showpipe) overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now - if(!nodes[1] || !on || stat & (NOPOWER|BROKEN)) + if(!nodes["n1"] || !on || stat & (NOPOWER|BROKEN)) icon_state = "cold_off" return @@ -29,7 +29,7 @@ if(!on) return 0 - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] var/air_heat_capacity = air_contents.heat_capacity() var/combined_heat_capacity = current_heat_capacity + air_heat_capacity diff --git a/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm b/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm index d7976f8a1b8..3e558451c36 100644 --- a/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm @@ -25,7 +25,7 @@ on = 1 /obj/machinery/atmospherics/unary/outlet_injector/update_icon_nopipes() - if(!nodes[1] || !on || stat & (NOPOWER|BROKEN)) + if(!nodes["n1"] || !on || stat & (NOPOWER|BROKEN)) icon_state = "inje_off" return @@ -45,7 +45,7 @@ if(!on || stat & NOPOWER) return 0 - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] if(air_contents.temperature > 0) var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION) @@ -64,7 +64,7 @@ if(on || injecting) return 0 - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] injecting = 1 @@ -132,7 +132,7 @@ if("set_volume_rate" in signal.data) var/number = text2num(signal.data["set_volume_rate"]) - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] volume_rate = Clamp(number, 0, air_contents.volume) if("status" in signal.data) diff --git a/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm b/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm index 66a06d337d9..8b588a3e1f3 100644 --- a/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm +++ b/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm @@ -18,7 +18,7 @@ if(showpipe) overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //it works for now - if(!nodes[1] || !on || stat & BROKEN) + if(!nodes["n1"] || !on || stat & BROKEN) icon_state = "o2gen_off" return @@ -27,15 +27,15 @@ /obj/machinery/atmospherics/unary/oxygen_generator/New() ..() - var/datum/gas_mixture/air_contents = airs[1] ; air_contents.volume = 50 - airs[1] = air_contents + var/datum/gas_mixture/air_contents = airs["a1"] ; air_contents.volume = 50 + airs["a1"] = air_contents /obj/machinery/atmospherics/unary/oxygen_generator/process_atmos() ..() if(!on) return 0 - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] var/total_moles = air_contents.total_moles() diff --git a/code/ATMOSPHERICS/components/unary_devices/tank.dm b/code/ATMOSPHERICS/components/unary_devices/tank.dm index 7c3b4e61e1b..922703853a9 100644 --- a/code/ATMOSPHERICS/components/unary_devices/tank.dm +++ b/code/ATMOSPHERICS/components/unary_devices/tank.dm @@ -11,7 +11,7 @@ /obj/machinery/atmospherics/components/unary/tank/carbon_dioxide/New() ..() - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] 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) @@ -23,7 +23,7 @@ /obj/machinery/atmospherics/components/unary/tank/toxins/New() ..() - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] air_contents.volume = volume air_contents.temperature = T20C air_contents.toxins = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) @@ -35,7 +35,7 @@ /obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b/New() ..() - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] air_contents.volume = volume air_contents.temperature = T0C var/datum/gas/oxygen_agent_b/trace_gas = new @@ -49,7 +49,7 @@ /obj/machinery/atmospherics/components/unary/tank/oxygen/New() ..() - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] air_contents.volume = volume air_contents.temperature = T20C air_contents.oxygen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) @@ -61,7 +61,7 @@ /obj/machinery/atmospherics/components/unary/tank/nitrogen/New() ..() - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] air_contents.volume = volume air_contents.temperature = T20C air_contents.nitrogen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) @@ -73,7 +73,7 @@ /obj/machinery/atmospherics/components/unary/tank/air/New() ..() - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] 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) diff --git a/code/ATMOSPHERICS/components/unary_devices/unary_base.dm b/code/ATMOSPHERICS/components/unary_devices/unary_base.dm index e4a2198f120..d67ab08686a 100644 --- a/code/ATMOSPHERICS/components/unary_devices/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary_devices/unary_base.dm @@ -3,10 +3,17 @@ dir = SOUTH initialize_directions = SOUTH layer = TURF_LAYER+0.1 - node_amount = 1 + device_type = UNARY /obj/machinery/atmospherics/components/unary/SetInitDirections() initialize_directions = dir + +/* +Helpers +*/ + +/obj/machinery/atmospherics/components/unary/update_airs(var/a1) + ..(list("a1" = a1)) /* Iconnery */ @@ -16,30 +23,21 @@ Iconnery update_icon() ..(intact) -/* -Helpers -*/ - -/obj/machinery/atmospherics/components/unary/update_airs(var/a1) - ..(list(1 = a1)) /* Housekeeping and pipe network stuff below */ /obj/machinery/atmospherics/components/unary/atmosinit() - var/node_connects = list(1 = dir) - /*for(var/obj/machinery/atmospherics/target in get_step(src,dir)) - if(target.initialize_directions & get_dir(target,src)) - nodes[1] = target - break*/ + 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[1] + var/obj/machinery/atmospherics/node = nodes["n1"] if(node) node.disconnect(src) node = null @@ -52,4 +50,4 @@ Housekeeping and pipe network stuff below node.addMember(src) build_network() . = 1 - nodes[1] = node \ No newline at end of file + nodes["n1"] = node \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm index 29ef8b1d7c1..3f8274919a5 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm @@ -18,7 +18,7 @@ var/external_pressure_bound = ONE_ATMOSPHERE var/internal_pressure_bound = 0 - var/pressure_checks = 1 + var/pressure_checks = 1 //TODO: make these defines //1: Do not pass external_pressure_bound //2: Do not pass internal_pressure_bound //3: Do not pass either @@ -65,7 +65,7 @@ /obj/machinery/atmospherics/unary/vent_pump/high_volume/New() ..() - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] air_contents.volume = 1000 update_airs(air_contents) @@ -78,7 +78,7 @@ icon_state = "vent_welded" return - if(!nodes[1] || !on || stat & (NOPOWER|BROKEN)) + if(!nodes["n1"] || !on || stat & (NOPOWER|BROKEN)) icon_state = "vent_off" return @@ -91,7 +91,7 @@ ..() if(stat & (NOPOWER|BROKEN)) return - if (!nodes[1]) + if (!nodes["n1"]) on = 0 //broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0 if(!on) @@ -100,7 +100,7 @@ if(welded) return 0 - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] var/datum/gas_mixture/environment = loc.return_air() var/environment_pressure = environment.return_pressure() diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm index a63fadf0c84..06bdd4738b6 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm @@ -56,7 +56,7 @@ icon_state = "scrub_welded" return - if(!nodes[1] || !on || stat & (NOPOWER|BROKEN)) + if(!nodes["n1"] || !on || stat & (NOPOWER|BROKEN)) icon_state = "scrub_off" return @@ -114,13 +114,13 @@ ..() if(stat & (NOPOWER|BROKEN)) return - if (!nodes[1]) + if (!nodes["n1"]) on = 0 //broadcast_status() if(!on || welded) return 0 - var/datum/gas_mixture/air_contents = airs[1] + var/datum/gas_mixture/air_contents = airs["a1"] var/datum/gas_mixture/environment = loc.return_air() if(scrubbing) diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm index 6d3a308ed1c..1d110092c4f 100644 --- a/code/ATMOSPHERICS/datum_pipeline.dm +++ b/code/ATMOSPHERICS/datum_pipeline.dm @@ -207,8 +207,8 @@ var/pipenetwarnings = 10 GL += P.other_airs for(var/obj/machinery/atmospherics/binary/valve/V in P.other_atmosmch) if(V.open) - PL |= V.parents[1] - PL |= V.parents[2] + PL |= V.parents["p1"] + PL |= V.parents["p2"] for(var/obj/machinery/atmospherics/unary/portables_connector/C in P.other_atmosmch) if(C.connected_device) GL += C.portableConnectorReturnAir() diff --git a/code/modules/events/vent_clog.dm b/code/modules/events/vent_clog.dm index 6a9fcf140e5..d535c7f1b4a 100644 --- a/code/modules/events/vent_clog.dm +++ b/code/modules/events/vent_clog.dm @@ -11,14 +11,15 @@ var/list/vents = list() /datum/round_event/vent_clog/announce() - priority_announce("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert") + priority_announce("The scrubbers network is experiencing a backpressure surge. Some ejection of contents may occur.", "Atmospherics alert") /datum/round_event/vent_clog/setup() endWhen = rand(25, 100) for(var/obj/machinery/atmospherics/unary/vent_scrubber/temp_vent in machines) if(temp_vent.loc.z == ZLEVEL_STATION) - if(temp_vent.parent.other_atmosmch.len > 20) + var/datum/pipeline/temp_vent_parent = temp_vent.parents["p1"] + if(temp_vent_parent.other_atmosmch.len > 20) vents += temp_vent if(!vents.len) return kill() diff --git a/config/admins.txt b/config/admins.txt index 4b3dac24043..98ade024c33 100644 --- a/config/admins.txt +++ b/config/admins.txt @@ -7,6 +7,7 @@ # NOTE: if the rank-name cannot be found in admin_ranks.txt, they will not be adminned! ~Carn # # NOTE: syntax was changed to allow hyphenation of ranknames, since spaces are stripped. # ############################################################################################### +Dunc = Game Master Optimumtact = Host MrStonedOne = Game Master microscopics = Game Master @@ -87,4 +88,4 @@ Ahammer18 = Game Master ACCount12 = Game Master fayrik = Game Master shadowlight213 = Game Master -drovidicorv = Game Master \ No newline at end of file +drovidicorv = Game Master