Files
Bubberstation/code/modules/power/terminal.dm
san7890 c403a6eccc Wraps lowertext() to ensure proper stringification. (#82442)
## About The Pull Request

Fixes #82440

This PR just creates a new macro, `LOWER_TEXT()` (yes the irony is not
lost on me) to wrap around all calls of `lowertext()` and ensure that
whatever we input into that proc will be stringified using the `"[]"`
(or `tostring()` for the nerds) operator. very simple.

I also added a linter to enforce this (and prevent all forms of
regression) because I think that machines should do the menial work and
we shouldn't expect maintainers to remember this, let me know if you
disagree. if there is a time when it should be opted out for some
reason, the linter does respect it if you wrap your input with the
`UNLINT()` function.
2024-04-10 12:19:43 -07:00

79 lines
2.3 KiB
Plaintext

// the underfloor wiring terminal for the APC
// autogenerated when an APC is placed
// all conduit connects go to this object instead of the APC
// using this solves the problem of having the APC in a wall yet also inside an area
/obj/machinery/power/terminal
name = "terminal"
icon = 'icons/obj/pipes_n_cables/structures.dmi'
icon_state = "term"
desc = "It's an underfloor wiring terminal, used to draw power from the grid."
layer = WIRE_TERMINAL_LAYER //a bit above wires
var/obj/machinery/power/master = null
/obj/machinery/power/terminal/Initialize(mapload)
. = ..()
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE, use_alpha = TRUE)
/obj/machinery/power/terminal/Destroy()
if(master)
master.disconnect_terminal()
master = null
return ..()
/obj/machinery/power/terminal/examine(mob/user)
. = ..()
if(!QDELETED(powernet))
. += span_notice("It's operating on the [LOWER_TEXT(GLOB.cable_layer_to_name["[cable_layer]"])].")
else
. += span_warning("It's disconnected from the [LOWER_TEXT(GLOB.cable_layer_to_name["[cable_layer]"])].")
/obj/machinery/power/terminal/should_have_node()
return TRUE
/obj/machinery/power/proc/can_terminal_dismantle()
. = FALSE
/obj/machinery/power/apc/can_terminal_dismantle()
. = FALSE
if(opened)
. = TRUE
/obj/machinery/power/smes/can_terminal_dismantle()
. = FALSE
if(panel_open)
. = TRUE
/obj/machinery/power/terminal/proc/dismantle(mob/living/user, obj/item/I)
if(isturf(loc))
var/turf/T = loc
if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE)
balloon_alert(user, "must expose the cable terminal!")
return
if(master && !master.can_terminal_dismantle())
return
user.visible_message(span_notice("[user.name] dismantles the cable terminal from [master]."))
balloon_alert(user, "cutting the cables...")
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE)
if(I.use_tool(src, user, 50))
if(master && !master.can_terminal_dismantle())
return
if(prob(50) && electrocute_mob(user, powernet, src, 1, TRUE))
do_sparks(5, TRUE, master)
return
var/obj/item/stack/cable_coil/cable = new (drop_location(), 10)
qdel(src)
cable.balloon_alert(user, "cable terminal dismantled")
/obj/machinery/power/terminal/wirecutter_act(mob/living/user, obj/item/I)
..()
dismantle(user, I)
return TRUE