mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
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.
This commit is contained in:
@@ -9,14 +9,6 @@
|
||||
holder_type = /obj/machinery/door/airlock
|
||||
wire_count = 12
|
||||
window_y = 570
|
||||
var/datum/wire_hint/bolt_lock_hint
|
||||
var/datum/wire_hint/bolt_light_hint
|
||||
var/datum/wire_hint/power_hint
|
||||
var/datum/wire_hint/backup_power_hint
|
||||
var/datum/wire_hint/ai_control_hint
|
||||
var/datum/wire_hint/safeties_hint
|
||||
var/datum/wire_hint/speed_hint
|
||||
var/datum/wire_hint/id_scan_hint
|
||||
|
||||
var/const/AIRLOCK_WIRE_IDSCAN = 1
|
||||
var/const/AIRLOCK_WIRE_MAIN_POWER1 = 2
|
||||
@@ -31,27 +23,6 @@ var/const/AIRLOCK_WIRE_SAFETY = 512
|
||||
var/const/AIRLOCK_WIRE_SPEED = 1024
|
||||
var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
|
||||
/datum/wires/airlock/make_wire_hints()
|
||||
bolt_lock_hint = new("The door bolts have fallen!", "The door bolts look up.")
|
||||
bolt_light_hint = new("The door bolt lights are on.", "The door bolt lights are off!")
|
||||
power_hint = new("The test light is on.", "The test light is off!")
|
||||
backup_power_hint = new("The backup power light is off!", "The backup power light is on.")
|
||||
ai_control_hint = new("The 'AI control allowed' light is on.", "The 'AI control allowed' light is off.")
|
||||
safeties_hint = new("The 'Check Wiring' light is on.", "The 'Check Wiring' light is off.")
|
||||
speed_hint = new("The 'Check Timing Mechanism' light is on.", "The 'Check Timing Mechanism' light is off.")
|
||||
id_scan_hint = new("The IDScan light is on.", "The IDScan light is off.")
|
||||
|
||||
/datum/wires/airlock/Destroy()
|
||||
bolt_lock_hint = null
|
||||
bolt_light_hint = null
|
||||
power_hint = null
|
||||
backup_power_hint = null
|
||||
ai_control_hint = null
|
||||
safeties_hint = null
|
||||
speed_hint = null
|
||||
id_scan_hint = null
|
||||
return ..()
|
||||
|
||||
/datum/wires/airlock/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/door/airlock/A = holder
|
||||
if(!istype(L, /mob/living/silicon))
|
||||
@@ -67,14 +38,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
|
||||
var/haspower = A.arePowerSystemsOn() //If there's no power, then no lights will be on.
|
||||
|
||||
. += ..()
|
||||
. += bolt_lock_hint.show(A.locked)
|
||||
. += bolt_light_hint.show(A.lights && haspower)
|
||||
. += power_hint.show(haspower)
|
||||
. += backup_power_hint.show(A.backup_power_lost_until)
|
||||
. += ai_control_hint.show(A.aiControlDisabled == 0 && !A.emagged && haspower)
|
||||
. += safeties_hint.show(A.safe == 0 && haspower)
|
||||
. += speed_hint.show(A.normalspeed == 0 && haspower)
|
||||
. += id_scan_hint.show(A.aiDisabledIdScanner == 0 && haspower)
|
||||
. += show_hint(0x01, A.locked, "The door bolts have fallen!", "The door bolts look up.")
|
||||
. += show_hint(0x02, A.lights && haspower, "The door bolt lights are on.", "The door bolt lights are off!")
|
||||
. += show_hint(0x04, haspower, "The test light is on.", "The test light is off!")
|
||||
. += show_hint(0x08, A.backup_power_lost_until, "The backup power light is off!", "The backup power light is on.")
|
||||
. += show_hint(0x10, A.aiControlDisabled == 0 && !A.emagged && haspower, "The 'AI control allowed' light is on.", "The 'AI control allowed' light is off.")
|
||||
. += show_hint(0x20, A.safe == 0 && haspower, "The 'Check Wiring' light is on.", "The 'Check Wiring' light is off.")
|
||||
. += show_hint(0x40, A.normalspeed == 0 && haspower, "The 'Check Timing Mechanism' light is on.", "The 'Check Timing Mechanism' light is off.")
|
||||
. += show_hint(0x80, A.aiDisabledIdScanner == 0 && haspower, "The IDScan light is on.", "The IDScan light is off.")
|
||||
|
||||
/datum/wires/airlock/UpdateCut(var/index, var/mended)
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
/datum/wires/alarm
|
||||
holder_type = /obj/machinery/alarm
|
||||
wire_count = 5
|
||||
var/datum/wire_hint/lock_hint
|
||||
var/datum/wire_hint/power_hint
|
||||
var/datum/wire_hint/ai_control_hint
|
||||
|
||||
var/const/AALARM_WIRE_IDSCAN = 1
|
||||
var/const/AALARM_WIRE_POWER = 2
|
||||
@@ -11,18 +8,6 @@ var/const/AALARM_WIRE_SYPHON = 4
|
||||
var/const/AALARM_WIRE_AI_CONTROL = 8
|
||||
var/const/AALARM_WIRE_AALARM = 16
|
||||
|
||||
|
||||
/datum/wires/alarm/make_wire_hints()
|
||||
lock_hint = new("The Air Alarm is locked.", "The Air Alarm is unlocked.")
|
||||
power_hint = new("The Air Alarm is offline.", "The Air Alarm is working properly!")
|
||||
ai_control_hint = new("The 'AI control allowed' light is off.", "The 'AI control allowed' light is on.")
|
||||
|
||||
/datum/wires/alarm/Destroy()
|
||||
lock_hint = null
|
||||
power_hint = null
|
||||
ai_control_hint = null
|
||||
return ..()
|
||||
|
||||
/datum/wires/alarm/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
if(A.panel_open)
|
||||
@@ -32,9 +17,9 @@ var/const/AALARM_WIRE_AALARM = 16
|
||||
/datum/wires/alarm/GetInteractWindow()
|
||||
var/obj/machinery/alarm/A = holder
|
||||
. += ..()
|
||||
. += lock_hint.show(A.locked)
|
||||
. += power_hint.show(A.shorted || (A.stat & (NOPOWER|BROKEN)))
|
||||
. += ai_control_hint.show(A.aidisabled)
|
||||
. += show_hint(0x1, A.locked, "The Air Alarm is locked.", "The Air Alarm is unlocked.")
|
||||
. += show_hint(0x2, A.shorted || (A.stat & (NOPOWER|BROKEN)), "The Air Alarm is offline.", "The Air Alarm is working properly!")
|
||||
. += show_hint(0x4, A.aidisabled, "The 'AI control allowed' light is off.", "The 'AI control allowed' light is on.")
|
||||
|
||||
/datum/wires/alarm/UpdateCut(var/index, var/mended)
|
||||
var/obj/machinery/alarm/A = holder
|
||||
|
||||
@@ -1,32 +1,18 @@
|
||||
/datum/wires/apc
|
||||
holder_type = /obj/machinery/power/apc
|
||||
wire_count = 4
|
||||
var/datum/wire_hint/lock_hint
|
||||
var/datum/wire_hint/power_hint
|
||||
var/datum/wire_hint/ai_control_hint
|
||||
|
||||
#define APC_WIRE_IDSCAN 1
|
||||
#define APC_WIRE_MAIN_POWER1 2
|
||||
#define APC_WIRE_MAIN_POWER2 4
|
||||
#define APC_WIRE_AI_CONTROL 8
|
||||
|
||||
/datum/wires/apc/make_wire_hints()
|
||||
lock_hint = new("The APC is locked.", "The APC is unlocked.")
|
||||
power_hint = new("The APCs power has been shorted.", "The APC is working properly!")
|
||||
ai_control_hint = new("The 'AI control allowed' light is off.", "The 'AI control allowed' light is on.")
|
||||
|
||||
/datum/wires/apc/Destroy()
|
||||
lock_hint = null
|
||||
power_hint = null
|
||||
ai_control_hint = null
|
||||
return ..()
|
||||
|
||||
/datum/wires/apc/GetInteractWindow()
|
||||
var/obj/machinery/power/apc/A = holder
|
||||
. += ..()
|
||||
. += lock_hint.show(A.locked)
|
||||
. += power_hint.show(A.shorted)
|
||||
. += ai_control_hint.show(A.aidisabled)
|
||||
. += show_hint(0x1, A.locked, "The APC is locked.", "The APC is unlocked.")
|
||||
. += show_hint(0x2, A.shorted, "The APCs power has been shorted.", "The APC is working properly!")
|
||||
. += show_hint(0x4, A.aidisabled, "The 'AI control allowed' light is off.", "The 'AI control allowed' light is on.")
|
||||
|
||||
|
||||
/datum/wires/apc/CanUse(var/mob/living/L)
|
||||
|
||||
@@ -2,31 +2,17 @@
|
||||
|
||||
holder_type = /obj/machinery/autolathe
|
||||
wire_count = 6
|
||||
var/datum/wire_hint/disable_hint
|
||||
var/datum/wire_hint/shock_hint
|
||||
var/datum/wire_hint/hack_hint
|
||||
|
||||
var/const/AUTOLATHE_HACK_WIRE = 1
|
||||
var/const/AUTOLATHE_SHOCK_WIRE = 2
|
||||
var/const/AUTOLATHE_DISABLE_WIRE = 4
|
||||
|
||||
/datum/wires/autolathe/make_wire_hints()
|
||||
disable_hint = new("The red light is off.", "The red light is on.")
|
||||
shock_hint = new("The green light is off.", "The green light is on.")
|
||||
hack_hint = new("The blue light is off.", "The blue light is on.")
|
||||
|
||||
/datum/wires/autolathe/Destroy()
|
||||
disable_hint = null
|
||||
shock_hint = null
|
||||
hack_hint = null
|
||||
return ..()
|
||||
|
||||
/datum/wires/autolathe/GetInteractWindow()
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
. += ..()
|
||||
. += disable_hint.show(A.disabled)
|
||||
. += shock_hint.show(A.shocked)
|
||||
. += hack_hint.show(A.hacked)
|
||||
. += show_hint(0x1, A.disabled, "The red light is off.", "The red light is on.")
|
||||
. += show_hint(0x2, A.shocked, "The green light is off.", "The green light is on.")
|
||||
. += show_hint(0x4, A.hacked, "The blue light is off.", "The blue light is on.")
|
||||
|
||||
/datum/wires/autolathe/CanUse()
|
||||
var/obj/machinery/autolathe/A = holder
|
||||
|
||||
@@ -4,31 +4,14 @@
|
||||
random = 1
|
||||
holder_type = /obj/machinery/camera
|
||||
wire_count = 6
|
||||
var/datum/wire_hint/view_hint
|
||||
var/datum/wire_hint/power_hint
|
||||
var/datum/wire_hint/light_hint
|
||||
var/datum/wire_hint/alarm_hint
|
||||
|
||||
/datum/wires/camera/make_wire_hints()
|
||||
view_hint = new("The focus light is on.", "The focus light is off.")
|
||||
power_hint = new("The power link light is on.", "The power link light is off.")
|
||||
light_hint = new("The camera light is off.", "The camera light is on.")
|
||||
alarm_hint = new("The alarm light is on.", "The alarm light is off.")
|
||||
|
||||
/datum/wires/camera/Destroy()
|
||||
view_hint = null
|
||||
power_hint = null
|
||||
light_hint = null
|
||||
alarm_hint = null
|
||||
return ..()
|
||||
|
||||
/datum/wires/camera/GetInteractWindow()
|
||||
. = ..()
|
||||
var/obj/machinery/camera/C = holder
|
||||
. += view_hint.show(C.view_range == initial(C.view_range))
|
||||
. += power_hint.show(C.can_use())
|
||||
. += light_hint.show(C.light_disabled)
|
||||
. += alarm_hint.show(C.alarm_on)
|
||||
. += show_hint(0x1, C.view_range == initial(C.view_range), "The focus light is on.", "The focus light is off.")
|
||||
. += show_hint(0x2, C.can_use(), "The power link light is on.", "The power link light is off.")
|
||||
. += show_hint(0x4, C.light_disabled, "The camera light is off.", "The camera light is on.")
|
||||
. += show_hint(0x8, C.alarm_on, "The alarm light is on.", "The alarm light is off.")
|
||||
return .
|
||||
|
||||
/datum/wires/camera/CanUse(var/mob/living/L)
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
/datum/wires/grid_checker
|
||||
holder_type = /obj/machinery/power/grid_checker
|
||||
wire_count = 8
|
||||
var/datum/wire_hint/power_failure_hint
|
||||
var/datum/wire_hint/lock_out_hint
|
||||
var/datum/wire_hint/ready_hint
|
||||
|
||||
/datum/wires/grid_checker/make_wire_hints()
|
||||
power_failure_hint = new("The green light is off.", "The green light is on.")
|
||||
lock_out_hint = new("The red light is on.", "The red light is off.")
|
||||
ready_hint = new("The blue light is on.", "The blue light is off.")
|
||||
|
||||
/datum/wires/grid_checker/Destroy()
|
||||
power_failure_hint = null
|
||||
lock_out_hint = null
|
||||
ready_hint = null
|
||||
return ..()
|
||||
|
||||
var/const/GRID_CHECKER_WIRE_REBOOT = 1 // This wire causes the grid-check to end, if pulsed.
|
||||
var/const/GRID_CHECKER_WIRE_LOCKOUT = 2 // If cut or pulsed, locks the user out for half a minute.
|
||||
@@ -36,9 +22,9 @@ var/const/GRID_CHECKER_WIRE_NOTHING_2 = 128 // Does nothing, but makes it a bit
|
||||
/datum/wires/grid_checker/GetInteractWindow()
|
||||
var/obj/machinery/power/grid_checker/G = holder
|
||||
. += ..()
|
||||
. += power_failure_hint.show(G.power_failing)
|
||||
. += lock_out_hint.show(G.wire_locked_out)
|
||||
. += ready_hint.show(G.wire_allow_manual_1 && G.wire_allow_manual_2 && G.wire_allow_manual_3)
|
||||
. += show_hint(0x1, G.power_failing, "The green light is off.", "The green light is on.")
|
||||
. += show_hint(0x2, G.wire_locked_out, "The red light is on.", "The red light is off.")
|
||||
. += show_hint(0x4, G.wire_allow_manual_1 && G.wire_allow_manual_2 && G.wire_allow_manual_3, "The blue light is on.", "The blue light is off.")
|
||||
|
||||
|
||||
/datum/wires/grid_checker/UpdateCut(var/index, var/mended)
|
||||
|
||||
@@ -2,21 +2,6 @@
|
||||
random = 1
|
||||
holder_type = /obj/machinery/media/jukebox
|
||||
wire_count = 11
|
||||
var/datum/wire_hint/power_hint
|
||||
var/datum/wire_hint/parental_hint
|
||||
var/datum/wire_hint/reverse_hint
|
||||
|
||||
/datum/wires/jukebox/make_wire_hints()
|
||||
power_hint = new("The power light is off.", "The power light is on.")
|
||||
parental_hint = new("The parental guidance light is off.", "The parental guidance light is on.")
|
||||
reverse_hint = new("The data light is hauntingly dark.", "The data light is glowing softly.")
|
||||
|
||||
/datum/wires/jukebox/Destroy()
|
||||
power_hint = null
|
||||
parental_hint = null
|
||||
reverse_hint = null
|
||||
return ..()
|
||||
|
||||
|
||||
var/const/WIRE_POWER = 1
|
||||
var/const/WIRE_HACK = 2
|
||||
@@ -40,9 +25,9 @@ var/const/WIRE_NEXT = 1024
|
||||
/datum/wires/jukebox/GetInteractWindow()
|
||||
var/obj/machinery/media/jukebox/A = holder
|
||||
. += ..()
|
||||
. += power_hint.show(A.stat & (BROKEN|NOPOWER))
|
||||
. += parental_hint.show(A.hacked)
|
||||
. += reverse_hint.show(IsIndexCut(WIRE_REVERSE))
|
||||
. += show_hint(0x1, A.stat & (BROKEN|NOPOWER), "The power light is off.", "The power light is on.")
|
||||
. += show_hint(0x2, A.hacked, "The parental guidance light is off.", "The parental guidance light is on.")
|
||||
. += show_hint(0x4, IsIndexCut(WIRE_REVERSE), "The data light is hauntingly dark.", "The data light is glowing softly.")
|
||||
|
||||
// Give a hint as to what each wire does
|
||||
/datum/wires/jukebox/UpdatePulsed(var/index)
|
||||
|
||||
@@ -2,23 +2,6 @@
|
||||
random = 1
|
||||
holder_type = /mob/living/silicon/robot
|
||||
wire_count = 5
|
||||
var/datum/wire_hint/lawsync_hint
|
||||
var/datum/wire_hint/connected_ai_hint
|
||||
var/datum/wire_hint/camera_hint
|
||||
var/datum/wire_hint/lockdown_hint
|
||||
|
||||
/datum/wires/robot/make_wire_hints()
|
||||
lawsync_hint = new("The LawSync light is on.", "The LawSync light is off.")
|
||||
connected_ai_hint = new("The AI link light is on.", "The AI link light is off.")
|
||||
camera_hint = new("The camera light is on.", "The camera light is off.")
|
||||
lockdown_hint = new("The lockdown light is on.", "The lockdown light is off.")
|
||||
|
||||
/datum/wires/robot/Destroy()
|
||||
lawsync_hint = null
|
||||
connected_ai_hint = null
|
||||
camera_hint = null
|
||||
lockdown_hint = null
|
||||
return ..()
|
||||
|
||||
var/const/BORG_WIRE_LAWCHECK = 1
|
||||
var/const/BORG_WIRE_MAIN_POWER = 2 // The power wires do nothing whyyyyyyyyyyyyy
|
||||
@@ -29,10 +12,10 @@ var/const/BORG_WIRE_CAMERA = 16
|
||||
/datum/wires/robot/GetInteractWindow()
|
||||
. = ..()
|
||||
var/mob/living/silicon/robot/R = holder
|
||||
. += lawsync_hint.show(R.lawupdate)
|
||||
. += connected_ai_hint.show(R.connected_ai)
|
||||
. += camera_hint.show((!isnull(R.camera) && R.camera.status == 1))
|
||||
. += lockdown_hint.show(R.lockdown)
|
||||
. += show_hint(0x1, R.lawupdate, "The LawSync light is on.", "The LawSync light is off.")
|
||||
. += show_hint(0x2, R.connected_ai, "The AI link light is on.", "The AI link light is off.")
|
||||
. += show_hint(0x4, (!isnull(R.camera) && R.camera.status == 1), "The camera light is on.", "The camera light is off.")
|
||||
. += show_hint(0x8, R.lockdown, "The lockdown light is on.", "The lockdown light is off.")
|
||||
return .
|
||||
|
||||
/datum/wires/robot/UpdateCut(var/index, var/mended)
|
||||
|
||||
@@ -7,23 +7,6 @@
|
||||
holder_type = /obj/machinery/seed_storage
|
||||
wire_count = 4
|
||||
random = 1
|
||||
var/datum/wire_hint/zap_hint
|
||||
var/datum/wire_hint/smart_hint
|
||||
var/datum/wire_hint/hacked_hint
|
||||
var/datum/wire_hint/lockdown_hint
|
||||
|
||||
/datum/wires/seedstorage/make_wire_hints()
|
||||
zap_hint = new("The orange light is off.", "The orange light is on.")
|
||||
smart_hint = new("The red light is off.", "The red light is blinking.")
|
||||
hacked_hint = new("The green light is on.", "The green light is off.")
|
||||
lockdown_hint = new("The keypad lock is deployed.", "The keypad lock is retracted.")
|
||||
|
||||
/datum/wires/seedstorage/Destroy()
|
||||
zap_hint = null
|
||||
smart_hint = null
|
||||
hacked_hint = null
|
||||
lockdown_hint = null
|
||||
return ..()
|
||||
|
||||
/datum/wires/seedstorage/CanUse(var/mob/living/L)
|
||||
var/obj/machinery/seed_storage/V = holder
|
||||
@@ -34,10 +17,10 @@
|
||||
/datum/wires/seedstorage/GetInteractWindow()
|
||||
var/obj/machinery/seed_storage/V = holder
|
||||
. += ..()
|
||||
. += zap_hint.show(V.seconds_electrified)
|
||||
. += smart_hint.show(V.smart)
|
||||
. += hacked_hint.show(V.hacked || V.emagged)
|
||||
. += lockdown_hint.show(V.lockdown)
|
||||
. += show_hint(0x1, V.seconds_electrified, "The orange light is off.", "The orange light is on.")
|
||||
. += show_hint(0x2, V.smart, "The red light is off.", "The red light is blinking.")
|
||||
. += show_hint(0x4, V.hacked || V.emagged, "The green light is on.", "The green light is off.")
|
||||
. += show_hint(0x8, V.lockdown, "The keypad lock is deployed.", "The keypad lock is retracted.")
|
||||
|
||||
/datum/wires/seedstorage/UpdatePulsed(var/index)
|
||||
var/obj/machinery/seed_storage/V = holder
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
/datum/wires/smartfridge
|
||||
holder_type = /obj/machinery/smartfridge
|
||||
wire_count = 3
|
||||
var/datum/wire_hint/zap_hint
|
||||
var/datum/wire_hint/shoot_hint
|
||||
var/datum/wire_hint/scan_id_hint
|
||||
|
||||
/datum/wires/smartfridge/make_wire_hints()
|
||||
zap_hint = new("The orange light is off.", "The orange light is on.")
|
||||
shoot_hint = new("The red light is off.", "The red light is blinking.")
|
||||
scan_id_hint = new("A purple light is on.", "A yellow light is on.")
|
||||
|
||||
/datum/wires/smartfridge/Destroy()
|
||||
zap_hint = null
|
||||
shoot_hint = null
|
||||
scan_id_hint = null
|
||||
return ..()
|
||||
|
||||
/datum/wires/smartfridge/secure
|
||||
random = 1
|
||||
@@ -33,9 +19,9 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4
|
||||
/datum/wires/smartfridge/GetInteractWindow()
|
||||
var/obj/machinery/smartfridge/S = holder
|
||||
. += ..()
|
||||
. += zap_hint.show(S.seconds_electrified)
|
||||
. += shoot_hint.show(S.shoot_inventory)
|
||||
. += scan_id_hint.show(S.scan_id)
|
||||
. += show_hint(0x1, S.seconds_electrified, "The orange light is off.", "The orange light is on.")
|
||||
. += show_hint(0x2, S.shoot_inventory, "The red light is off.", "The red light is blinking.")
|
||||
. += show_hint(0x4, S.scan_id, "A purple light is on.", "A yellow light is on.")
|
||||
|
||||
/datum/wires/smartfridge/UpdatePulsed(var/index)
|
||||
var/obj/machinery/smartfridge/S = holder
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
/datum/wires/smes
|
||||
holder_type = /obj/machinery/power/smes/buildable
|
||||
wire_count = 5
|
||||
var/datum/wire_hint/io_hint
|
||||
var/datum/wire_hint/safeties_hint
|
||||
var/datum/wire_hint/rcon_hint
|
||||
|
||||
/datum/wires/smes/make_wire_hints()
|
||||
io_hint = new("The green light is off.", "The green light is on.")
|
||||
safeties_hint = new("The red light is off.", "The red light is blinking.")
|
||||
rcon_hint = new("The blue light is on.", "The blue light is off.")
|
||||
|
||||
/datum/wires/smes/Destroy()
|
||||
io_hint = null
|
||||
safeties_hint = null
|
||||
rcon_hint = null
|
||||
return ..()
|
||||
|
||||
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
|
||||
@@ -33,9 +19,9 @@ var/const/SMES_WIRE_FAILSAFES = 16 // Cut to disable failsafes, mend to reenable
|
||||
/datum/wires/smes/GetInteractWindow()
|
||||
var/obj/machinery/power/smes/buildable/S = holder
|
||||
. += ..()
|
||||
. += io_hint.show(S.input_cut || S.input_pulsed || S.output_cut || S.output_pulsed)
|
||||
. += safeties_hint.show(S.safeties_enabled || S.grounding)
|
||||
. += rcon_hint.show(S.RCon)
|
||||
. += 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
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
/datum/wires/suit_storage_unit
|
||||
holder_type = /obj/machinery/suit_cycler
|
||||
wire_count = 3
|
||||
var/datum/wire_hint/zap_hint
|
||||
var/datum/wire_hint/safeties_hint
|
||||
var/datum/wire_hint/locked_hint
|
||||
|
||||
/datum/wires/suit_storage_unit/make_wire_hints()
|
||||
zap_hint = new("The orange light is off.", "The orange light is on.")
|
||||
safeties_hint = new("The red light is off.", "The red light is blinking.")
|
||||
locked_hint = new("The yellow light is on.", "The yellow light is off.")
|
||||
|
||||
/datum/wires/suit_storage_unit/Destroy()
|
||||
zap_hint = null
|
||||
safeties_hint = null
|
||||
locked_hint = null
|
||||
return ..()
|
||||
|
||||
var/const/SUIT_STORAGE_WIRE_ELECTRIFY = 1
|
||||
var/const/SUIT_STORAGE_WIRE_SAFETY = 2
|
||||
@@ -33,9 +19,9 @@ var/const/SUIT_STORAGE_WIRE_LOCKED = 4
|
||||
/datum/wires/suit_storage_unit/GetInteractWindow()
|
||||
var/obj/machinery/suit_cycler/S = holder
|
||||
. += ..()
|
||||
. += zap_hint.show(S.electrified)
|
||||
. += safeties_hint.show(S.safeties)
|
||||
. += locked_hint.show(S.locked)
|
||||
. += show_hint(0x1, S.electrified, "The orange light is off.", "The orange light is on.")
|
||||
. += show_hint(0x2, S.safeties, "The red light is off.", "The red light is blinking.")
|
||||
. += show_hint(0x4, S.locked, "The yellow light is on.", "The yellow light is off.")
|
||||
|
||||
/datum/wires/suit_storage_unit/UpdatePulsed(var/index)
|
||||
var/obj/machinery/suit_cycler/S = holder
|
||||
|
||||
@@ -1,23 +1,6 @@
|
||||
/datum/wires/vending
|
||||
holder_type = /obj/machinery/vending
|
||||
wire_count = 4
|
||||
var/datum/wire_hint/zap_hint
|
||||
var/datum/wire_hint/shoot_hint
|
||||
var/datum/wire_hint/hidden_hint
|
||||
var/datum/wire_hint/scan_id_hint
|
||||
|
||||
/datum/wires/vending/make_wire_hints()
|
||||
zap_hint = new("The orange light is off.", "The orange light is on.")
|
||||
shoot_hint = new("The red light is off.", "The red light is blinking.")
|
||||
hidden_hint = new("A green light is on.", "A green light is off.")
|
||||
scan_id_hint = new("A purple light is on.", "A yellow light is on.")
|
||||
|
||||
/datum/wires/vending/Destroy()
|
||||
zap_hint = null
|
||||
shoot_hint = null
|
||||
hidden_hint = null
|
||||
scan_id_hint = null
|
||||
return ..()
|
||||
|
||||
var/const/VENDING_WIRE_THROW = 1
|
||||
var/const/VENDING_WIRE_CONTRABAND = 2
|
||||
@@ -33,10 +16,10 @@ var/const/VENDING_WIRE_IDSCAN = 8
|
||||
/datum/wires/vending/GetInteractWindow()
|
||||
var/obj/machinery/vending/V = holder
|
||||
. += ..()
|
||||
. += zap_hint.show(V.seconds_electrified)
|
||||
. += shoot_hint.show(V.shoot_inventory)
|
||||
. += hidden_hint.show(V.categories & CAT_HIDDEN)
|
||||
. += scan_id_hint.show(V.scan_id)
|
||||
. += show_hint(0x1, V.seconds_electrified, "The orange light is off.", "The orange light is on.")
|
||||
. += show_hint(0x2, V.shoot_inventory, "The red light is off.", "The red light is blinking.")
|
||||
. += show_hint(0x4, V.categories & CAT_HIDDEN, "A green light is on.", "A green light is off.")
|
||||
. += show_hint(0x8, V.scan_id, "A purple light is on.", "A yellow light is on.")
|
||||
|
||||
/datum/wires/vending/UpdatePulsed(var/index)
|
||||
var/obj/machinery/vending/V = holder
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// 'Wire hints' are the pieces of text on the bottom of the window that give you clues on what you're doing.
|
||||
// E.g. a power light turning on or off.
|
||||
// They are their own object in order to allow for logic to make them go bold if they change.
|
||||
|
||||
/datum/wire_hint
|
||||
var/last_state = null // Current state of the hint. Can be TRUE, FALSE, or null if nobody has interacted yet.
|
||||
var/true_text // Text to display in the hacking window when the current state is true.
|
||||
var/false_text // Ditto, but shown when false.
|
||||
|
||||
/datum/wire_hint/New(new_true_text, new_false_text)
|
||||
true_text = new_true_text
|
||||
false_text = new_false_text
|
||||
|
||||
// Returns text based on the state being inputted.
|
||||
// If that state is different from last time, the text will be bolded.
|
||||
/datum/wire_hint/proc/show(current_state)
|
||||
var/state_changed = FALSE
|
||||
if(last_state != null)
|
||||
if(last_state != current_state)
|
||||
state_changed = TRUE
|
||||
last_state = current_state
|
||||
if(last_state)
|
||||
return state_changed ? "<br><b>[true_text]</b>" : "<br>[true_text]"
|
||||
return state_changed ? "<br><b>[false_text]</b>" : "<br>[false_text]"
|
||||
|
||||
/datum/wire_hint/proc/reset_memory()
|
||||
last_state = null
|
||||
@@ -17,6 +17,9 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown"
|
||||
var/wire_count = 0 // Max is 16
|
||||
var/wires_status = 0 // BITFLAG OF WIRES
|
||||
|
||||
var/hint_states = 0 // BITFLAG OF HINT STATES (For tracking if they changed for bolding in UI)
|
||||
var/hint_states_initialized = FALSE // False until first time window is rendered.
|
||||
|
||||
var/list/wires = list()
|
||||
var/list/signallers = list()
|
||||
|
||||
@@ -26,6 +29,19 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown"
|
||||
var/window_x = 370
|
||||
var/window_y = 470
|
||||
|
||||
// Note: Its assumed states are boolean. If you ever have a multi-state hint, you must implement that yourself.
|
||||
/datum/wires/proc/show_hint(flag, current_state, true_text, false_text)
|
||||
var/state_changed = FALSE
|
||||
if(hint_states_initialized)
|
||||
if(!(hint_states & flag) != !current_state) // NOT-ing to convert to boolean
|
||||
state_changed = TRUE
|
||||
if(current_state)
|
||||
hint_states |= flag
|
||||
return state_changed ? "<br><b>[true_text]</b>" : "<br>[true_text]"
|
||||
else
|
||||
hint_states &= ~flag
|
||||
return state_changed ? "<br><b>[false_text]</b>" : "<br>[false_text]"
|
||||
|
||||
/datum/wires/New(var/atom/holder)
|
||||
..()
|
||||
src.holder = holder
|
||||
@@ -45,7 +61,6 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown"
|
||||
else
|
||||
var/list/wires = same_wires[holder_type]
|
||||
src.wires = wires // Reference the wires list.
|
||||
make_wire_hints()
|
||||
|
||||
/datum/wires/Destroy()
|
||||
holder = null
|
||||
@@ -76,6 +91,7 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown"
|
||||
var/html = null
|
||||
if(holder && CanUse(user))
|
||||
html = GetInteractWindow()
|
||||
hint_states_initialized = TRUE
|
||||
if(html)
|
||||
user.set_machine(holder)
|
||||
else
|
||||
@@ -109,10 +125,6 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown"
|
||||
|
||||
return html
|
||||
|
||||
// Override to spawn the wire hints here, to avoid touching New().
|
||||
/datum/wires/proc/make_wire_hints()
|
||||
return
|
||||
|
||||
/datum/wires/Topic(href, href_list)
|
||||
..()
|
||||
if(in_range(holder, usr) && isliving(usr))
|
||||
|
||||
@@ -453,7 +453,6 @@
|
||||
#include "code\datums\wires\suit_storage_unit.dm"
|
||||
#include "code\datums\wires\tesla_coil.dm"
|
||||
#include "code\datums\wires\vending.dm"
|
||||
#include "code\datums\wires\wire_hint.dm"
|
||||
#include "code\datums\wires\wires.dm"
|
||||
#include "code\defines\gases.dm"
|
||||
#include "code\defines\obj.dm"
|
||||
|
||||
Reference in New Issue
Block a user