Skip to content

Commit

Permalink
TEG suddenly starts working, the public is shocked! (#1521)
Browse files Browse the repository at this point in the history
* Fixes and updates the TEG (#81044)

Fixes thermoelectric generators so they work again
Pipes can be connected to it, the machine can be rotated
Adds the ventcrawl movement flags as a defined bitfield
I also gave it a TGUI menu, it was small so it is pretty insignificant.
I added a little bit more text to error messages to make it clearer why
the thermoelectric generator isn't functional.
I also repathed generator to thermoelectric_generator because
'generator' is a keyword and is highlighted in green which makes people
using vscode a little confused what it's meant to be.

Old

![image](https://github.com/tgstation/tgstation/assets/53777086/0fe0651b-4d48-474b-869f-2f665757a0bc)

New

https://github.com/tgstation/tgstation/assets/53777086/064a5dda-5407-4817-b090-d22eb6c4aab8

This is one of the things I had to move to TGUI in
https://hackmd.io/XLt5MoRvRxuhFbwtk4VAUA
I was originally gonna remove it, but in the spirit of feature freeze I
thought I should at least give it a try.
This fixes many issues with it and gives it a new better UI that won't
stop updating easily so you can actually watch the changes as it
happens.
The TEG may not be obtainable in-game but it can still be mapped in or
give by admins, letting it function as intended is still a massive
benefit.

Closes tgstation/tgstation#75738

🆑 JohnFulpWillard, Unit2E teaching me the TEG
fix: The TEG now works again (still unobtainable by regular means
though).
fix: the TEG and its circulators can now be rotated counterclockwise
again.
refactor: The TEG now uses a TGUI interface rather than the old HTML
one.
/🆑

---------

Co-authored-by: Ghom <[email protected]>

* monkestation specific fixes

---------

Co-authored-by: John Willard <[email protected]>
Co-authored-by: Ghom <[email protected]>
  • Loading branch information
3 people authored Apr 1, 2024
1 parent f789aba commit bd0fc92
Show file tree
Hide file tree
Showing 11 changed files with 341 additions and 293 deletions.
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/shuttlerelic.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
/turf/open/floor/oldshuttle,
/area/ruin/space/has_grav/powered)
"t" = (
/obj/machinery/power/generator,
/obj/machinery/power/thermoelectric_generator,
/turf/open/floor/oldshuttle,
/area/ruin/space/has_grav/powered)
"u" = (
Expand Down
2 changes: 1 addition & 1 deletion _maps/templates/medium_shuttle4.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/turf/open/floor/oldshuttle,
/area/ruin/powered/shuttle/medium_4)
"r" = (
/obj/machinery/power/generator,
/obj/machinery/power/thermoelectric_generator,
/turf/open/floor/oldshuttle,
/area/ruin/powered/shuttle/medium_4)
"s" = (
Expand Down
10 changes: 8 additions & 2 deletions code/__DEFINES/atmospherics/atmos_piping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@

// Ventcrawling bitflags, handled in var/vent_movement
///Allows for ventcrawling to occur. All atmospheric machines have this flag on by default. Cryo is the exception
#define VENTCRAWL_ALLOWED (1<<0)
#define VENTCRAWL_ALLOWED (1<<0)
///Allows mobs to enter or leave from atmospheric machines. On for passive, unary, and scrubber vents.
#define VENTCRAWL_ENTRANCE_ALLOWED (1<<1)
///Used to check if a machinery is visible. Called by update_pipe_vision(). On by default for all except cryo.
#define VENTCRAWL_CAN_SEE (1<<2)
#define VENTCRAWL_CAN_SEE (1<<2)

DEFINE_BITFIELD(vent_movement, list(
"Ventcrawl Allowed" = VENTCRAWL_ALLOWED,
"Ventcrawl Entrance Allowed" = VENTCRAWL_ENTRANCE_ALLOWED,
"Ventcrawl Can See" = VENTCRAWL_CAN_SEE,
))
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@
/datum/stock_part/manipulator = 1)
needs_anchored = FALSE

/obj/item/circuitboard/machine/generator
/obj/item/circuitboard/machine/thermoelectric_generator
name = "Thermo-Electric Generator"
greyscale_colors = CIRCUIT_COLOR_ENGINEERING
build_path = /obj/machinery/power/generator
build_path = /obj/machinery/power/thermoelectric_generator
req_components = list()

/obj/item/circuitboard/machine/ntnet_relay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,23 @@
name = "circulator/heat exchanger"
desc = "A gas circulator pump and heat exchanger."
icon_state = "circ-off-0"

var/active = FALSE

var/last_pressure_delta = 0
pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY

vent_movement = VENTCRAWL_CAN_SEE
density = TRUE

circuit = /obj/item/circuitboard/machine/circulator

var/active = FALSE
var/last_pressure_delta = 0
var/flipped = 0
///Which circulator mode we are on, the generator requires one of each to work.
var/mode = CIRCULATOR_HOT
var/obj/machinery/power/generator/generator
///The generator we are connected to.
var/obj/machinery/power/thermoelectric_generator/generator

/obj/machinery/atmospherics/components/binary/circulator/Initialize(mapload)
. = ..()
AddComponent(/datum/component/simple_rotation)

/obj/machinery/atmospherics/components/binary/circulator/AltClick(mob/user)
return ..() // This hotkey is BLACKLISTED since it's used by /datum/component/simple_rotation

//default cold circ for mappers
/obj/machinery/atmospherics/components/binary/circulator/cold
mode = CIRCULATOR_COLD
Expand All @@ -49,25 +45,18 @@
return null

//Calculate necessary moles to transfer using PV = nRT
if(air2.temperature>0)
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2

var/transfer_moles = (pressure_delta*air1.volume)/(air2.temperature * R_IDEAL_GAS_EQUATION)

last_pressure_delta = pressure_delta

//Actually transfer the gas
var/datum/gas_mixture/removed = air2.remove(transfer_moles)

update_parents()

return removed

else
if(air2.temperature <= 0)
last_pressure_delta = 0
return
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2
var/transfer_moles = (pressure_delta*air1.volume)/(air2.temperature * R_IDEAL_GAS_EQUATION)
last_pressure_delta = pressure_delta
//Actually transfer the gas
var/datum/gas_mixture/removed = air2.remove(transfer_moles)
update_parents()
return removed

/obj/machinery/atmospherics/components/binary/circulator/process_atmos()
..()
update_appearance()

/obj/machinery/atmospherics/components/binary/circulator/update_icon_state()
Expand All @@ -86,13 +75,13 @@

/obj/machinery/atmospherics/components/binary/circulator/wrench_act(mob/living/user, obj/item/I)
if(!panel_open)
balloon_alert(user, "open the panel!")
return
set_anchored(!anchored)
I.play_tool_sound(src)
if(generator)
disconnectFromGenerator()
to_chat(user, span_notice("You [anchored?"secure":"unsecure"] [src]."))

balloon_alert(user, "[anchored ? "secure" : "unsecure"]")

var/obj/machinery/atmospherics/node1 = nodes[1]
var/obj/machinery/atmospherics/node2 = nodes[2]
Expand Down Expand Up @@ -145,20 +134,22 @@
if(generator)
disconnectFromGenerator()
mode = !mode
to_chat(user, span_notice("You set [src] to [mode ? "cold" : "hot"] mode."))
balloon_alert(user, "set to [mode ? "cold" : "hot"]")
return TRUE

/obj/machinery/atmospherics/components/binary/circulator/screwdriver_act(mob/user, obj/item/I)
if(..())
return TRUE
if(!anchored)
balloon_alert(user, "anchor it down!")
return
toggle_panel_open()
I.play_tool_sound(src)
to_chat(user, span_notice("You [panel_open ? "open" : "close"] the panel on [src]."))
balloon_alert(user, "panel [panel_open ? "open" : "closed"]")
return TRUE

/obj/machinery/atmospherics/components/binary/circulator/crowbar_act(mob/user, obj/item/I)
default_deconstruction_crowbar(I)
return TRUE
if(default_deconstruction_crowbar(I))
return TRUE
return ..()

/obj/machinery/atmospherics/components/binary/circulator/on_deconstruction()
if(generator)
Expand All @@ -176,19 +167,3 @@
..()
pixel_x = 0
pixel_y = 0

/obj/machinery/atmospherics/components/binary/circulator/verb/circulator_flip()
set name = "Flip"
set category = "Object"
set src in oview(1)

if(!ishuman(usr))
return

if(anchored)
to_chat(usr, span_danger("[src] is anchored!"))
return

flipped = !flipped
to_chat(usr, span_notice("You flip [src]."))
update_appearance()
2 changes: 1 addition & 1 deletion code/modules/atmospherics/machinery/pipes/layermanifold.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
normalize_cardinal_directions()
find_all_connections()

/obj/machinery/atmospherics/pipe/layer_manifold/set_piping_layer()
/obj/machinery/atmospherics/pipe/layer_manifold/set_piping_layer(new_layer)
piping_layer = PIPING_LAYER_DEFAULT

/obj/machinery/atmospherics/pipe/layer_manifold/pipeline_expansion()
Expand Down
Loading

0 comments on commit bd0fc92

Please sign in to comment.