diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 85546a79d7..8b682d1f09 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -3,11 +3,20 @@ /datum/wires/airlock/secure random = 1 wire_count = 14 + window_y = 680 /datum/wires/airlock 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 @@ -22,6 +31,27 @@ 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)) @@ -37,15 +67,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 var/haspower = A.arePowerSystemsOn() //If there's no power, then no lights will be on. . += ..() - . += text("
\n[]
\n[]
\n[]
\n[]
\n[]
\n[]
\n[]
\n[]", - (A.locked ? "The door bolts have fallen!" : "The door bolts look up."), - ((A.lights && haspower) ? "The door bolt lights are on." : "The door bolt lights are off!"), - ((haspower) ? "The test light is on." : "The test light is off!"), - ((A.backup_power_lost_until) ? "The backup power light is off!" : "The backup power light is on."), - ((A.aiControlDisabled==0 && !A.emagged && haspower)? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."), - ((A.safe==0 && haspower)? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."), - ((A.normalspeed==0 && haspower)? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."), - ((A.aiDisabledIdScanner==0 && haspower)? "The IDScan light is on." : "The IDScan light is off.")) + . += 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) /datum/wires/airlock/UpdateCut(var/index, var/mended) diff --git a/code/datums/wires/alarm.dm b/code/datums/wires/alarm.dm index 7159b746c5..712e2aa7e4 100644 --- a/code/datums/wires/alarm.dm +++ b/code/datums/wires/alarm.dm @@ -1,6 +1,9 @@ /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 @@ -9,6 +12,17 @@ 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) @@ -18,7 +32,9 @@ var/const/AALARM_WIRE_AALARM = 16 /datum/wires/alarm/GetInteractWindow() var/obj/machinery/alarm/A = holder . += ..() - . += text("
\n[(A.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]
\n[((A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]
\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]") + . += lock_hint.show(A.locked) + . += power_hint.show(A.shorted || (A.stat & (NOPOWER|BROKEN))) + . += ai_control_hint.show(A.aidisabled) /datum/wires/alarm/UpdateCut(var/index, var/mended) var/obj/machinery/alarm/A = holder diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm index 5bb5831d3e..0b00297b41 100644 --- a/code/datums/wires/apc.dm +++ b/code/datums/wires/apc.dm @@ -1,16 +1,32 @@ /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 . += ..() - . += text("
\n[(A.locked ? "The APC is locked." : "The APC is unlocked.")]
\n[(A.shorted ? "The APCs power has been shorted." : "The APC is working properly!")]
\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]") + . += lock_hint.show(A.locked) + . += power_hint.show(A.shorted) + . += ai_control_hint.show(A.aidisabled) /datum/wires/apc/CanUse(var/mob/living/L) diff --git a/code/datums/wires/autolathe.dm b/code/datums/wires/autolathe.dm index 1dd4132e48..fee656cf2f 100644 --- a/code/datums/wires/autolathe.dm +++ b/code/datums/wires/autolathe.dm @@ -2,17 +2,31 @@ 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 . += ..() - . += "
The red light is [A.disabled ? "off" : "on"]." - . += "
The green light is [A.shocked ? "off" : "on"]." - . += "
The blue light is [A.hacked ? "off" : "on"].
" + . += disable_hint.show(A.disabled) + . += shock_hint.show(A.shocked) + . += hack_hint.show(A.hacked) /datum/wires/autolathe/CanUse() var/obj/machinery/autolathe/A = holder @@ -20,10 +34,10 @@ var/const/AUTOLATHE_DISABLE_WIRE = 4 return 1 return 0 -/datum/wires/autolathe/Interact(var/mob/living/user) +/datum/wires/autolathe/proc/update_autolathe_ui(mob/living/user) if(CanUse(user)) - var/obj/machinery/autolathe/V = holder - V.attack_hand(user) + var/obj/machinery/autolathe/A = holder + A.interact(user) /datum/wires/autolathe/UpdateCut(index, mended) var/obj/machinery/autolathe/A = holder @@ -34,6 +48,7 @@ var/const/AUTOLATHE_DISABLE_WIRE = 4 A.shocked = !mended if(AUTOLATHE_DISABLE_WIRE) A.disabled = !mended + update_autolathe_ui(usr) /datum/wires/autolathe/UpdatePulsed(index) if(IsIndexCut(index)) @@ -45,16 +60,16 @@ var/const/AUTOLATHE_DISABLE_WIRE = 4 spawn(50) if(A && !IsIndexCut(index)) A.hacked = 0 - Interact(usr) + update_autolathe_ui(usr) if(AUTOLATHE_SHOCK_WIRE) A.shocked = !A.shocked spawn(50) if(A && !IsIndexCut(index)) A.shocked = 0 - Interact(usr) if(AUTOLATHE_DISABLE_WIRE) A.disabled = !A.disabled spawn(50) if(A && !IsIndexCut(index)) A.disabled = 0 - Interact(usr) + update_autolathe_ui(usr) + update_autolathe_ui(usr) diff --git a/code/datums/wires/camera.dm b/code/datums/wires/camera.dm index 1724b9469c..78222346ce 100644 --- a/code/datums/wires/camera.dm +++ b/code/datums/wires/camera.dm @@ -4,15 +4,31 @@ 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 - . += "
\n[(C.view_range == initial(C.view_range) ? "The focus light is on." : "The focus light is off.")]" - . += "
\n[(C.can_use() ? "The power link light is on." : "The power link light is off.")]" - . += "
\n[(C.light_disabled ? "The camera light is off." : "The camera light is on.")]" - . += "
\n[(C.alarm_on ? "The alarm light is on." : "The alarm light is off.")]" + . += 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) return . /datum/wires/camera/CanUse(var/mob/living/L) diff --git a/code/datums/wires/grid_checker.dm b/code/datums/wires/grid_checker.dm index 1e09be577e..62c8a78fa1 100644 --- a/code/datums/wires/grid_checker.dm +++ b/code/datums/wires/grid_checker.dm @@ -1,6 +1,20 @@ /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. @@ -22,9 +36,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 . += ..() - . += "The green light is [G.power_failing ? "off" : "on"].
" - . += "The red light is [G.wire_locked_out ? "on" : "off"].
" - . += "The blue light is [G.wire_allow_manual_1 && G.wire_allow_manual_2 && G.wire_allow_manual_3 ? "on" : "off"]." + . += 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) /datum/wires/grid_checker/UpdateCut(var/index, var/mended) diff --git a/code/datums/wires/jukebox.dm b/code/datums/wires/jukebox.dm index 900c778189..92e2b97ede 100644 --- a/code/datums/wires/jukebox.dm +++ b/code/datums/wires/jukebox.dm @@ -2,6 +2,21 @@ 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 @@ -25,9 +40,9 @@ var/const/WIRE_NEXT = 1024 /datum/wires/jukebox/GetInteractWindow() var/obj/machinery/media/jukebox/A = holder . += ..() - . += "
The power light is [(A.stat & (BROKEN|NOPOWER)) ? "off" : "on"].
" - . += "The parental guidance light is [A.hacked ? "off" : "on"].
" - . += "The data light is [IsIndexCut(WIRE_REVERSE) ? "hauntingly dark" : "glowing sloftly"].
" + . += power_hint.show(A.stat & (BROKEN|NOPOWER)) + . += parental_hint.show(A.hacked) + . += reverse_hint.show(IsIndexCut(WIRE_REVERSE)) // Give a hint as to what each wire does /datum/wires/jukebox/UpdatePulsed(var/index) diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index 9d2fce9ac3..20a7960583 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -2,6 +2,23 @@ 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 @@ -10,13 +27,12 @@ var/const/BORG_WIRE_AI_CONTROL = 8 var/const/BORG_WIRE_CAMERA = 16 /datum/wires/robot/GetInteractWindow() - . = ..() var/mob/living/silicon/robot/R = holder - . += text("
\n[(R.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]") - . += text("
\n[(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")]") - . += text("
\n[((!isnull(R.camera) && R.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]") - . += text("
\n[(R.lockdown ? "The lockdown light is on." : "The lockdown light is off.")]") + . += 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) return . /datum/wires/robot/UpdateCut(var/index, var/mended) diff --git a/code/datums/wires/seedstorage.dm b/code/datums/wires/seedstorage.dm index 8268d936b0..5ea1462b76 100644 --- a/code/datums/wires/seedstorage.dm +++ b/code/datums/wires/seedstorage.dm @@ -7,6 +7,23 @@ 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 @@ -17,10 +34,10 @@ /datum/wires/seedstorage/GetInteractWindow() var/obj/machinery/seed_storage/V = holder . += ..() - . += "
The orange light is [V.seconds_electrified ? "off" : "on"].
" - . += "The red light is [V.smart ? "off" : "blinking"].
" - . += "The green light is [(V.hacked || V.emagged) ? "on" : "off"].
" - . += "The keypad lock is [V.lockdown ? "deployed" : "retracted"].
" + . += zap_hint.show(V.seconds_electrified) + . += smart_hint.show(V.smart) + . += hacked_hint.show(V.hacked || V.emagged) + . += lockdown_hint.show(V.lockdown) /datum/wires/seedstorage/UpdatePulsed(var/index) var/obj/machinery/seed_storage/V = holder diff --git a/code/datums/wires/smartfridge.dm b/code/datums/wires/smartfridge.dm index 15f10cd800..7ea943665f 100644 --- a/code/datums/wires/smartfridge.dm +++ b/code/datums/wires/smartfridge.dm @@ -1,6 +1,20 @@ /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 @@ -19,9 +33,9 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4 /datum/wires/smartfridge/GetInteractWindow() var/obj/machinery/smartfridge/S = holder . += ..() - . += "
The orange light is [S.seconds_electrified ? "off" : "on"].
" - . += "The red light is [S.shoot_inventory ? "off" : "blinking"].
" - . += "A [S.scan_id ? "purple" : "yellow"] light is on.
" + . += zap_hint.show(S.seconds_electrified) + . += shoot_hint.show(S.shoot_inventory) + . += scan_id_hint.show(S.scan_id) /datum/wires/smartfridge/UpdatePulsed(var/index) var/obj/machinery/smartfridge/S = holder diff --git a/code/datums/wires/smes.dm b/code/datums/wires/smes.dm index 17b232dd54..9b2a3ab0e0 100644 --- a/code/datums/wires/smes.dm +++ b/code/datums/wires/smes.dm @@ -1,6 +1,20 @@ /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 @@ -19,10 +33,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 . += ..() - . += "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"]" - + . += 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) /datum/wires/smes/UpdateCut(var/index, var/mended) var/obj/machinery/power/smes/buildable/S = holder diff --git a/code/datums/wires/suit_storage_unit.dm b/code/datums/wires/suit_storage_unit.dm index c2d1a130d7..2551ef3eb1 100644 --- a/code/datums/wires/suit_storage_unit.dm +++ b/code/datums/wires/suit_storage_unit.dm @@ -1,6 +1,20 @@ /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 @@ -19,9 +33,9 @@ var/const/SUIT_STORAGE_WIRE_LOCKED = 4 /datum/wires/suit_storage_unit/GetInteractWindow() var/obj/machinery/suit_cycler/S = holder . += ..() - . += "
The orange light is [S.electrified ? "off" : "on"].
" - . += "The red light is [S.safeties ? "off" : "blinking"].
" - . += "The yellow light is [S.locked ? "on" : "off"].
" + . += zap_hint.show(S.electrified) + . += safeties_hint.show(S.safeties) + . += locked_hint.show(S.locked) /datum/wires/suit_storage_unit/UpdatePulsed(var/index) var/obj/machinery/suit_cycler/S = holder diff --git a/code/datums/wires/vending.dm b/code/datums/wires/vending.dm index bad3a0078b..f15dac3fcf 100644 --- a/code/datums/wires/vending.dm +++ b/code/datums/wires/vending.dm @@ -1,6 +1,23 @@ /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 @@ -16,10 +33,10 @@ var/const/VENDING_WIRE_IDSCAN = 8 /datum/wires/vending/GetInteractWindow() var/obj/machinery/vending/V = holder . += ..() - . += "
The orange light is [V.seconds_electrified ? "off" : "on"].
" - . += "The red light is [V.shoot_inventory ? "off" : "blinking"].
" - . += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"].
" - . += "The [V.scan_id ? "purple" : "yellow"] light is on.
" + . += 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) /datum/wires/vending/UpdatePulsed(var/index) var/obj/machinery/vending/V = holder diff --git a/code/datums/wires/wire_hint.dm b/code/datums/wires/wire_hint.dm new file mode 100644 index 0000000000..a7967f45d7 --- /dev/null +++ b/code/datums/wires/wire_hint.dm @@ -0,0 +1,27 @@ +// '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 ? "
[true_text]" : "
[true_text]" + return state_changed ? "
[false_text]" : "
[false_text]" + +/datum/wire_hint/proc/reset_memory() + last_state = null \ No newline at end of file diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 54a9c79f60..2824c1b078 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -45,6 +45,7 @@ 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 @@ -108,29 +109,42 @@ 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)) var/mob/living/L = usr if(CanUse(L) && href_list["action"]) - var/obj/item/I = L.get_active_hand() holder.add_hiddenprint(L) + + var/list/items = L.get_all_held_items() + var/success = FALSE + if(href_list["cut"]) // Toggles the cut/mend status - if(I?.is_wirecutter()) - var/colour = href_list["cut"] - CutWireColour(colour) - playsound(holder, I.usesound, 20, 1) - else - to_chat(L, "You need wirecutters!") + for(var/obj/item/I in items) // Paranoid about someone somehow grabbing a non-/obj/item, lets play it safe. + if(I.is_wirecutter()) + var/colour = href_list["cut"] + CutWireColour(colour) + playsound(holder, I.usesound, 20, 1) + success = TRUE + break + if(!success) + to_chat(L, span("warning", "You need wirecutters!")) else if(href_list["pulse"]) - if(istype(I, /obj/item/device/multitool)) - var/colour = href_list["pulse"] - PulseColour(colour) - playsound(holder, 'sound/weapons/empty.ogg', 20, 1) - else - to_chat(L, "You need a multitool!") + for(var/obj/item/I in items) + if(I.is_multitool()) + var/colour = href_list["pulse"] + PulseColour(colour) + playsound(holder, 'sound/weapons/empty.ogg', 20, 1) + success = TRUE + break + if(!success) + to_chat(L, span("warning", "You need a multitool!")) else if(href_list["attach"]) var/colour = href_list["attach"] @@ -142,11 +156,12 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown" // Attach else - if(istype(I, /obj/item/device/assembly/signaler)) - L.drop_item() - Attach(colour, I) + var/obj/item/device/assembly/signaler/S = L.is_holding_item_of_type(/obj/item/device/assembly/signaler) + if(istype(S)) + L.drop_from_inventory(S) + Attach(colour, S) else - to_chat(L, "You need a remote signaller!") + to_chat(L, span("warning", "You need a remote signaller!")) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 75a23984b5..ff26049fa6 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -110,12 +110,6 @@ dat += "[R.hidden ? "*" : ""][can_make ? "" : ""][R.name][can_make ? "" : ""][R.hidden ? "*" : ""][multiplier_string.Join()][material_string.Join()]" dat += "
" - //Hacking. - if(panel_open) - dat += "

Maintenance Panel

" - dat += wires.GetInteractWindow() - - dat += "
" user << browse(dat.Join(), "window=autolathe") onclose(user, "autolathe") @@ -138,8 +132,8 @@ if(panel_open) //Don't eat multitools or wirecutters used on an open lathe. - if(istype(O, /obj/item/device/multitool) || O.is_wirecutter()) - attack_hand(user) + if(O.is_multitool() || O.is_wirecutter()) + wires.Interact(user) return if(O.loc != user && !(istype(O,/obj/item/stack))) diff --git a/code/game/objects/items/devices/multitool.dm b/code/game/objects/items/devices/multitool.dm index fc3f69dd22..a289e66e82 100644 --- a/code/game/objects/items/devices/multitool.dm +++ b/code/game/objects/items/devices/multitool.dm @@ -63,6 +63,9 @@ return +/obj/item/device/multitool/is_multitool() + return TRUE + /obj/item/device/multitool/cyborg name = "multitool" desc = "Optimised and stripped-down version of a regular multitool." diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index be4c06f55b..d7f83424ca 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -99,6 +99,10 @@ var/list/slot_equipment_priority = list( \ /mob/proc/is_holding_item_of_type(typepath) return FALSE +// Override for your specific mob's hands or lack thereof. +/mob/proc/get_all_held_items() + return list() + //Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success. /mob/proc/put_in_l_hand(var/obj/item/W) if(lying || !istype(W)) diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 46f9514e43..0d9e58b7cb 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -397,4 +397,12 @@ This saves us from having to call add_fingerprint() any time something is put in for(var/obj/item/I in list(l_hand, r_hand)) if(istype(I, typepath)) return I - return FALSE \ No newline at end of file + return FALSE + +// Returns a list of items held in both hands. +/mob/living/carbon/human/get_all_held_items() + . = list() + if(l_hand) + . += l_hand + if(r_hand) + . += r_hand \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index 2b67fc862a..c8b623e517 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -261,4 +261,14 @@ for(var/obj/item/I in list(module_state_1, module_state_2, module_state_3)) if(istype(I, typepath)) return I - return FALSE \ No newline at end of file + return FALSE + +// Returns a list of all held items in a borg's 'hands'. +/mob/living/silicon/robot/get_all_held_items() + . = list() + if(module_state_1) + . += module_state_1 + if(module_state_2) + . += module_state_2 + if(module_state_3) + . += module_state_3 \ No newline at end of file diff --git a/code/modules/mob/living/simple_mob/hands.dm b/code/modules/mob/living/simple_mob/hands.dm index 0e8820fe2e..8ec2158d65 100644 --- a/code/modules/mob/living/simple_mob/hands.dm +++ b/code/modules/mob/living/simple_mob/hands.dm @@ -141,3 +141,16 @@ target = src.loc if(.) W.forceMove(src.loc) + +/mob/living/simple_mob/is_holding_item_of_type(typepath) + for(var/obj/item/I in list(l_hand, r_hand)) + if(istype(I, typepath)) + return I + return FALSE + +/mob/living/simple_mob/get_all_held_items() + . = list() + if(l_hand) + . += l_hand + if(r_hand) + . += r_hand \ No newline at end of file diff --git a/html/changelogs/neerti-hacking_QoL.yml b/html/changelogs/neerti-hacking_QoL.yml new file mode 100644 index 0000000000..3aa3bd9e2e --- /dev/null +++ b/html/changelogs/neerti-hacking_QoL.yml @@ -0,0 +1,38 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Neerti + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "The 'cut' and 'pulse' buttons in the hacking interface now check all available hands for tools, instead of only the active hand." + - tweak: "The textual indicators at the bottom of the hacking window will now go bold when they change, until the next window refresh." + - tweak: "Hacking an Autolathe no longer requires you to hack it using the Autolathe's main window, but instead opens the hacking window like everything else." diff --git a/polaris.dme b/polaris.dme index 546620d0c6..42381a0812 100644 --- a/polaris.dme +++ b/polaris.dme @@ -384,6 +384,7 @@ #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"