From 0e004e3939d6237dffc4b3a79117ee7a3c7dfd15 Mon Sep 17 00:00:00 2001 From: duncathan Date: Sat, 11 Jul 2015 02:00:58 -0600 Subject: [PATCH] fixes runtimes --- TODO.txt | 4 +- .../binary_devices/binary_atmos_base.dm | 6 --- .../components/binary_devices/circulator.dm | 2 - .../components/binary_devices/dp_vent_pump.dm | 7 +-- .../components/binary_devices/passive_gate.dm | 1 - .../components/binary_devices/pump.dm | 1 - .../components/binary_devices/valve.dm | 1 - .../components/binary_devices/volume_pump.dm | 1 - .../components/components_base.dm | 50 +++++++------------ .../components/trinary_devices/filter.dm | 1 - .../components/trinary_devices/mixer.dm | 7 ++- .../trinary_devices/trinary_base.dm | 5 -- .../components/unary_devices/cold_sink.dm | 1 - .../components/unary_devices/cryo.dm | 5 +- .../unary_devices/heat_exchanger.dm | 3 -- .../components/unary_devices/heat_source.dm | 1 - .../unary_devices/outlet_injector.dm | 2 - .../unary_devices/oxygen_generator.dm | 1 - .../components/unary_devices/tank.dm | 8 +-- .../components/unary_devices/unary_base.dm | 6 --- .../components/unary_devices/vent_pump.dm | 2 - .../components/unary_devices/vent_scrubber.dm | 1 - code/modules/power/generator.dm | 14 +++--- 23 files changed, 32 insertions(+), 98 deletions(-) diff --git a/TODO.txt b/TODO.txt index e2e3b29d086..1187050192d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,4 +1,2 @@ make air flow - likely an issue with multiple devices' process_atmos procs -fix runtime at line 51 in datum_pipeline.dm - problem with the return value of pipeline_expansion \ No newline at end of file + likely an issue with multiple devices' process_atmos procs; who knows \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm index a63f0147b77..466898bc53a 100644 --- a/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm +++ b/code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm @@ -24,12 +24,6 @@ Iconnery ..(intact) /* -Helpers -*/ - -/obj/machinery/atmospherics/components/binary/update_airs(var/a1, var/a2) - ..(list("a1" = a1, "a2" = a2)) -/* Housekeeping and pipe network stuff */ diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm index 67b2420fbf5..7f489bc6820 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -42,8 +42,6 @@ //Actually transfer the gas var/datum/gas_mixture/removed = air2.remove(transfer_moles) - update_airs(air1, air2) - update_parents() return removed diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index 975a3067855..fc00c522f48 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -44,7 +44,6 @@ Acts like a normal vent, but has an input AND output. ..() 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() overlays.Cut() @@ -88,7 +87,7 @@ Acts like a normal vent, but has an input AND output. loc.assume_air(removed) air_update_turf() - update_parents(list("p1" = parents["p1"])) //this looks disgusting, but it works + var/datum/pipeline/parent1 = parents["p1"] ; parent1.update = 1 else //external -> output var/pressure_delta = 10000 @@ -107,9 +106,7 @@ Acts like a normal vent, but has an input AND output. air2.merge(removed) air_update_turf() - update_parents(list("p2" = parents["p2"])) - - update_airs(air1, air2) + var/datum/pipeline/parent2 = parents["p2"] ; 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 058dd3d088f..5f64ec72075 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -62,7 +62,6 @@ Passive gate is similar to the regular pump except: var/datum/gas_mixture/removed = air1.remove(transfer_moles) air2.merge(removed) - update_airs(air1, air2) update_parents() diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index 8f391d9cd33..f34cf5dc602 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -66,7 +66,6 @@ Thus, the two variables affect pump operation are set in New(): var/datum/gas_mixture/removed = air1.remove(transfer_moles) air2.merge(removed) - update_airs(air1, air2) update_parents() return 1 diff --git a/code/ATMOSPHERICS/components/binary_devices/valve.dm b/code/ATMOSPHERICS/components/binary_devices/valve.dm index 61749cd2bf3..cb978048917 100644 --- a/code/ATMOSPHERICS/components/binary_devices/valve.dm +++ b/code/ATMOSPHERICS/components/binary_devices/valve.dm @@ -29,7 +29,6 @@ It's like a regular ol' straight pipe, but you can turn it on and off. update_icon_nopipes() update_parents() 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 a5ace7d427c..c1beaa8ae8f 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -65,7 +65,6 @@ Thus, the two variables affect pump operation are set in New(): air2.merge(removed) - update_airs(air1, air2) update_parents() return 1 diff --git a/code/ATMOSPHERICS/components/components_base.dm b/code/ATMOSPHERICS/components/components_base.dm index bf05e33b7e4..9952c58ccdd 100644 --- a/code/ATMOSPHERICS/components/components_base.dm +++ b/code/ATMOSPHERICS/components/components_base.dm @@ -20,7 +20,7 @@ On top of that, now people can add component-speciic procs/vars if they want! //BINARY = 2 //TRINARY = 3 -/obj/machinery/atmospherics/components/New() //it's workiiiing +/obj/machinery/atmospherics/components/New() ..() for(var/I = 1; I <= device_type; I++) var/datum/gas_mixture/A = new @@ -55,8 +55,9 @@ Iconnery var/connected = 0 for(var/I = 1; I <= device_type; I++) //adds intact pieces - var/obj/machinery/atmospherics/N = nodes["n[I]"] - connected = icon_addintact(N, connected) + if(nodes["n[I]"]) + connected = icon_addintact(nodes["n[I]"], connected) + icon_addbroken(connected) //adds broken pieces @@ -103,11 +104,11 @@ Pipenet stuff; housekeeping break update_icon() -/obj/machinery/atmospherics/components/nullifyPipenet(datum/pipeline/reference) //untestable +/obj/machinery/atmospherics/components/nullifyPipenet(datum/pipeline/reference) ..() for(var/I = 1; I <= device_type; I++) - var/datum/pipeline/P = parents["p[I]"] - if(reference == P) + if(reference == parents["p[I]"]) + var/datum/pipeline/P = parents["p[I]"] P.other_airs -= airs["a[I]"] P = null break @@ -117,14 +118,13 @@ Pipenet stuff; housekeeping if(reference == parents["p[I]"]) return airs["a[I]"] -/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) - I++ +/obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/reference) //runtime + if(reference) + for(var/I = 1; I <= device_type; I++) + if(nodes["n[I]"]) + if(parents["p[I]"] == reference) + return list("n" = nodes["n1"]) + return nodes /obj/machinery/atmospherics/components/setPipenet(datum/pipeline/reference, obj/machinery/atmospherics/A) for(var/I = 1; I <= device_type; I++) @@ -135,7 +135,7 @@ Pipenet stuff; housekeeping /obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A) for(var/I = 1; I <= device_type; I++) if(A == nodes["n[I]"]) - return parents["p[I]"] //probably works + return parents["p[I]"] /obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New) for(var/datum/pipeline/P in parents) @@ -182,21 +182,7 @@ I think this is NanoUI? /* Helpers */ -/obj/machinery/atmospherics/components/proc/update_airs(var/list/L) - 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) - var/I = 1 - for(var/datum/pipeline/parent in L) - 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 +/obj/machinery/atmospherics/components/proc/update_parents() + for(var/datum/pipeline/parent in parents) + 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 0047cb3d359..69d80ef8b26 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -146,7 +146,6 @@ Filter types: air2.merge(filtered_out) air3.merge(removed) - update_airs(air1, air2, air3) update_parents() return 1 diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index 9d5a1860464..15bf4f2fdc8 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -104,13 +104,12 @@ air3.merge(removed2) if(transfer_moles1) - update_parents(list("p1" = parents["p1"])) + var/datum/pipeline/parent1 = parents["p1"] ; parent1.update = 1 if(transfer_moles2) - update_parents(list("p2" = parents["p2"])) + var/datum/pipeline/parent2 = parents["p2"] ; parent2.update = 1 - update_airs(air1, air2, air3) - update_parents(list("p3" = parents["p3"])) + var/datum/pipeline/parent3 = parents["p3"] ; 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 dda2ea802f1..5ea47605266 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/trinary_base.dm @@ -19,11 +19,6 @@ initialize_directions = WEST|NORTH|EAST /* -Helpers -*/ -/obj/machinery/atmospherics/components/trinary/update_airs(var/a1, var/a2, var/a3) - ..(list("a1" = a1, "a2" = a2, "a3" = a3)) -/* Housekeeping and pipe network stuff */ diff --git a/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm b/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm index 15ddc423edd..722f56926fd 100644 --- a/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm +++ b/code/ATMOSPHERICS/components/unary_devices/cold_sink.dm @@ -38,7 +38,6 @@ air_contents.temperature = combined_energy/combined_heat_capacity //todo: have current temperature affected. require power to bring down current temperature again - update_airs(air_contents) if(abs(old_temperature-air_contents.temperature) > 1) update_parents() return 1 diff --git a/code/ATMOSPHERICS/components/unary_devices/cryo.dm b/code/ATMOSPHERICS/components/unary_devices/cryo.dm index 522826535b7..bcacd991678 100644 --- a/code/ATMOSPHERICS/components/unary_devices/cryo.dm +++ b/code/ATMOSPHERICS/components/unary_devices/cryo.dm @@ -331,8 +331,6 @@ if(combined_heat_capacity > 0) var/combined_energy = T20C * current_heat_capacity + air_heat_capacity * air_contents.temperature air_contents.temperature = combined_energy/combined_heat_capacity - update_airs(air_contents) - /obj/machinery/atmospherics/components/unary/cryo_cell/proc/expel_gas() var/datum/gas_mixture/air_contents = airs["a1"] @@ -344,5 +342,4 @@ expel_gas = air_contents.remove(remove_amount) expel_gas.temperature = T20C //Lets expel hot gas and see if that helps people not die as they are removed loc.assume_air(expel_gas) - air_update_turf() - update_airs(air_contents) + air_update_turf() \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm b/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm index 69c975f68ed..7e3f5294525 100644 --- a/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm +++ b/code/ATMOSPHERICS/components/unary_devices/heat_exchanger.dm @@ -66,7 +66,4 @@ if(abs(other_old_temperature-partner_air_contents.temperature) > 1) partner.update_parents() - update_airs(air_contents) - partner.update_airs(partner_air_contents) - return 1 diff --git a/code/ATMOSPHERICS/components/unary_devices/heat_source.dm b/code/ATMOSPHERICS/components/unary_devices/heat_source.dm index 8a8a1daa322..0b86ff02248 100644 --- a/code/ATMOSPHERICS/components/unary_devices/heat_source.dm +++ b/code/ATMOSPHERICS/components/unary_devices/heat_source.dm @@ -43,5 +43,4 @@ if(abs(old_temperature-air_contents.temperature) > 1) update_parents() - update_airs(air_contents) return 1 diff --git a/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm b/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm index 3e558451c36..ed548bbd3e2 100644 --- a/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary_devices/outlet_injector.dm @@ -55,7 +55,6 @@ loc.assume_air(removed) air_update_turf() - update_airs(air_contents) update_parents() return 1 @@ -75,7 +74,6 @@ loc.assume_air(removed) - update_airs(air_contents) update_parents() flick("inje_inject", src) diff --git a/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm b/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm index 8b588a3e1f3..f4da714e038 100644 --- a/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm +++ b/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm @@ -47,7 +47,6 @@ air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen) air_contents.oxygen += added_oxygen - update_airs(air_contents) update_parents() return 1 diff --git a/code/ATMOSPHERICS/components/unary_devices/tank.dm b/code/ATMOSPHERICS/components/unary_devices/tank.dm index 922703853a9..a9ecac258ae 100644 --- a/code/ATMOSPHERICS/components/unary_devices/tank.dm +++ b/code/ATMOSPHERICS/components/unary_devices/tank.dm @@ -15,7 +15,6 @@ 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) - update_airs(air_contents) /obj/machinery/atmospherics/components/unary/tank/toxins icon_state = "orange" @@ -27,7 +26,6 @@ air_contents.volume = volume air_contents.temperature = T20C air_contents.toxins = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) - update_airs(air_contents) /obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b icon_state = "orange_2" @@ -41,7 +39,6 @@ var/datum/gas/oxygen_agent_b/trace_gas = new trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) air_contents.trace_gases += trace_gas - update_airs(air_contents) /obj/machinery/atmospherics/components/unary/tank/oxygen icon_state = "blue" @@ -53,7 +50,6 @@ air_contents.volume = volume air_contents.temperature = T20C air_contents.oxygen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) - update_airs(air_contents) /obj/machinery/atmospherics/components/unary/tank/nitrogen icon_state = "red" @@ -65,7 +61,6 @@ air_contents.volume = volume air_contents.temperature = T20C air_contents.nitrogen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) - update_airs(air_contents) /obj/machinery/atmospherics/components/unary/tank/air icon_state = "grey" @@ -77,5 +72,4 @@ air_contents.volume = volume air_contents.temperature = T20C air_contents.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) - air_contents.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) - update_airs(air_contents) \ No newline at end of file + air_contents.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature) \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary_devices/unary_base.dm b/code/ATMOSPHERICS/components/unary_devices/unary_base.dm index d67ab08686a..e06e0658a89 100644 --- a/code/ATMOSPHERICS/components/unary_devices/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary_devices/unary_base.dm @@ -9,12 +9,6 @@ initialize_directions = dir /* -Helpers -*/ - -/obj/machinery/atmospherics/components/unary/update_airs(var/a1) - ..(list("a1" = a1)) -/* Iconnery */ diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm index 3f8274919a5..530620bcb86 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm @@ -67,7 +67,6 @@ ..() var/datum/gas_mixture/air_contents = airs["a1"] air_contents.volume = 1000 - update_airs(air_contents) /obj/machinery/atmospherics/unary/vent_pump/update_icon_nopipes() overlays.Cut() @@ -138,7 +137,6 @@ air_contents.merge(removed) air_update_turf() - update_airs(air_contents) update_parents() return 1 diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm index 06bdd4738b6..a984cd46aa2 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm @@ -169,7 +169,6 @@ air_contents.merge(removed) air_update_turf() - update_airs(air_contents) update_parents() return 1 diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index f103978dd5c..0f8711f2fef 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -106,14 +106,12 @@ // update icon overlays only if displayed level has changed if(hot_air) - var/datum/gas_mixture/circ2_air1 = circ2.airs[1] + var/datum/gas_mixture/circ2_air1 = circ2.airs["a1"] circ2_air1.merge(hot_air) - circ2.update_airs(circ2_air1) if(cold_air) - var/datum/gas_mixture/circ1_air1 = circ1.airs[1] + var/datum/gas_mixture/circ1_air1 = circ1.airs["a1"] circ1_air1.merge(cold_air) - circ1.update_airs(circ1_air1) var/genlev = max(0, min( round(11*lastgen / 100000), 11)) var/circ = "[circ1 && circ1.last_pressure_delta > 0 ? "1" : "0"][circ2 && circ2.last_pressure_delta > 0 ? "1" : "0"]" @@ -135,10 +133,10 @@ if(!powernet) t += "Unable to connect to the power network!" else if(circ1 && circ2) - var/datum/gas_mixture/circ1_air1 = circ1.airs[1] - var/datum/gas_mixture/circ1_air2 = circ1.airs[2] - var/datum/gas_mixture/circ2_air1 = circ2.airs[1] - var/datum/gas_mixture/circ2_air2 = circ2.airs[2] + var/datum/gas_mixture/circ1_air1 = circ1.airs["a1"] + var/datum/gas_mixture/circ1_air2 = circ1.airs["a2"] + var/datum/gas_mixture/circ2_air1 = circ2.airs["a1"] + var/datum/gas_mixture/circ2_air2 = circ2.airs["a2"] t += "
"