From 07bb3775e6fe7935de7527cb1ebf5ee4e0e4b768 Mon Sep 17 00:00:00 2001 From: duncathan Date: Sat, 23 Jan 2016 12:25:42 -0600 Subject: [PATCH] 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