Files
CHOMPStation2/code/datums/wires/robot.dm
Neerti 22954a5a04 QoL: Hacking (#6810)
* Makes hacking window consider all hands instead of just the active one.

* Makes bottom indicators in hacking window go bold if they changed since the last refresh.

* Changelog
2020-03-11 20:36:42 -04:00

94 lines
2.9 KiB
Plaintext

/datum/wires/robot
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
var/const/BORG_WIRE_LOCKED_DOWN = 4
var/const/BORG_WIRE_AI_CONTROL = 8
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)
return .
/datum/wires/robot/UpdateCut(var/index, var/mended)
var/mob/living/silicon/robot/R = holder
switch(index)
if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI
if(!mended)
if (R.lawupdate == 1)
to_chat(R, "LawSync protocol engaged.")
R.show_laws()
else
if (R.lawupdate == 0 && !R.emagged)
R.lawupdate = 1
if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control
if(!mended)
R.disconnect_from_ai()
if (BORG_WIRE_CAMERA)
if(!isnull(R.camera) && !R.scrambledcodes)
R.camera.status = mended
if(BORG_WIRE_LAWCHECK) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh
if (R.lawupdate)
R.lawsync()
if(BORG_WIRE_LOCKED_DOWN)
R.SetLockdown(!mended)
/datum/wires/robot/UpdatePulsed(var/index)
var/mob/living/silicon/robot/R = holder
switch(index)
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
if(!R.emagged)
var/mob/living/silicon/ai/new_ai = select_active_ai(R)
R.connect_to_ai(new_ai)
if (BORG_WIRE_CAMERA)
if(!isnull(R.camera) && R.camera.can_use() && !R.scrambledcodes)
R.visible_message("[R]'s camera lense focuses loudly.")
to_chat(R, "Your camera lense focuses loudly.")
if(BORG_WIRE_LOCKED_DOWN)
R.SetLockdown(!R.lockdown) // Toggle
/datum/wires/robot/CanUse(var/mob/living/L)
var/mob/living/silicon/robot/R = holder
if(R.wiresexposed)
return 1
return 0
/datum/wires/robot/proc/IsCameraCut()
return wires_status & BORG_WIRE_CAMERA
/datum/wires/robot/proc/LockedCut()
return wires_status & BORG_WIRE_LOCKED_DOWN