diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 321e172522d..d7f878e06ca 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -9,7 +9,6 @@ Pipes -> Pipelines Pipelines + Other Objects -> Pipe network */ - /obj/machinery/atmospherics anchored = 1 idle_power_usage = 0 @@ -25,6 +24,9 @@ Pipelines + Other Objects -> Pipe network var/image/pipe_vision_img = null + var/device_type = 0 + var/list/obj/machinery/atmospherics/nodes = list() + /obj/machinery/atmospherics/New() ..() SSair.atmos_machinery += src @@ -47,8 +49,19 @@ Pipelines + Other Objects -> Pipe network ..() //this is called just after the air controller sets up turfs -/obj/machinery/atmospherics/proc/atmosinit() - return +/obj/machinery/atmospherics/proc/atmosinit(var/list/node_connects) + for(DEVICE_TYPE_LOOP) + for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[I])) + if(target.initialize_directions & get_dir(target,src)) + NODE_I = target + break + update_icon() + +/obj/machinery/atmospherics/proc/pipeline_expansion() + var/list/return_nodes = list() + for(DEVICE_TYPE_LOOP) + return_nodes |= NODE_I + return return_nodes /obj/machinery/atmospherics/proc/SetInitDirections() return @@ -70,7 +83,14 @@ Pipelines + Other Objects -> Pipe network return /obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference) - return + for(DEVICE_TYPE_LOOP) + if(reference == NODE_I) + if(istype(NODE_I, /obj/machinery/atmospherics/pipe)) + var/obj/machinery/atmospherics/pipe/P = NODE_I + qdel(P.parent) + NODE_I = null + break + update_icon() /obj/machinery/atmospherics/update_icon() return diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm index b78301584cb..df89a24e5ba 100644 --- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm +++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm @@ -28,10 +28,8 @@ Housekeeping and pipe network stuff */ /obj/machinery/atmospherics/components/binary/atmosinit() - var/node2_connect = dir var/node1_connect = turn(dir, 180) - var/list/node_connects = new/list() - node_connects.Add(node1_connect, node2_connect) + var/list/node_connects = list(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 f5da3152aae..436725a4baf 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -18,8 +18,8 @@ /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/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 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 9cecf78413f..fb3cbcdf028 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/components/binary/dp_vent_pump/high_volume/New() ..() - var/datum/gas_mixture/air1 = airs[AIR1] - var/datum/gas_mixture/air2 = airs[AIR2] + var/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 air1.volume = 1000 air2.volume = 1000 @@ -66,8 +66,8 @@ Acts like a normal vent, but has an input AND output. if(!on) return 0 - var/datum/gas_mixture/air1 = airs[AIR1] - var/datum/gas_mixture/air2 = airs[AIR2] + var/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 var/datum/gas_mixture/environment = loc.return_air() var/environment_pressure = environment.return_pressure() @@ -89,7 +89,7 @@ Acts like a normal vent, but has an input AND output. loc.assume_air(removed) air_update_turf() - var/datum/pipeline/parent1 = parents[PARENT1] + var/datum/pipeline/parent1 = PARENT1 parent1.update = 1 else //external -> output @@ -109,7 +109,7 @@ Acts like a normal vent, but has an input AND output. air2.merge(removed) air_update_turf() - var/datum/pipeline/parent2 = parents[PARENT2] + var/datum/pipeline/parent2 = PARENT2 parent2.update = 1 return 1 diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index d75d045a636..b522febf58e 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[AIR1] - var/datum/gas_mixture/air2 = airs[AIR2] + var/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 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 73482b9c864..c4f3073e767 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[AIR1] - var/datum/gas_mixture/air2 = airs[AIR2] + var/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 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 3239d3a6ec4..a99fa0df02b 100644 --- a/code/ATMOSPHERICS/components/binary_devices/valve.dm +++ b/code/ATMOSPHERICS/components/binary_devices/valve.dm @@ -28,7 +28,7 @@ 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[PARENT1] + var/datum/pipeline/parent1 = PARENT1 parent1.reconcile_air() investigate_log("was opened by [usr ? key_name(usr) : "a remote signal"]", "atmos") diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index a87f2964480..1d8253997f5 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[AIR1] - var/datum/gas_mixture/air2 = airs[AIR2] + var/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 // Pump mechanism just won't do anything if the pressure is too high/too low @@ -125,7 +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] + var/datum/gas_mixture/air1 = AIR1 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 78bd351c9f4..45b2b548d29 100644 --- a/code/ATMOSPHERICS/components/components_base.dm +++ b/code/ATMOSPHERICS/components/components_base.dm @@ -3,41 +3,19 @@ So much of atmospherics.dm was used solely by components, so separating this mak 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 //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++) + for(DEVICE_TYPE_LOOP) var/datum/gas_mixture/A = new A.volume = 200 - airs["a[I]"] = A + AIR_I = A /* Iconnery */ @@ -57,7 +35,7 @@ Iconnery /obj/machinery/atmospherics/components/proc/update_icon_nopipes() return -/obj/machinery/atmospherics/components/update_icon() //not working +/obj/machinery/atmospherics/components/update_icon() update_icon_nopipes() underlays.Cut() @@ -66,9 +44,9 @@ Iconnery 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) + for(DEVICE_TYPE_LOOP) //adds intact pieces + if(NODE_I) + connected = icon_addintact(NODE_I, connected) icon_addbroken(connected) //adds broken pieces @@ -77,83 +55,66 @@ Iconnery Pipenet stuff; housekeeping */ /obj/machinery/atmospherics/components/Destroy() - for(var/I = 1; I <= device_type; I++) - var/obj/machinery/atmospherics/N = nodes["n[I]"] + for(DEVICE_TYPE_LOOP) + var/obj/machinery/atmospherics/N = NODE_I if(N) N.disconnect(src) - nodes["n[I]"] = null - nullifyPipenet(parents["p[I]"]) + NODE_I = null + nullifyPipenet(PARENT_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 +/obj/machinery/atmospherics/components/atmosinit() 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]"] + for(DEVICE_TYPE_LOOP) + if(!PARENT_I) + PARENT_I = new /datum/pipeline() + var/datum/pipeline/P = PARENT_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]"]) - nodes["n[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]"] - parents["p[I]"] = null + for(DEVICE_TYPE_LOOP) + if(reference == PARENT_I) + var/datum/pipeline/P = PARENT_I + P.other_airs -= AIR_I + PARENT_I = null /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]"] + for(DEVICE_TYPE_LOOP) + if(reference == PARENT_I) + return AIR_I /obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/reference) if(reference) - for(var/I = 1; I <= device_type; I++) - if(parents["p[I]"] == reference) - return list(nodes["n[I]"]) + for(DEVICE_TYPE_LOOP) + if(PARENT_I == reference) + return list(NODE_I) else - var/list/obj/machinery/atmospherics/return_nodes = list() - for(var/I = 1; I <= device_type; I++) - return_nodes += nodes["n[I]"] - return return_nodes + return ..() /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 + for(DEVICE_TYPE_LOOP) + if(A == NODE_I) + PARENT_I = reference break -/obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A = nodes[NODE1]) //returns PARENT1 if called without argument - for(var/I = 1; I <= device_type; I++) - if(A == nodes["n[I]"]) - return parents["p[I]"] +/obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A = NODE1) //returns PARENT1 if called without argument + for(DEVICE_TYPE_LOOP) + if(A == NODE_I) + return PARENT_I /obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New) - for(var/I = 1; I <= device_type; I++) - if(parents["p[I]"] == Old) - parents["p[I]"] = New + for(DEVICE_TYPE_LOOP) + if(PARENT_I == Old) + PARENT_I = New /obj/machinery/atmospherics/components/unsafe_pressure_release(var/mob/user, var/pressures) ..() @@ -164,15 +125,15 @@ Pipenet stuff; housekeeping 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]"] + for(DEVICE_TYPE_LOOP) + var/datum/gas_mixture/air = AIR_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]"] + for(DEVICE_TYPE_LOOP) + var/datum/gas_mixture/air = AIR_I if(!to_release) to_release = air.remove(shared_loss) continue @@ -195,6 +156,6 @@ Helpers */ /obj/machinery/atmospherics/components/proc/update_parents() - for(var/I = 1; I <= device_type; I++) - var/datum/pipeline/parent = parents["p[I]"] + for(DEVICE_TYPE_LOOP) + var/datum/pipeline/parent = PARENT_I parent.update = 1 \ 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 a56bdd14c0c..439311ce86e 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -62,7 +62,7 @@ Filter types: /obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes() - if(!(stat & NOPOWER) && on && nodes[NODE1] && nodes[NODE2] && nodes[NODE3]) + if(!(stat & NOPOWER) && on && NODE1 && NODE2 && NODE3) icon_state = "filter_on[flipped?"_f":""]" return @@ -80,12 +80,12 @@ Filter types: ..() if(!on) return 0 - if(!(nodes[NODE1] && nodes[NODE2] && nodes[NODE3])) + if(!(NODE1 && NODE2 && 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/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 + var/datum/gas_mixture/air3 = AIR3 var/output_starting_pressure = air3.return_pressure() diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index 8b8850744ec..818b410626a 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -32,7 +32,7 @@ ..() /obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes() - if(!(stat & NOPOWER) && on && nodes[NODE1] && nodes[NODE2] && nodes[NODE3]) + if(!(stat & NOPOWER) && on && NODE1 && NODE2 && NODE3) icon_state = "mixer_on[flipped?"_f":""]" return @@ -48,20 +48,20 @@ /obj/machinery/atmospherics/components/trinary/mixer/New() ..() - var/datum/gas_mixture/air3 = airs[AIR3] + var/datum/gas_mixture/air3 = AIR3 air3.volume = 300 - airs[AIR3] = air3 + AIR3 = air3 /obj/machinery/atmospherics/components/trinary/mixer/process_atmos() ..() if(!on) return 0 - if(!(nodes[NODE1] && nodes[NODE2] && nodes[NODE3])) + if(!(NODE1 && NODE2 && 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/datum/gas_mixture/air1 = AIR1 + var/datum/gas_mixture/air2 = AIR2 + var/datum/gas_mixture/air3 = AIR3 var/output_starting_pressure = air3.return_pressure() @@ -107,14 +107,14 @@ air3.merge(removed2) if(transfer_moles1) - var/datum/pipeline/parent1 = parents[PARENT1] + var/datum/pipeline/parent1 = PARENT1 parent1.update = 1 if(transfer_moles2) - var/datum/pipeline/parent2 = parents[PARENT2] + var/datum/pipeline/parent2 = PARENT2 parent2.update = 1 - var/datum/pipeline/parent3 = parents[PARENT3] + var/datum/pipeline/parent3 = PARENT3 parent3.update = 1 return 1 diff --git a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm index cec9c7ed27b..d2c37ec30e0 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm @@ -43,7 +43,5 @@ Housekeeping and pipe network stuff node1_connect = turn(node1_connect, 180) node3_connect = turn(node3_connect, 180) - var/list/node_connects = new/list() - - node_connects.Add(node1_connect, node2_connect, node3_connect) + var/list/node_connects = list(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 b91d8a74dbb..83739c0e13b 100644 --- a/code/ATMOSPHERICS/components/unary_devices/Freezer.dm +++ b/code/ATMOSPHERICS/components/unary_devices/Freezer.dm @@ -69,7 +69,7 @@ /obj/machinery/atmospherics/components/unary/cold_sink/freezer/interact(mob/user) if(stat & (NOPOWER|BROKEN)) return - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 user.set_machine(src) var/temp_text = "" if(air_contents.temperature > (T0C - 20)) @@ -194,7 +194,7 @@ return interact(user) /obj/machinery/atmospherics/components/unary/heat_reservoir/heater/interact(mob/user) - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 if(stat & (NOPOWER|BROKEN)) return diff --git a/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm b/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm index 7750a7c7b14..65419798bfd 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/components/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now - if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN)) + if(!NODE1 || !on || stat & (NOPOWER|BROKEN)) icon_state = "cold_off" return @@ -27,7 +27,7 @@ ..() if(!on) return 0 - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 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 87eb0e606e8..4565fd97ccc 100644 --- a/code/ATMOSPHERICS/components/unary_devices/cryo.dm +++ b/code/ATMOSPHERICS/components/unary_devices/cryo.dm @@ -47,7 +47,7 @@ ..() /obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos() ..() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 if(air_contents) temperature_archived = air_contents.temperature @@ -62,14 +62,14 @@ on = 0 open_machine() playsound(src.loc, 'sound/machines/ding.ogg', 50, 1) - if(!nodes[NODE1] || !is_operational()) + if(!NODE1 || !is_operational()) return if(!on) updateDialog() return - if(airs[AIR1]) + if(AIR1) if (occupant) process_occupant() expel_gas() @@ -145,7 +145,7 @@ /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/datum/gas_mixture/air_contents = AIR1 var/data = list() data["isOperating"] = on @@ -289,7 +289,7 @@ update_icon() /obj/machinery/atmospherics/components/unary/cryo_cell/proc/process_occupant() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 if(air_contents.total_moles() < 10) return if(occupant) @@ -321,7 +321,7 @@ /obj/machinery/atmospherics/components/unary/cryo_cell/proc/heat_gas_contents() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 if(air_contents.total_moles() < 1) return @@ -332,7 +332,7 @@ 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] + var/datum/gas_mixture/air_contents = AIR1 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 20d1474ffd3..15ae3eb88f9 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/components/unary/generator_input/update_icon() - if(nodes[NODE1]) + if(NODE1) icon_state = "intact" else icon_state = "exposed" @@ -17,4 +17,4 @@ return /obj/machinery/atmospherics/components/unary/generator_input/proc/return_exchange_air() - return airs[AIR1] + return AIR1 diff --git a/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm b/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm index 21746bc4e97..1b400dad2bb 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/components/unary/heat_exchanger/update_icon() - if(nodes[NODE1]) + if(NODE1) icon_state = "he_intact" - var/obj/machinery/atmospherics/node = nodes[NODE1] + var/obj/machinery/atmospherics/node = NODE1 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[AIR1] - var/datum/gas_mixture/partner_air_contents = partner.airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 + var/datum/gas_mixture/partner_air_contents = partner.AIR1 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 ceba342a5fa..b08a4a214a7 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/components/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now - if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN)) + if(!NODE1 || !on || stat & (NOPOWER|BROKEN)) icon_state = "cold_off" return @@ -29,7 +29,7 @@ if(!on) return 0 - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 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 10ecdf726d9..3de7973b1f6 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/components/unary/outlet_injector/update_icon_nopipes() - if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN)) + if(!NODE1 || !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[AIR1] + var/datum/gas_mixture/air_contents = AIR1 if(air_contents.temperature > 0) var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION) @@ -63,7 +63,7 @@ if(on || injecting) return 0 - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 injecting = 1 @@ -126,7 +126,7 @@ if("set_volume_rate" in signal.data) var/number = text2num(signal.data["set_volume_rate"]) - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 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 d8c1d69e200..0c0bee0b275 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/components/unary_devices.dmi', "scrub_cap", initialize_directions) //it works for now - if(!nodes[NODE1] || !on || stat & BROKEN) + if(!NODE1 || !on || stat & BROKEN) icon_state = "o2gen_off" return @@ -27,16 +27,16 @@ /obj/machinery/atmospherics/components/unary/oxygen_generator/New() ..() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 air_contents.volume = 50 - airs[AIR1] = air_contents + AIR1 = air_contents /obj/machinery/atmospherics/components/unary/oxygen_generator/process_atmos() ..() if(!on) return 0 - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 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 8f8f6b9e831..f5113d05305 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[AIR1] + var/datum/gas_mixture/air_contents = 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) @@ -22,7 +22,7 @@ /obj/machinery/atmospherics/components/unary/tank/toxins/New() ..() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = 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) @@ -33,7 +33,7 @@ /obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b/New() ..() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 air_contents.volume = volume air_contents.temperature = T0C var/datum/gas/oxygen_agent_b/trace_gas = new @@ -46,7 +46,7 @@ /obj/machinery/atmospherics/components/unary/tank/oxygen/New() ..() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = 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) @@ -57,7 +57,7 @@ /obj/machinery/atmospherics/components/unary/tank/nitrogen/New() ..() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = 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) @@ -68,7 +68,7 @@ /obj/machinery/atmospherics/components/unary/tank/air/New() ..() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = 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) diff --git a/code/ATMOSPHERICS/components/unary_devices/unary_base.dm b/code/ATMOSPHERICS/components/unary_devices/unary_base.dm index 96b99f52fd1..1d6a92c7206 100644 --- a/code/ATMOSPHERICS/components/unary_devices/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary_devices/unary_base.dm @@ -23,21 +23,20 @@ Housekeeping and pipe network stuff below */ /obj/machinery/atmospherics/components/unary/atmosinit() - var/list/node_connects = new/list() - node_connects.Add(dir) + var/list/node_connects = list(dir) ..(node_connects) /obj/machinery/atmospherics/components/unary/default_change_direction_wrench(mob/user, obj/item/weapon/wrench/W) if(!..()) return SetInitDirections() - var/obj/machinery/atmospherics/node = nodes[NODE1] + var/obj/machinery/atmospherics/node = NODE1 if(node) node.disconnect(src) node = null - nullifyPipenet(parents[PARENT1]) + nullifyPipenet(PARENT1) atmosinit() - node = nodes[NODE1] + node = NODE1 if(node) node.atmosinit() node.addMember(src) diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm index 7d574f302d6..94d28113548 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm @@ -67,7 +67,7 @@ /obj/machinery/atmospherics/components/unary/vent_pump/high_volume/New() ..() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 air_contents.volume = 1000 /obj/machinery/atmospherics/components/unary/vent_pump/update_icon_nopipes() @@ -79,7 +79,7 @@ icon_state = "vent_welded" return - if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN)) + if(!NODE1 || !on || stat & (NOPOWER|BROKEN)) icon_state = "vent_off" return @@ -92,7 +92,7 @@ ..() if(stat & (NOPOWER|BROKEN)) return - if (!nodes[NODE1]) + if (!NODE1) on = 0 //broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0 if(!on) @@ -101,7 +101,7 @@ if(welded) return 0 - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 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 691835ed4cc..e4f6e606364 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm @@ -86,7 +86,7 @@ icon_state = "scrub_welded" return - if(!nodes[NODE1] || !on || stat & (NOPOWER|BROKEN)) + if(!NODE1 || !on || stat & (NOPOWER|BROKEN)) icon_state = "scrub_off" return @@ -142,7 +142,7 @@ ..() if(stat & (NOPOWER|BROKEN)) return - if (!nodes[NODE1]) + if (!NODE1) on = 0 //broadcast_status() if(!on || welded) @@ -159,7 +159,7 @@ return 0 var/datum/gas_mixture/environment = tile.return_air() - var/datum/gas_mixture/air_contents = airs[AIR1] + var/datum/gas_mixture/air_contents = AIR1 if(scrubbing) if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0)) diff --git a/code/ATMOSPHERICS/pipes/he_pipes.dm b/code/ATMOSPHERICS/pipes/he_pipes.dm index 119b371d59b..10f900ab5d3 100644 --- a/code/ATMOSPHERICS/pipes/he_pipes.dm +++ b/code/ATMOSPHERICS/pipes/he_pipes.dm @@ -18,6 +18,8 @@ color = "#404040" /obj/machinery/atmospherics/pipe/simple/heat_exchanging/SetInitDirections() + if(dir in diagonals) + initialize_directions_he = dir switch(dir) if(SOUTH) initialize_directions_he = SOUTH|NORTH @@ -27,14 +29,6 @@ initialize_directions_he = EAST|WEST if(WEST) initialize_directions_he = WEST|EAST - if(NORTHEAST) - initialize_directions_he = NORTH|EAST - if(NORTHWEST) - initialize_directions_he = NORTH|WEST - if(SOUTHEAST) - initialize_directions_he = SOUTH|EAST - if(SOUTHWEST) - initialize_directions_he = SOUTH|WEST /obj/machinery/atmospherics/pipe/simple/heat_exchanging/atmosinit() normalize_dir() @@ -44,11 +38,11 @@ N-- for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src, D)) if(target.initialize_directions_he & get_dir(target,src)) - if(!node1 && N == 1) - node1 = target + if(!NODE1 && N == 1) + NODE1 = target break - if(!node2 && N == 0) - node2 = target + if(!NODE2 && N == 0) + NODE2 = target break update_icon() ..() @@ -131,21 +125,21 @@ initialize_directions_he = WEST /obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/update_icon() - if(node1&&node2) + if(NODE1&&NODE2) icon_state = "intact" else - var/have_node1 = node1?1:0 - var/have_node2 = node2?1:0 + var/have_node1 = NODE1?1:0 + var/have_node2 = NODE2?1:0 icon_state = "exposed[have_node1][have_node2]" /obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/atmosinit() for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions)) if(target.initialize_directions & get_dir(target,src)) - node1 = target + NODE1 = target break for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,initialize_directions_he)) if(target.initialize_directions_he & get_dir(target,src)) - node2 = target + NODE2 = target break update_icon() ..() \ No newline at end of file diff --git a/code/ATMOSPHERICS/pipes/manifold.dm b/code/ATMOSPHERICS/pipes/manifold.dm index 8f6ac175080..2a56452d46f 100644 --- a/code/ATMOSPHERICS/pipes/manifold.dm +++ b/code/ATMOSPHERICS/pipes/manifold.dm @@ -15,18 +15,13 @@ dir = SOUTH initialize_directions = EAST|NORTH|WEST - var/obj/machinery/atmospherics/node1 - var/obj/machinery/atmospherics/node2 - var/obj/machinery/atmospherics/node3 - - level = 1 - layer = 2.4 //under wires with their 2.44 - + device_type = TRINARY +/* /obj/machinery/atmospherics/pipe/manifold/New() color = pipe_color ..() - +*/ /obj/machinery/atmospherics/pipe/manifold/SetInitDirections() switch(dir) if(NORTH) @@ -39,6 +34,12 @@ initialize_directions = NORTH|EAST|SOUTH /obj/machinery/atmospherics/pipe/manifold/atmosinit() + var/node1_connect = turn(dir, 90) + var/node2_connect = turn(dir, 270) + var/node3_connect = turn(dir, 180) + var/list/node_connects = list(node1_connect, node2_connect, node3_connect) + ..(node_connects) +/* for(var/D in cardinal) if(D == dir) continue @@ -90,7 +91,7 @@ node3 = null update_icon() ..() - +*/ /obj/machinery/atmospherics/pipe/manifold/update_icon() var/invis = invisibility ? "-f" : "" @@ -99,15 +100,10 @@ overlays.Cut() //Add non-broken pieces - if(node1) - overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", get_dir(src,node1)) - - if(node2) - overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", get_dir(src,node2)) - - if(node3) - overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", get_dir(src,node3)) - + for(DEVICE_TYPE_LOOP) + if(NODE_I) + overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", get_dir(src, NODE_I)) +/* /obj/machinery/atmospherics/pipe/manifold/hide(i) if(level == 1 && istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 @@ -124,7 +120,7 @@ node2.update_icon() if(node3) node3.update_icon() - +*/ //Colored pipes, use these for mapping /obj/machinery/atmospherics/pipe/manifold/general diff --git a/code/ATMOSPHERICS/pipes/manifold4w.dm b/code/ATMOSPHERICS/pipes/manifold4w.dm index 4db873eed76..da510edb363 100644 --- a/code/ATMOSPHERICS/pipes/manifold4w.dm +++ b/code/ATMOSPHERICS/pipes/manifold4w.dm @@ -13,22 +13,18 @@ initialize_directions = NORTH|SOUTH|EAST|WEST - var/obj/machinery/atmospherics/node1 // North - var/obj/machinery/atmospherics/node2 // South - var/obj/machinery/atmospherics/node3 // East - var/obj/machinery/atmospherics/node4 // West - - level = 1 - layer = 2.4 //under wires with their 2.44 - + device_type = QUATERNARY +/* /obj/machinery/atmospherics/pipe/manifold4w/New() color = pipe_color ..() - +*/ /obj/machinery/atmospherics/pipe/manifold4w/SetInitDirections() - return + initialize_directions = initial(initialize_directions) /obj/machinery/atmospherics/pipe/manifold4w/atmosinit() + ..(cardinal) +/* for(var/D in cardinal) for(var/obj/machinery/atmospherics/target in get_step(src, D)) if(target.initialize_directions & get_dir(target,src)) @@ -98,12 +94,8 @@ node4 = null update_icon() ..() - +*/ /obj/machinery/atmospherics/pipe/manifold4w/update_icon() - if(!node1 && !node2 && !node3 && !node4) //Remove us if we ain't connected to anything. - qdel(src) - return - var/invis = invisibility ? "-f" : "" icon_state = "manifold4w_center[invis]" @@ -111,18 +103,10 @@ overlays.Cut() //Add non-broken pieces - if(node1) - overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", NORTH) - - if(node2) - overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", SOUTH) - - if(node3) - overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", EAST) - - if(node4) - overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", WEST) - + for(DEVICE_TYPE_LOOP) + if(NODE_I) + overlays += getpipeimage('icons/obj/atmospherics/pipes/manifold.dmi', "manifold_full[invis]", get_dir(src, NODE_I)) +/* /obj/machinery/atmospherics/pipe/manifold4w/update_node_icon() ..() if(node1) @@ -133,7 +117,7 @@ node3.update_icon() if(node4) node4.update_icon() - +*/ //Colored pipes, use these for mapping /obj/machinery/atmospherics/pipe/manifold4w/general name="pipe" diff --git a/code/ATMOSPHERICS/pipes/pipes.dm b/code/ATMOSPHERICS/pipes/pipes.dm index f0ca8f8e244..b4b780ae60c 100644 --- a/code/ATMOSPHERICS/pipes/pipes.dm +++ b/code/ATMOSPHERICS/pipes/pipes.dm @@ -1,7 +1,10 @@ /obj/machinery/atmospherics/pipe var/datum/gas_mixture/air_temporary //used when reconstructing a pipeline that broke var/volume = 0 + + level = 1 layer = 2.4 //under wires with their 2.44 + use_power = 0 can_unwrench = 1 var/datum/pipeline/parent = null @@ -11,8 +14,30 @@ buckle_requires_restraints = 1 buckle_lying = -1 -/obj/machinery/atmospherics/proc/pipeline_expansion() - return null +/obj/machinery/atmospherics/pipe/New() + color = pipe_color + ..() + +/obj/machinery/atmospherics/pipe/Destroy() + for(DEVICE_TYPE_LOOP) + var/obj/machinery/atmospherics/N = NODE_I + if(N) + var/obj/machinery/atmospherics/oldN = N + N.disconnect(src) + NODE_I = null + oldN.build_network() + releaseAirToTurf() + ..() + +/obj/machinery/atmospherics/pipe/atmosinit() + var/turf/T = loc // hide if turf is not intact + hide(T.intact) + ..() + +/obj/machinery/atmospherics/pipe/hide(i) + if(level == 1 && istype(loc, /turf/simulated)) + invisibility = i ? 101 : 0 + update_icon() /obj/machinery/atmospherics/pipe/proc/check_pressure(pressure) //Return 1 if parent should continue checking other pipes @@ -59,5 +84,7 @@ ..() /obj/machinery/atmospherics/pipe/proc/update_node_icon() - //Used for pipe painting. Overriden in the children. - return + for(DEVICE_TYPE_LOOP) + if(NODE_I) + var/obj/machinery/atmospherics/N = NODE_I + N.update_icon() diff --git a/code/ATMOSPHERICS/pipes/simple.dm b/code/ATMOSPHERICS/pipes/simple.dm index b4685c44a1d..98b633a10d3 100644 --- a/code/ATMOSPHERICS/pipes/simple.dm +++ b/code/ATMOSPHERICS/pipes/simple.dm @@ -16,18 +16,17 @@ The regular pipe you see everywhere, including bent ones. dir = SOUTH initialize_directions = SOUTH|NORTH - var/obj/machinery/atmospherics/node1 - var/obj/machinery/atmospherics/node2 - - level = 1 - + device_type = BINARY +/* /obj/machinery/atmospherics/pipe/simple/New() color = pipe_color ..() - +*/ /obj/machinery/atmospherics/pipe/simple/SetInitDirections() + if(dir in diagonals) + initialize_directions = dir switch(dir) if(NORTH) initialize_directions = SOUTH|NORTH @@ -37,34 +36,23 @@ The regular pipe you see everywhere, including bent ones. initialize_directions = EAST|WEST if(WEST) initialize_directions = EAST|WEST - if(NORTHEAST) - initialize_directions = NORTH|EAST - if(NORTHWEST) - initialize_directions = NORTH|WEST - if(SOUTHEAST) - initialize_directions = SOUTH|EAST - if(SOUTHWEST) - initialize_directions = SOUTH|WEST /obj/machinery/atmospherics/pipe/simple/atmosinit() normalize_dir() - var/N = 2 - for(var/D in cardinal) - if(D & initialize_directions) - N-- - for(var/obj/machinery/atmospherics/target in get_step(src, D)) - if(target.initialize_directions & get_dir(target,src)) - if(!node1 && N == 1) - node1 = target - break - if(!node2 && N == 0) - node2 = target - break - var/turf/T = loc // hide if turf is not intact - hide(T.intact) - update_icon() - ..() + var/list/node_connects = list() + if(dir in diagonals) //bent pipes + for(var/D in cardinal) + if(D & initialize_directions) + node_connects |= D + else //straight pipes + var/node1_connect = dir + var/node2_connect = turn(dir, 180) + node_connects = list(node1_connect, node2_connect) + + ..(node_connects) + +/* /obj/machinery/atmospherics/pipe/simple/Destroy() if(node1) var/obj/machinery/atmospherics/A = node1 @@ -89,7 +77,7 @@ The regular pipe you see everywhere, including bent ones. qdel(parent) node2 = null update_icon() - +*/ /obj/machinery/atmospherics/pipe/simple/proc/normalize_dir() if(dir==2) dir = 1 @@ -97,13 +85,13 @@ The regular pipe you see everywhere, including bent ones. dir = 4 /obj/machinery/atmospherics/pipe/simple/update_icon() - if(node1&&node2) + if(NODE1&&NODE2) icon_state = "intact[invisibility ? "-f" : "" ]" else - var/have_node1 = node1?1:0 - var/have_node2 = node2?1:0 + var/have_node1 = NODE1?1:0 + var/have_node2 = NODE2?1:0 icon_state = "exposed[have_node1][have_node2][invisibility ? "-f" : "" ]" - +/* /obj/machinery/atmospherics/pipe/simple/hide(i) if(level == 1 && istype(loc, /turf/simulated)) invisibility = i ? 101 : 0 @@ -118,7 +106,7 @@ The regular pipe you see everywhere, including bent ones. node1.update_icon() if(node2) node2.update_icon() - +*/ //Colored pipes, use these for mapping /obj/machinery/atmospherics/pipe/simple/general name="pipe" diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm index 1745c74f2a2..80fd3613796 100644 --- a/code/__DEFINES/atmospherics.dm +++ b/code/__DEFINES/atmospherics.dm @@ -106,9 +106,42 @@ #define PRESSURE_DAMAGE_COEFFICIENT 4 //The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT, with the maximum of MAX_PRESSURE_DAMAGE #define MAX_HIGH_PRESSURE_DAMAGE 4 //This used to be 20... I got this much random rage for some retarded decision by polymorph?! Polymorph now lies in a pool of blood with a katana jammed in his spleen. ~Errorage --PS: The katana did less than 20 damage to him :( #define LOW_PRESSURE_DAMAGE 2 //The amounb of damage someone takes when in a low pressure area (The pressure threshold is so low that it doesn't make sense to do any calculations, so it just applies this flat value). - -#define COLD_SLOWDOWN_FACTOR 20 //Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this + +#define COLD_SLOWDOWN_FACTOR 20 //Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this // Atmos pipe limits #define MAX_OUTPUT_PRESSURE 4500 // (kPa) What pressure pumps and powered equipment max out at. -#define MAX_TRANSFER_RATE 200 // (L/s) Maximum speed powered equipment can work at. \ No newline at end of file +#define MAX_TRANSFER_RATE 200 // (L/s) Maximum speed powered equipment can work at. + +//Atmos machinery pipenet stuff + +// used for device_type vars; used by DEVICE_TYPE_LOOP +#define UNARY 1 +#define BINARY 2 +#define TRINARY 3 +#define QUATERNARY 4 + +// this is the standard for loop used by all sorts of atmos machinery procs +#define DEVICE_TYPE_LOOP var/I = 1; I <= device_type; I++ + +// defines for the various machinery lists +// NODE_I, AIR_I, PARENT_I are used within DEVICE_TYPE_LOOP + +// nodes list - all atmos machinery +#define NODE1 nodes["n1"] +#define NODE2 nodes["n2"] +#define NODE3 nodes["n3"] +#define NODE4 nodes["n4"] +#define NODE_I nodes["n[I]"] + +// airs list - components only +#define AIR1 airs["a1"] +#define AIR2 airs["a2"] +#define AIR3 airs["a3"] +#define AIR_I airs["a[I]"] + +// parents list - components only +#define PARENT1 parents["p1"] +#define PARENT2 parents["p2"] +#define PARENT3 parents["p3"] +#define PARENT_I parents["p[I]"] \ No newline at end of file diff --git a/code/game/machinery/atmoalter/portable_atmospherics.dm b/code/game/machinery/atmoalter/portable_atmospherics.dm index e484b42e4c3..b345ea16cd2 100644 --- a/code/game/machinery/atmoalter/portable_atmospherics.dm +++ b/code/game/machinery/atmoalter/portable_atmospherics.dm @@ -47,7 +47,7 @@ //Perform the connection connected_port = new_port connected_port.connected_device = src - var/datum/pipeline/connected_port_parent = connected_port.parents[PARENT1] + var/datum/pipeline/connected_port_parent = connected_port.PARENT1 connected_port_parent.reconcile_air() anchored = 1 //Prevent movement diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index dd5fee98f6c..f6655f193c9 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -13,12 +13,12 @@ //Manifolds for (var/obj/machinery/atmospherics/pipe/manifold/pipe in world) - if (!pipe.node1 || !pipe.node2 || !pipe.node3) + if (!pipe.NODE1 || !pipe.NODE2 || !pipe.NODE3) usr << "Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])" //Pipes for (var/obj/machinery/atmospherics/pipe/simple/pipe in world) - if (!pipe.node1 || !pipe.node2) + if (!pipe.NODE1 || !pipe.NODE2) usr << "Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])" /client/proc/powerdebug() diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index c0531581a36..a44e4865897 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -37,7 +37,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/components/unary if(vent_found) - var/datum/pipeline/vent_found_parent = vent_found.parents[PARENT1] + var/datum/pipeline/vent_found_parent = vent_found.PARENT1 if(vent_found_parent && (vent_found_parent.members.len || vent_found_parent.other_atmosmch)) visible_message("[src] begins climbing into the ventilation system..." ,"You begin climbing into the ventilation system...") @@ -70,7 +70,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/components/unary if(!istype(starting_machine) || !starting_machine.returnPipenet()) return var/list/totalMembers = list() - var/datum/pipeline/starting_machine_parent = starting_machine.parents[PARENT1] + var/datum/pipeline/starting_machine_parent = starting_machine.PARENT1 totalMembers += starting_machine_parent.members totalMembers += starting_machine_parent.other_atmosmch