diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm
index e7615d741b3..bc126e5ce83 100644
--- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm
+++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm
@@ -12,11 +12,28 @@
var/global/const/CIRC_RIGHT = 2
var/last_pressure_delta = 0
+
+ var/obj/machinery/power/generator/generator
anchored = 1
density = 1
can_unwrench = 1
+
+// Creating a custom circulator pipe subtype to be delivered through cargo
+/obj/item/pipe/circulator
+ name = "circulator/heat exchanger fitting"
+
+/obj/item/pipe/circulator/New(loc)
+ var/obj/machinery/atmospherics/binary/circulator/C = new /obj/machinery/atmospherics/binary/circulator(null)
+ ..(loc, make_from = C)
+
+/obj/machinery/atmospherics/binary/circulator/Destroy()
+ if(generator && generator.cold_circ == src)
+ generator.cold_circ = null
+ else if(generator && generator.hot_circ == src)
+ generator.hot_circ = null
+ return ..()
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
var/output_starting_pressure = air1.return_pressure()
diff --git a/code/datums/supplypacks.dm b/code/datums/supplypacks.dm
index 5ccb0bb932b..3424a6b93d7 100644
--- a/code/datums/supplypacks.dm
+++ b/code/datums/supplypacks.dm
@@ -581,7 +581,7 @@ var/list/all_supply_groups = list(supply_emergency,supply_security,supply_engine
/obj/item/clothing/head/helmet/space,
/obj/item/clothing/head/helmet/space,
/obj/item/clothing/mask/breath,
- /obj/item/clothing/mask/breath,)
+ /obj/item/clothing/mask/breath)
cost = 30
containertype = /obj/structure/closet/crate/secure
containername = "space suit crate"
@@ -606,8 +606,9 @@ var/list/all_supply_groups = list(supply_emergency,supply_security,supply_engine
/datum/supply_packs/engineering/engine/teg
name = "Thermo-Electric Generator Crate"
contains = list(
- /obj/machinery/power/generator
- )
+ /obj/machinery/power/generator,
+ /obj/item/pipe/circulator,
+ /obj/item/pipe/circulator)
cost = 25
containertype = /obj/structure/closet/crate/secure
containername = "thermo-electric generator crate"
diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm
index 3801a71aaea..34f41e2a1b5 100644
--- a/code/game/machinery/pipe/pipe_dispenser.dm
+++ b/code/game/machinery/pipe/pipe_dispenser.dm
@@ -48,7 +48,6 @@
Air Injector
Dual-Port Vent Pump
Passive Vent
-Circulator/Heat Exchanger
Heat exchange:
Pipe
Bent Pipe
diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm
index a8fdf206c72..94499a9da7e 100644
--- a/code/modules/power/generator.dm
+++ b/code/modules/power/generator.dm
@@ -15,6 +15,20 @@
var/lastgen = 0
var/lastgenlev = -1
var/lastcirc = "00"
+
+/obj/machinery/power/generator/New()
+ ..()
+ update_desc()
+
+/obj/machinery/power/generator/proc/update_desc()
+ desc = initial(desc) + " Its cold circulator is located on the [dir2text(cold_dir)] side, and its heat circulator is located on the [dir2text(hot_dir)] side."
+
+/obj/machinery/power/generator/Destroy()
+ if(cold_circ)
+ cold_circ.generator = null
+ if(hot_circ)
+ hot_circ.generator = null
+ return ..()
/obj/machinery/power/generator/initialize()
var/obj/machinery/atmospherics/binary/circulator/circpath = /obj/machinery/atmospherics/binary/circulator
@@ -28,6 +42,7 @@
cold_circ.side = circpath.CIRC_RIGHT
if(WEST)
cold_circ.side = circpath.CIRC_LEFT
+ cold_circ.generator = src
cold_circ.update_icon()
if(hot_circ)
@@ -36,10 +51,17 @@
hot_circ.side = circpath.CIRC_RIGHT
if(WEST)
hot_circ.side = circpath.CIRC_LEFT
+ hot_circ.generator = src
hot_circ.update_icon()
+ power_change()
update_icon()
- power_change()
+
+/obj/machinery/power/generator/power_change()
+ if(!anchored)
+ stat |= NOPOWER
+ else
+ ..()
/obj/machinery/power/generator/update_icon()
if(stat & (NOPOWER|BROKEN))
@@ -53,6 +75,9 @@
overlays += image('icons/obj/power.dmi', "teg-oc[lastcirc]")
/obj/machinery/power/generator/process()
+ if(stat & (NOPOWER|BROKEN))
+ return
+
if(!cold_circ || !hot_circ)
return
@@ -134,6 +159,15 @@
initialize()
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
to_chat(user, "You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.")
+ else if(istype(W, /obj/item/device/multitool))
+ if(cold_dir == WEST)
+ cold_dir = EAST
+ hot_dir = WEST
+ else
+ cold_dir = WEST
+ hot_dir = EAST
+ to_chat(user, "You reverse the generator's circulator settings. The cold circulator is now on the [dir2text(cold_dir)] side, and the heat circulator is now on the [dir2text(hot_dir)] side.")
+ update_desc()
else
..()
@@ -165,7 +199,7 @@
else
t += "Unable to locate all parts!"
if(include_link)
- t += "
Close"
+ t += "
Close"
return t
@@ -180,7 +214,7 @@
/obj/machinery/power/generator/Topic(href, href_list)
if(..())
- return
+ return 1
if( href_list["close"] )
usr << browse(null, "window=teg")
usr.unset_machine()