Files
Aurora.3/code/datums/wires/smes.dm
Batrachophreno 4ecb0bc21c Repath obj/machinery to obj/structure/machinery [MDB Ignore] (#22500)
Repaths obj/machinery to obj/structure/machinery. **Note for
reviewers:** the only meaningful changed code exists within
**code/game/objects/structures.dm** and
**code/game/objects/structures/_machinery.dm**, largely concerning
damage procs. With the exception of moving airlock defines to their own
file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES.

Objects, _categorically_, are largely divided between those you can hold
in your hand/inventory and those you can't. Machinery objects are
already subtypes of Structures behaviorally, this PR just makes their
pathing reflect that, and allows for future work (tool actions, more
health/destruction functionality) to be developed without unnecessary
code duplication.

I have tested this PR by loading up the Horizon and dismantling various
machines and structures with tools, shooting guns of various types
throughout the ship, and detonating a bunch of explosions throughout the
ship.
2026-05-26 19:35:48 +00:00

69 lines
1.8 KiB
Plaintext

/datum/wires/smes
proper_name = "SMES"
holder_type = /obj/structure/machinery/power/smes/buildable
/datum/wires/smes/New()
wires = list(
WIRE_RCON,
WIRE_INPUT,
WIRE_OUTPUT,
WIRE_GROUNDING,
WIRE_FAILSAFES
)
add_duds(1)
..()
/datum/wires/smes/interactable(mob/user)
if(!..())
return FALSE
var/obj/structure/machinery/power/smes/buildable/S = holder
if(S.open_hatch)
return TRUE
return FALSE
/datum/wires/smes/get_status()
var/obj/structure/machinery/power/smes/buildable/S = holder
. += ..()
. += "The green light is [(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed) ? "off" : "on"]."
. += "The red light is [(S.safeties_enabled && S.grounding) ? "off" : "blinking"]."
. += "The blue light is [S.RCon ? "on" : "off"]."
/datum/wires/smes/on_cut(wire, mend, source)
var/obj/structure/machinery/power/smes/buildable/S = holder
switch(wire)
if(WIRE_RCON)
S.RCon = mend
if(WIRE_INPUT)
S.input_cut = !mend
if(WIRE_OUTPUT)
S.output_cut = !mend
if(WIRE_GROUNDING)
S.grounding = mend
if(WIRE_FAILSAFES)
S.safeties_enabled = mend
/datum/wires/smes/on_pulse(wire)
var/obj/structure/machinery/power/smes/buildable/S = holder
switch(wire)
if(WIRE_RCON)
if(S.RCon)
S.RCon = 0
addtimer(CALLBACK(S, TYPE_PROC_REF(/obj/structure/machinery/power/smes/buildable, reset_rcon)), 10)
if(WIRE_INPUT)
S.toggle_input()
if(WIRE_OUTPUT)
S.toggle_output()
if(WIRE_GROUNDING)
S.grounding = 0
if(WIRE_FAILSAFES)
if(S.safeties_enabled)
S.safeties_enabled = 0
addtimer(CALLBACK(S, TYPE_PROC_REF(/obj/structure/machinery/power/smes/buildable, reset_safeties)), 10)
/obj/structure/machinery/power/smes/buildable/proc/reset_safeties()
safeties_enabled = TRUE
/obj/structure/machinery/power/smes/buildable/proc/reset_rcon()
RCon = TRUE