Files
CHOMPStation2/code/datums/wires/smes.dm
Leshana 4c7ad1c24e Optimize wire hacking QoL (#6835)
Keeps the same "bold if changed" functionality added in recent QoL improvements, but replaces the one-datum-instance per hint per device with a two number vars per device.
2020-03-16 05:27:57 -04:00

59 lines
1.9 KiB
Plaintext

/datum/wires/smes
holder_type = /obj/machinery/power/smes/buildable
wire_count = 5
var/const/SMES_WIRE_RCON = 1 // Remote control (AI and consoles), cut to disable
var/const/SMES_WIRE_INPUT = 2 // Input wire, cut to disable input, pulse to disable for 60s
var/const/SMES_WIRE_OUTPUT = 4 // Output wire, cut to disable output, pulse to disable for 60s
var/const/SMES_WIRE_GROUNDING = 8 // Cut to quickly discharge causing sparks, pulse to only create few sparks
var/const/SMES_WIRE_FAILSAFES = 16 // Cut to disable failsafes, mend to reenable
/datum/wires/smes/CanUse(var/mob/living/L)
var/obj/machinery/power/smes/buildable/S = holder
if(S.open_hatch)
return 1
return 0
/datum/wires/smes/GetInteractWindow()
var/obj/machinery/power/smes/buildable/S = holder
. += ..()
. += show_hint(0x1, S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed, "The green light is off.", "The green light is on.")
. += show_hint(0x2, S.safeties_enabled || S.grounding, "The red light is off.", "The red light is blinking.")
. += show_hint(0x4, S.RCon, "The blue light is on.", "The blue light is off.")
/datum/wires/smes/UpdateCut(var/index, var/mended)
var/obj/machinery/power/smes/buildable/S = holder
switch(index)
if(SMES_WIRE_RCON)
S.RCon = mended
if(SMES_WIRE_INPUT)
S.input_cut = !mended
if(SMES_WIRE_OUTPUT)
S.output_cut = !mended
if(SMES_WIRE_GROUNDING)
S.grounding = mended
if(SMES_WIRE_FAILSAFES)
S.safeties_enabled = mended
/datum/wires/smes/UpdatePulsed(var/index)
var/obj/machinery/power/smes/buildable/S = holder
switch(index)
if(SMES_WIRE_RCON)
if(S.RCon)
S.RCon = 0
spawn(10)
S.RCon = 1
if(SMES_WIRE_INPUT)
S.toggle_input()
if(SMES_WIRE_OUTPUT)
S.toggle_output()
if(SMES_WIRE_GROUNDING)
S.grounding = 0
if(SMES_WIRE_FAILSAFES)
if(S.safeties_enabled)
S.safeties_enabled = 0
spawn(10)
S.safeties_enabled = 1