diff --git a/code/modules/atmospherics/components/binary_devices/circulator.dm b/code/modules/atmospherics/components/binary_devices/circulator.dm index 9fc6963527e..5856613843b 100644 --- a/code/modules/atmospherics/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/components/binary_devices/circulator.dm @@ -21,6 +21,8 @@ var/volume_capacity_used = 0 var/stored_energy = 0 var/temperature_overlay + /// When passing its status to the main Stirling generator, this informs labeling on the TGUI. + var/is_hot_loop = FALSE density = TRUE diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index b048726473e..0bcf1381cb9 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -1,6 +1,6 @@ /obj/machinery/power/generator - name = "thermoelectric generator" - desc = "It's a high efficiency thermoelectric generator." + name = "\improper Stirling engine" + desc = "It's a high efficiency Stirling engine. This model produces electricity from the temperature and differential between two gas loops." icon_state = "teg-unassembled" density = TRUE anchored = FALSE @@ -44,11 +44,13 @@ circ2 = null return ..() -//generators connect in dir and reverse_dir(dir) directions -//mnemonic to determine circulator/generator directions: the cirulators orbit clockwise around the generator -//so a circulator to the NORTH of the generator connects first to the EAST, then to the WEST -//and a circulator to the WEST of the generator connects first to the NORTH, then to the SOUTH -//note that the circulator's outlet dir is it's always facing dir, and it's inlet is always the reverse +/** + * Circulators connect in dir and reverse_dir(dir) directions + * A mnemonic to determine circulator/generator directions: the cirulators orbit clockwise around the generator. + * So a circulator to the NORTH of the generator connects first to the EAST, then to the WEST, + * and a circulator to the WEST of the generator connects first to the NORTH, then to the SOUTH. + * Note that the circulator's outlet dir is it's always facing dir, and it's inlet is always the reverse + */ /obj/machinery/power/generator/proc/reconnect() if(circ1) circ1.temperature_overlay = null @@ -78,11 +80,11 @@ /obj/machinery/power/generator/update_icon() icon_state = anchored ? "teg-assembled" : "teg-unassembled" ClearOverlays() - if (circ1) + if(circ1) circ1.temperature_overlay = null - if (circ2) + if(circ2) circ2.temperature_overlay = null - if (stat & (NOPOWER|BROKEN)) + if(stat & (NOPOWER|BROKEN)) return TRUE else if (lastgenlev != 0) @@ -91,10 +93,14 @@ var/extreme = (lastgenlev > 9) ? "ex" : "" if (circ1.last_temperature < circ2.last_temperature) circ1.temperature_overlay = "circ-[extreme]cold" + circ1.is_hot_loop = FALSE circ2.temperature_overlay = "circ-[extreme]hot" + circ2.is_hot_loop = TRUE else circ1.temperature_overlay = "circ-[extreme]hot" + circ1.is_hot_loop = TRUE circ2.temperature_overlay = "circ-[extreme]cold" + circ2.is_hot_loop = FALSE return TRUE /obj/machinery/power/generator/process() @@ -102,8 +108,6 @@ stored_energy = 0 return - updateDialog() - var/datum/gas_mixture/air1 = circ1.return_transfer_air() var/datum/gas_mixture/air2 = circ2.return_transfer_air() @@ -174,6 +178,7 @@ if(attacking_item.tool_behaviour == TOOL_WRENCH) attacking_item.play_tool_sound(get_turf(src), 75) anchored = !anchored + balloon_alert(user, "[anchored ? "secure" : "unsecure"]") user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the bolts holding [src.name] to the floor.", \ "You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.", \ "You hear a ratchet") @@ -193,20 +198,27 @@ reconnect() ui_interact(user) -/obj/machinery/power/generator/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) - // this is the data which will be sent to the ui - var/vertical = 0 - if (dir == NORTH || dir == SOUTH) - vertical = 1 +/obj/machinery/power/generator/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + // Interface ID should match your tgui route registration/name. + ui = new(user, src, "StirlingEngine", "Stirling Engine") + ui.open() - var/data[0] - data["totalOutput"] = effective_gen/1000 - data["maxTotalOutput"] = max_power/1000 - data["thermalOutput"] = last_thermal_gen/1000 - data["circConnected"] = 0 +/obj/machinery/power/generator/ui_data(mob/user) + var/list/data = list() + + var/vertical = FALSE + if(dir == NORTH || dir == SOUTH) + vertical = TRUE + + data["totalOutput"] = effective_gen / 1000 + data["maxTotalOutput"] = max_power / 1000 + data["thermalOutput"] = last_thermal_gen / 1000 + data["circConnected"] = FALSE if(circ1) - //The one on the left (or top) + // The one on the left (or top) data["primaryDir"] = vertical ? "top" : "left" data["primaryOutput"] = last_circ1_gen/1000 data["primaryFlowCapacity"] = circ1.volume_capacity_used*100 @@ -214,9 +226,10 @@ data["primaryInletTemperature"] = circ1.air1.temperature data["primaryOutletPressure"] = XGM_PRESSURE(circ1.air2) data["primaryOutletTemperature"] = circ1.air2.temperature + data["primaryIsHot"] = circ1.is_hot_loop if(circ2) - //Now for the one on the right (or bottom) + // The one on the right (or bottom) data["secondaryDir"] = vertical ? "bottom" : "right" data["secondaryOutput"] = last_circ2_gen/1000 data["secondaryFlowCapacity"] = circ2.volume_capacity_used*100 @@ -224,25 +237,11 @@ data["secondaryInletTemperature"] = circ2.air1.temperature data["secondaryOutletPressure"] = XGM_PRESSURE(circ2.air2) data["secondaryOutletTemperature"] = circ2.air2.temperature + data["secondaryIsHot"] = circ2.is_hot_loop - if(circ1 && circ2) - data["circConnected"] = 1 - else - data["circConnected"] = 0 + data["circConnected"] = (circ1 && circ2) ? TRUE : FALSE - - // update the ui if it exists, returns null if no ui is passed/found - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) - if(!ui) - // the ui does not exist, so we'll create a new() one - // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm - ui = new(user, src, ui_key, "generator.tmpl", "Thermoelectric Generator", 450, 500) - // when the ui is first opened this is the data it will use - ui.set_initial_data(data) - // open the new ui window - ui.open() - // auto update every Master Controller tick - ui.set_auto_update(1) + return data /obj/machinery/power/generator/power_change() ..() diff --git a/html/changelogs/Bat-Teg.yml b/html/changelogs/Bat-Teg.yml new file mode 100644 index 00000000000..27b9e0f889f --- /dev/null +++ b/html/changelogs/Bat-Teg.yml @@ -0,0 +1,14 @@ +# Your name. +author: Batrachophrenoboocosmomachia + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - spellcheck: "Renames TEGs to Stirling engines to more accurately reflect their functionality." + - refactor: "Refactor of interface for TEG/Stirling Engines to use TGUI instead of NanoUI." diff --git a/nano/templates/jukebox.tmpl b/nano/templates/jukebox.tmpl deleted file mode 100644 index f7fac89ff9f..00000000000 --- a/nano/templates/jukebox.tmpl +++ /dev/null @@ -1,19 +0,0 @@ - - -