From 07bb3775e6fe7935de7527cb1ebf5ee4e0e4b768 Mon Sep 17 00:00:00 2001 From: duncathan Date: Sat, 23 Jan 2016 12:25:42 -0600 Subject: [PATCH 1/3] adds mapping freedom to the TEG --- .../components/binary_devices/circulator.dm | 5 +- code/modules/power/generator.dm | 66 +++++++++---------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm index 1d76aa2bfbe..243d8a8d150 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -7,7 +7,7 @@ desc = "A gas circulator pump and heat exchanger." icon_state = "circ1-off" - var/side = 1 // 1=left 2=right + var/side = CIRC_COLD // 1=left 2=right var/status = 0 var/last_pressure_delta = 0 @@ -15,6 +15,9 @@ anchored = 1 density = 1 + var/global/const/CIRC_COLD = 1 + var/global/const/CIRC_HOT = 2 + /obj/machinery/atmospherics/components/binary/circulator/proc/return_transfer_air() diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 60ef879bdf4..be9430fb10b 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -15,8 +15,11 @@ density = 1 use_power = 0 - var/obj/machinery/atmospherics/components/binary/circulator/circ1 - var/obj/machinery/atmospherics/components/binary/circulator/circ2 + var/obj/machinery/atmospherics/components/binary/circulator/cold_circ + var/obj/machinery/atmospherics/components/binary/circulator/hot_circ + + var/cold_dir = WEST + var/hot_dir = EAST var/lastgen = 0 var/lastgenlev = -1 @@ -24,22 +27,19 @@ /obj/machinery/power/generator/initialize() - - circ1 = null - circ2 = null - - circ1 = locate(/obj/machinery/atmospherics/components/binary/circulator) in get_step(src,WEST) - circ2 = locate(/obj/machinery/atmospherics/components/binary/circulator) in get_step(src,EAST) + var/obj/machinery/atmospherics/components/binary/circulator/circpath = /obj/machinery/atmospherics/components/binary/circulator + cold_circ = locate(circpath) in get_step(src, cold_dir) + hot_circ = locate(circpath) in get_step(src, hot_dir) connect_to_network() - if(circ1) - circ1.side = 1 - circ1.update_icon() - if(circ2) - circ2.side = 2 - circ2.update_icon() + if(cold_circ) + cold_circ.side = circpath.CIRC_COLD + cold_circ.update_icon() + if(hot_circ) + hot_circ.side = circpath.CIRC_HOT + hot_circ.update_icon() - if(!circ1 || !circ2) + if(!cold_circ || !hot_circ) stat |= BROKEN update_icon() @@ -62,16 +62,16 @@ /obj/machinery/power/generator/process() - if(!circ1 || !circ2) + if(!cold_circ || !hot_circ) return lastgen = 0 if(powernet) - //world << "circ1 and circ2 pass" + //world << "cold_circ and hot_circ pass" - var/datum/gas_mixture/cold_air = circ1.return_transfer_air() - var/datum/gas_mixture/hot_air = circ2.return_transfer_air() + var/datum/gas_mixture/cold_air = cold_circ.return_transfer_air() + var/datum/gas_mixture/hot_air = hot_circ.return_transfer_air() //world << "hot_air = [hot_air]; cold_air = [cold_air];" @@ -106,15 +106,15 @@ // update icon overlays only if displayed level has changed if(hot_air) - var/datum/gas_mixture/circ2_air1 = circ2.AIR1 - circ2_air1.merge(hot_air) + var/datum/gas_mixture/hot_circ_air1 = hot_circ.AIR1 + hot_circ_air1.merge(hot_air) if(cold_air) - var/datum/gas_mixture/circ1_air1 = circ1.AIR1 - circ1_air1.merge(cold_air) + var/datum/gas_mixture/cold_circ_air1 = cold_circ.AIR1 + cold_circ_air1.merge(cold_air) 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"]" + var/circ = "[cold_circ && cold_circ.last_pressure_delta > 0 ? "1" : "0"][hot_circ && hot_circ.last_pressure_delta > 0 ? "1" : "0"]" if((genlev != lastgenlev) || (circ != lastcirc)) lastgenlev = genlev lastcirc = circ @@ -132,11 +132,11 @@ var/t = "" if(!powernet) t += "Unable to connect to the power network!" - else if(circ1 && circ2) - var/datum/gas_mixture/circ1_air1 = circ1.AIR1 - var/datum/gas_mixture/circ1_air2 = circ1.AIR2 - var/datum/gas_mixture/circ2_air1 = circ2.AIR1 - var/datum/gas_mixture/circ2_air2 = circ2.AIR2 + else if(cold_circ && hot_circ) + var/datum/gas_mixture/cold_circ_air1 = cold_circ.AIR1 + var/datum/gas_mixture/cold_circ_air2 = cold_circ.AIR2 + var/datum/gas_mixture/hot_circ_air1 = hot_circ.AIR1 + var/datum/gas_mixture/hot_circ_air2 = hot_circ.AIR2 t += "
" @@ -145,12 +145,12 @@ t += "
" t += "Cold loop
" - t += "Temperature Inlet: [round(circ1_air2.temperature, 0.1)] K / Outlet: [round(circ1_air1.temperature, 0.1)] K
" - t += "Pressure Inlet: [round(circ1_air2.return_pressure(), 0.1)] kPa / Outlet: [round(circ1_air1.return_pressure(), 0.1)] kPa
" + t += "Temperature Inlet: [round(cold_circ_air2.temperature, 0.1)] K / Outlet: [round(cold_circ_air1.temperature, 0.1)] K
" + t += "Pressure Inlet: [round(cold_circ_air2.return_pressure(), 0.1)] kPa / Outlet: [round(cold_circ_air1.return_pressure(), 0.1)] kPa
" t += "Hot loop
" - t += "Temperature Inlet: [round(circ2_air2.temperature, 0.1)] K / Outlet: [round(circ2_air1.temperature, 0.1)] K
" - t += "Pressure Inlet: [round(circ2_air2.return_pressure(), 0.1)] kPa / Outlet: [round(circ2_air1.return_pressure(), 0.1)] kPa
" + t += "Temperature Inlet: [round(hot_circ_air2.temperature, 0.1)] K / Outlet: [round(hot_circ_air1.temperature, 0.1)] K
" + t += "Pressure Inlet: [round(hot_circ_air2.return_pressure(), 0.1)] kPa / Outlet: [round(hot_circ_air1.return_pressure(), 0.1)] kPa
" t += "
" else From 143352e5067945a50fe3d9e3e9484a11b848f23b Mon Sep 17 00:00:00 2001 From: duncathan Date: Sat, 23 Jan 2016 13:14:07 -0600 Subject: [PATCH 2/3] fucking birdboat --- _maps/map_files/BirdStation/BirdStation.dmm | 2 +- _maps/map_files/BirdStation/teg.dm | 23 ------------------- .../components/binary_devices/circulator.dm | 4 ++-- code/modules/power/generator.dm | 14 +++++++++-- 4 files changed, 15 insertions(+), 28 deletions(-) delete mode 100644 _maps/map_files/BirdStation/teg.dm diff --git a/_maps/map_files/BirdStation/BirdStation.dmm b/_maps/map_files/BirdStation/BirdStation.dmm index 02d37b80911..b57dddef635 100644 --- a/_maps/map_files/BirdStation/BirdStation.dmm +++ b/_maps/map_files/BirdStation/BirdStation.dmm @@ -367,7 +367,7 @@ "ahc" = (/obj/machinery/atmospherics/pipe/manifold/general/visible{icon_state = "manifold"; dir = 4},/turf/simulated/floor/engine,/area/engine/engineering) "ahd" = (/obj/structure/window/reinforced{dir = 4},/turf/simulated/floor/engine,/area/engine/engineering) "ahe" = (/obj/machinery/atmospherics/components/binary/circulator,/turf/simulated/floor/plasteel,/area/engine/engineering) -"ahf" = (/obj/structure/cable,/obj/machinery/power/generator/birdstation,/turf/simulated/floor/plasteel,/area/engine/engineering) +"ahf" = (/obj/structure/cable,/obj/machinery/power/generator{cold_dir = 8; hot_dir = 4},/turf/simulated/floor/plasteel,/area/engine/engineering) "ahg" = (/obj/machinery/atmospherics/components/binary/circulator{icon_state = "circ2-off"},/turf/simulated/floor/plasteel,/area/engine/engineering) "ahh" = (/obj/structure/window/reinforced{dir = 8},/turf/simulated/floor/plasteel/darkwarning{icon_state = "warndark"; dir = 10},/area/engine/engineering) "ahi" = (/obj/machinery/computer/monitor,/obj/structure/cable/cyan{icon_state = "0-4"},/turf/simulated/floor/plasteel/darkwarning,/area/engine/engineering) diff --git a/_maps/map_files/BirdStation/teg.dm b/_maps/map_files/BirdStation/teg.dm deleted file mode 100644 index bdaee7518ff..00000000000 --- a/_maps/map_files/BirdStation/teg.dm +++ /dev/null @@ -1,23 +0,0 @@ -//awful code - -/obj/machinery/power/generator/birdstation/initialize() - - circ1 = null - circ2 = null - - circ1 = locate(/obj/machinery/atmospherics/components/binary/circulator) in get_step(src,EAST) - circ2 = locate(/obj/machinery/atmospherics/components/binary/circulator) in get_step(src,WEST) - connect_to_network() - - if(circ1) - circ1.side = 2 - circ1.update_icon() - if(circ2) - circ2.side = 1 - circ2.update_icon() - - if(!circ1 || !circ2) - explosion(get_turf(src), 5, 10, 20, 40, 1) - qdel(src) - - update_icon() diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm index 243d8a8d150..9bf27767a4f 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -15,8 +15,8 @@ anchored = 1 density = 1 - var/global/const/CIRC_COLD = 1 - var/global/const/CIRC_HOT = 2 + var/global/const/CIRC_LEFT = 1 + var/global/const/CIRC_RIGHT = 2 /obj/machinery/atmospherics/components/binary/circulator/proc/return_transfer_air() diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index be9430fb10b..f45085bbb8d 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -18,6 +18,7 @@ var/obj/machinery/atmospherics/components/binary/circulator/cold_circ var/obj/machinery/atmospherics/components/binary/circulator/hot_circ + //note: these currently only support EAST and WEST var/cold_dir = WEST var/hot_dir = EAST @@ -33,10 +34,19 @@ connect_to_network() if(cold_circ) - cold_circ.side = circpath.CIRC_COLD + switch(cold_dir) + if(EAST) + cold_circ.side = circpath.CIRC_RIGHT + if(WEST) + cold_circ.side = circpath.CIRC_LEFT cold_circ.update_icon() + if(hot_circ) - hot_circ.side = circpath.CIRC_HOT + switch(hot_dir) + if(EAST) + hot_circ.side = circpath.CIRC_RIGHT + if(WEST) + hot_circ.side = circpath.CIRC_LEFT hot_circ.update_icon() if(!cold_circ || !hot_circ) From bc522e80332e0bb75eeccb9658d8d96271227998 Mon Sep 17 00:00:00 2001 From: duncathan Date: Sat, 23 Jan 2016 16:10:29 -0600 Subject: [PATCH 3/3] fixes compile --- _maps/birdstation.dm | 1 - code/ATMOSPHERICS/components/binary_devices/circulator.dm | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/_maps/birdstation.dm b/_maps/birdstation.dm index 9c3320d547f..70e6875db2f 100644 --- a/_maps/birdstation.dm +++ b/_maps/birdstation.dm @@ -24,7 +24,6 @@ A small map intended for lowpop(40 players and less). #if !defined(MAP_OVERRIDE_FILES) #define MAP_OVERRIDE_FILES #include "map_files\BirdStation\telecomms.dm" - #include "map_files\BirdStation\teg.dm" #include "map_files\BirdStation\misc.dm" #include "map_files\BirdStation\job\job_changes.dm" #include "map_files\BirdStation\job\removed_jobs.dm" diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm index 9bf27767a4f..f11d0a15381 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -7,7 +7,7 @@ desc = "A gas circulator pump and heat exchanger." icon_state = "circ1-off" - var/side = CIRC_COLD // 1=left 2=right + var/side = CIRC_LEFT var/status = 0 var/last_pressure_delta = 0