Files
CHOMPStation2/code/datums/wires/shield_generator.dm
Leshana e2bd546f61 Ports advanced shield generators from Baystation
- Creates new advanced shield generators, designed to replace old hull and bubble shield generators.
- Upgrades the floor mounted and handheld shield diffusers.
- Makes underfloor shield diffusers actually constructable.
- Handheld diffusers orderable via uplink.
- Removes supply packs and research datums  for the old generators, but leaves their code in place for maps that still use them.
- Integrates with the meteor and electrical storm events.
- Integrates with mob AI (they know how to attack it)
2020-04-03 00:56:15 -04:00

46 lines
1.9 KiB
Plaintext

/datum/wires/shield_generator
holder_type = /obj/machinery/power/shield_generator
wire_count = 5
var/const/SHIELDGEN_WIRE_POWER = 1 // Cut to disable power input into the generator. Pulse does nothing. Mend to restore.
var/const/SHIELDGEN_WIRE_HACK = 2 // Pulse to hack the generator, enabling hacked modes. Cut to unhack. Mend does nothing.
var/const/SHIELDGEN_WIRE_CONTROL = 4 // Cut to lock most shield controls. Mend to unlock them. Pulse does nothing.
var/const/SHIELDGEN_WIRE_AICONTROL = 8 // Cut to disable AI control. Mend to restore.
var/const/SHIELDGEN_WIRE_NOTHING = 16 // A blank wire that doesn't have any specific function
/datum/wires/shield_generator/CanUse(var/mob/living/L)
var/obj/machinery/power/shield_generator/S = holder
if(S.panel_open)
return 1
return 0
/datum/wires/shield_generator/GetInteractWindow()
var/obj/machinery/power/shield_generator/S = holder
. += ..()
. += show_hint(0x1, S.mode_changes_locked, "The orange light is on.", "The orange light is off.")
. += show_hint(0x2, S.ai_control_disabled, "The blue light is off.", "The blue light is blinking.")
. += show_hint(0x4, S.hacked, "The violet light is pulsing.", "The violet light is steady.")
. += show_hint(0x8, S.input_cut, "The red light is off.", "The red light is on.")
/datum/wires/shield_generator/UpdateCut(index, mended)
var/obj/machinery/power/shield_generator/S = holder
switch(index)
if(SHIELDGEN_WIRE_POWER)
S.input_cut = !mended
if(SHIELDGEN_WIRE_HACK)
if(!mended)
S.hacked = 0
if(S.check_flag(MODEFLAG_BYPASS))
S.toggle_flag(MODEFLAG_BYPASS)
if(S.check_flag(MODEFLAG_OVERCHARGE))
S.toggle_flag(MODEFLAG_OVERCHARGE)
if(SHIELDGEN_WIRE_CONTROL)
S.mode_changes_locked = !mended
if(SHIELDGEN_WIRE_AICONTROL)
S.ai_control_disabled = !mended
/datum/wires/shield_generator/UpdatePulsed(var/index)
var/obj/machinery/power/shield_generator/S = holder
switch(index)
if(SHIELDGEN_WIRE_HACK)
S.hacked = 1