diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 8fb989a8a4f..a464f71d86b 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -21,9 +21,9 @@ var/const/AIRLOCK_WIRE_SAFETY = 512 var/const/AIRLOCK_WIRE_SPEED = 1024 var/const/AIRLOCK_WIRE_LIGHT = 2048 -/datum/wires/airlock/CanUse(var/mob/living/L) +/datum/wires/airlock/CanUse(mob/living/L) var/obj/machinery/door/airlock/A = holder - if(!istype(L, /mob/living/silicon)) + if(!issilicon(L)) if(A.isElectrified()) if(A.shock(L, 100)) return 0 @@ -31,20 +31,20 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 return 1 return 0 -/datum/wires/airlock/GetInteractWindow() +/datum/wires/airlock/get_status() + . = ..() var/obj/machinery/door/airlock/A = holder var/haspower = A.arePowerSystemsOn() - . += ..() - . += text("
\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.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.emergency && haspower) ? "The emergency lights are on." : "The emergency lights are off.")) -/datum/wires/airlock/UpdateCut(var/index, var/mended) + . += "The door bolts [A.locked ? "have fallen!" : "look up."]" + . += "The door bolt lights are [(A.lights && haspower) ? "on." : "off!"]" + . += "The test light is [haspower ? "on." : "off!"]" + . += "The 'AI control allowed' light is [(A.aiControlDisabled == 0 && !A.emagged && haspower) ? "on" : "off"]." + . += "The 'Check Wiring' light is [(A.safe == 0 && haspower) ? "on" : "off"]." + . += "The 'Check Timing Mechanism' light is [(A.normalspeed == 0 && haspower) ? "on" : "off"]." + . += "The emergency lights are [(A.emergency && haspower) ? "on" : "off"]." + +/datum/wires/airlock/UpdateCut(index, mended) var/obj/machinery/door/airlock/A = holder switch(index) @@ -114,7 +114,7 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 A.lights = mended A.update_icon() -/datum/wires/airlock/UpdatePulsed(var/index) +/datum/wires/airlock/UpdatePulsed(index) var/obj/machinery/door/airlock/A = holder switch(index) diff --git a/code/datums/wires/alarm.dm b/code/datums/wires/alarm.dm index a31d075ecc7..e087fcc9578 100644 --- a/code/datums/wires/alarm.dm +++ b/code/datums/wires/alarm.dm @@ -10,18 +10,20 @@ var/const/AALARM_WIRE_AI_CONTROL = 8 var/const/AALARM_WIRE_AALARM = 16 -/datum/wires/alarm/CanUse(var/mob/living/L) +/datum/wires/alarm/CanUse(mob/living/L) var/obj/machinery/alarm/A = holder if(A.wiresexposed) return 1 return 0 -/datum/wires/alarm/GetInteractWindow() +/datum/wires/alarm/get_status() + . = ..() 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.")]") + . += "The Air Alarm is [A.locked ? "" : "un"]locked." + . += "The Air Alarm is [(A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "offline." : "working properly!"]" + . += "The 'AI control allowed' light is [A.aidisabled ? "off" : "on"]." -/datum/wires/alarm/UpdateCut(var/index, var/mended) +/datum/wires/alarm/UpdateCut(index, mended) var/obj/machinery/alarm/A = holder switch(index) if(AALARM_WIRE_IDSCAN) @@ -51,7 +53,7 @@ var/const/AALARM_WIRE_AALARM = 16 A.post_alert(2) A.update_icon() -/datum/wires/alarm/UpdatePulsed(var/index) +/datum/wires/alarm/UpdatePulsed(index) var/obj/machinery/alarm/A = holder switch(index) if(AALARM_WIRE_IDSCAN) diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm index ff566bb7e6d..5f8d423557d 100644 --- a/code/datums/wires/apc.dm +++ b/code/datums/wires/apc.dm @@ -7,19 +7,21 @@ var/const/APC_WIRE_MAIN_POWER1 = 2 var/const/APC_WIRE_MAIN_POWER2 = 4 var/const/APC_WIRE_AI_CONTROL = 8 -/datum/wires/apc/GetInteractWindow() +/datum/wires/apc/get_status() + . = ..() 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.")]") + . += "The APC is [A.locked ? "" : "un"]locked." + . += A.shorted ? "The APCs power has been shorted." : "The APC is working properly!" + . += "The 'AI control allowed' light is [A.aidisabled ? "off" : "on"]." -/datum/wires/apc/CanUse(var/mob/living/L) +/datum/wires/apc/CanUse(mob/living/L) var/obj/machinery/power/apc/A = holder if(A.wiresexposed) return 1 return 0 -/datum/wires/apc/UpdatePulsed(var/index) +/datum/wires/apc/UpdatePulsed(index) var/obj/machinery/power/apc/A = holder @@ -53,7 +55,7 @@ var/const/APC_WIRE_AI_CONTROL = 8 A.updateDialog() -/datum/wires/apc/UpdateCut(var/index, var/mended) +/datum/wires/apc/UpdateCut(index, mended) var/obj/machinery/power/apc/A = holder switch(index) diff --git a/code/datums/wires/autolathe.dm b/code/datums/wires/autolathe.dm index 011c2f9dc90..204082cb12c 100644 --- a/code/datums/wires/autolathe.dm +++ b/code/datums/wires/autolathe.dm @@ -1,5 +1,4 @@ /datum/wires/autolathe - holder_type = /obj/machinery/autolathe wire_count = 10 @@ -7,10 +6,12 @@ var/const/AUTOLATHE_HACK_WIRE = 1 var/const/AUTOLATHE_SHOCK_WIRE = 2 var/const/AUTOLATHE_DISABLE_WIRE = 4 -/datum/wires/autolathe/GetInteractWindow() +/datum/wires/autolathe/get_status() + . = ..() var/obj/machinery/autolathe/A = holder - . += ..() - . += text("
The red light is [A.disabled ? "off" : "on"].
The green light is [A.shocked ? "off" : "on"].
The blue light is [A.hacked ? "off" : "on"].
") + . += "The red light is [A.disabled ? "off" : "on"]." + . += "The green light is [A.shocked ? "off" : "on"]." + . += "The blue light is [A.hacked ? "off" : "on"]." /datum/wires/autolathe/CanUse() var/obj/machinery/autolathe/A = holder diff --git a/code/datums/wires/camera.dm b/code/datums/wires/camera.dm index f6ffd2ed427..a90c2aeaf79 100644 --- a/code/datums/wires/camera.dm +++ b/code/datums/wires/camera.dm @@ -5,17 +5,15 @@ holder_type = /obj/machinery/camera wire_count = 6 -/datum/wires/camera/GetInteractWindow() - +/datum/wires/camera/get_status() . = ..() 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.")]" - return . + . += "The focus light is [(C.view_range == initial(C.view_range)) ? "on" : "off"]." + . += "The power link light is [C.can_use() ? "on" : "off"]." + . += "The camera light is [C.light_disabled ? "off" : "on"]." + . += "The alarm light is [C.alarm_on ? "on" : "off"]." -/datum/wires/camera/CanUse(var/mob/living/L) +/datum/wires/camera/CanUse(mob/living/L) var/obj/machinery/camera/C = holder if(!C.panel_open) return 0 @@ -28,7 +26,7 @@ var/const/CAMERA_WIRE_ALARM = 8 var/const/CAMERA_WIRE_NOTHING1 = 16 var/const/CAMERA_WIRE_NOTHING2 = 32 -/datum/wires/camera/UpdateCut(var/index, var/mended) +/datum/wires/camera/UpdateCut(index, mended) var/obj/machinery/camera/C = holder switch(index) @@ -50,7 +48,7 @@ var/const/CAMERA_WIRE_NOTHING2 = 32 C.cancelCameraAlarm() return -/datum/wires/camera/UpdatePulsed(var/index) +/datum/wires/camera/UpdatePulsed(index) var/obj/machinery/camera/C = holder if(IsIndexCut(index)) return diff --git a/code/datums/wires/explosive.dm b/code/datums/wires/explosive.dm index d653729dfd3..16e418a3625 100644 --- a/code/datums/wires/explosive.dm +++ b/code/datums/wires/explosive.dm @@ -6,12 +6,12 @@ var/const/WIRE_EXPLODE = 1 /datum/wires/explosive/proc/explode() return -/datum/wires/explosive/UpdatePulsed(var/index) +/datum/wires/explosive/UpdatePulsed(index) switch(index) if(WIRE_EXPLODE) explode() -/datum/wires/explosive/UpdateCut(var/index, var/mended) +/datum/wires/explosive/UpdateCut(index, mended) switch(index) if(WIRE_EXPLODE) if(!mended) @@ -20,10 +20,10 @@ var/const/WIRE_EXPLODE = 1 /datum/wires/explosive/gibtonite holder_type = /obj/item/weapon/twohanded/required/gibtonite -/datum/wires/explosive/gibtonite/CanUse(var/mob/living/L) +/datum/wires/explosive/gibtonite/CanUse(mob/living/L) return 1 -/datum/wires/explosive/gibtonite/UpdateCut(var/index, var/mended) +/datum/wires/explosive/gibtonite/UpdateCut(index, mended) return /datum/wires/explosive/gibtonite/explode() diff --git a/code/datums/wires/mulebot.dm b/code/datums/wires/mulebot.dm index 7b59479720d..d8b70f436d7 100644 --- a/code/datums/wires/mulebot.dm +++ b/code/datums/wires/mulebot.dm @@ -13,19 +13,13 @@ var/const/WIRE_REMOTE_RX = 64 // remote recv functions var/const/WIRE_REMOTE_TX = 128 // remote trans status var/const/WIRE_BEACON_RX = 256 // beacon ping recv -/datum/wires/mulebot/CanUse(var/mob/living/L) +/datum/wires/mulebot/CanUse(mob/living/L) var/mob/living/simple_animal/bot/mulebot/M = holder if(M.open) return 1 return 0 -// So the wires do not open a new window, handle the interaction ourselves. -/datum/wires/mulebot/Interact(var/mob/living/user) - if(CanUse(user)) - var/mob/living/simple_animal/bot/mulebot/M = holder - M.interact(user) - -/datum/wires/mulebot/UpdatePulsed(var/index) +/datum/wires/mulebot/UpdatePulsed(index) switch(index) if(WIRE_POWER1, WIRE_POWER2) holder.visible_message("\blue [bicon(holder)] The charge light flickers.") diff --git a/code/datums/wires/nuclearbomb.dm b/code/datums/wires/nuclearbomb.dm index 0297bea8508..f8bad15f11b 100644 --- a/code/datums/wires/nuclearbomb.dm +++ b/code/datums/wires/nuclearbomb.dm @@ -7,20 +7,20 @@ var/const/NUCLEARBOMB_WIRE_LIGHT = 1 var/const/NUCLEARBOMB_WIRE_TIMING = 2 var/const/NUCLEARBOMB_WIRE_SAFETY = 4 -/datum/wires/nuclearbomb/CanUse(var/mob/living/L) +/datum/wires/nuclearbomb/CanUse(mob/living/L) var/obj/machinery/nuclearbomb/N = holder if(N.panel_open) return 1 return 0 -/datum/wires/nuclearbomb/GetInteractWindow() +/datum/wires/nuclearbomb/get_status() + . = ..() var/obj/machinery/nuclearbomb/N = holder - . += ..() - . += "
The device is [N.timing ? "shaking!" : "still."]
" - . += "The device is is [N.safety ? "quiet" : "whirring"].
" - . += "The lights are [N.lighthack ? "static" : "functional"].
" + . += "The device is [N.timing ? "shaking!" : "still."]" + . += "The device is is [N.safety ? "quiet" : "whirring"]." + . += "The lights are [N.lighthack ? "static" : "functional"]." -/datum/wires/nuclearbomb/UpdatePulsed(var/index) +/datum/wires/nuclearbomb/UpdatePulsed(index) var/obj/machinery/nuclearbomb/N = holder switch(index) if(NUCLEARBOMB_WIRE_LIGHT) @@ -45,7 +45,7 @@ var/const/NUCLEARBOMB_WIRE_SAFETY = 4 N.icon_state = "nuclearbomb1" else N.visible_message("\blue The [N] emits a quiet whirling noise!") - + /datum/wires/nuclearbomb/UpdateCut(var/index, var/mended) var/obj/machinery/nuclearbomb/N = holder switch(index) diff --git a/code/datums/wires/particle_accelerator.dm b/code/datums/wires/particle_accelerator.dm index 53a166a79e7..f7bf79976dd 100644 --- a/code/datums/wires/particle_accelerator.dm +++ b/code/datums/wires/particle_accelerator.dm @@ -8,13 +8,13 @@ var/const/PARTICLE_INTERFACE_WIRE = 4 // Determines the interface showing up. var/const/PARTICLE_LIMIT_POWER_WIRE = 8 // Determines how strong the PA can be. //var/const/PARTICLE_NOTHING_WIRE = 16 // Blank wire -/datum/wires/particle_acc/control_box/CanUse(var/mob/living/L) +/datum/wires/particle_acc/control_box/CanUse(mob/living/L) var/obj/machinery/particle_accelerator/control_box/C = holder if(C.construction_state == 2) return 1 return 0 -/datum/wires/particle_acc/control_box/UpdatePulsed(var/index) +/datum/wires/particle_acc/control_box/UpdatePulsed(index) var/obj/machinery/particle_accelerator/control_box/C = holder switch(index) @@ -30,7 +30,7 @@ var/const/PARTICLE_LIMIT_POWER_WIRE = 8 // Determines how strong the PA can be. if(PARTICLE_LIMIT_POWER_WIRE) C.visible_message("[bicon(C)][C] makes a large whirring noise.") -/datum/wires/particle_acc/control_box/UpdateCut(var/index, var/mended) +/datum/wires/particle_acc/control_box/UpdateCut(index, mended) var/obj/machinery/particle_accelerator/control_box/C = holder switch(index) diff --git a/code/datums/wires/radio.dm b/code/datums/wires/radio.dm index 6c2fb9713da..b1580d7f103 100644 --- a/code/datums/wires/radio.dm +++ b/code/datums/wires/radio.dm @@ -6,13 +6,13 @@ var/const/WIRE_SIGNAL = 1 var/const/WIRE_RECEIVE = 2 var/const/WIRE_TRANSMIT = 4 -/datum/wires/radio/CanUse(var/mob/living/L) +/datum/wires/radio/CanUse(mob/living/L) var/obj/item/device/radio/R = holder if(R.b_stat) return 1 return 0 -/datum/wires/radio/UpdatePulsed(var/index) +/datum/wires/radio/UpdatePulsed(index) var/obj/item/device/radio/R = holder switch(index) if(WIRE_SIGNAL) @@ -25,7 +25,7 @@ var/const/WIRE_TRANSMIT = 4 if(WIRE_TRANSMIT) R.broadcasting = !R.broadcasting && !IsIndexCut(WIRE_SIGNAL) -/datum/wires/radio/UpdateCut(var/index, var/mended) +/datum/wires/radio/UpdateCut(index, mended) var/obj/item/device/radio/R = holder switch(index) if(WIRE_SIGNAL) diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index 082cdd9d6d6..e361805caef 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -19,16 +19,15 @@ var/const/BORG_WIRE_CAMERA = 4 var/const/BORG_WIRE_AI_CONTROL = 8 // Not used on MoMMIs var/const/BORG_WIRE_LAWCHECK = 16 // Not used on MoMMIs -/datum/wires/robot/GetInteractWindow() - +/datum/wires/robot/get_status() . = ..() var/mob/living/silicon/robot/R = holder - . += text("
\n[(R.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]
\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.")]
\n") - . += text("
\n[(R.lockcharge ? "The lockdown light is on." : "The lockdown light is off.")]") - return . + . += "The LawSync light is [R.lawupdate ? "on" : "off"]." + . += "The AI link light is [R.connected_ai ? "on" : "off"]." + . += "The Camera light is [(R.camera && R.camera.status == 1) ? "on" : "off"]." + . += "The lockdown light is [R.lockcharge ? "on" : "off"]." -/datum/wires/robot/UpdateCut(var/index, var/mended) +/datum/wires/robot/UpdateCut(index, mended) var/mob/living/silicon/robot/R = holder switch(index) @@ -59,7 +58,7 @@ var/const/BORG_WIRE_LAWCHECK = 16 // Not used on MoMMIs R.SetLockdown(!mended) -/datum/wires/robot/UpdatePulsed(var/index) +/datum/wires/robot/UpdatePulsed(index) var/mob/living/silicon/robot/R = holder switch(index) @@ -77,7 +76,7 @@ var/const/BORG_WIRE_LAWCHECK = 16 // Not used on MoMMIs if(BORG_WIRE_LOCKED_DOWN) R.SetLockdown(!R.lockcharge) // Toggle -/datum/wires/robot/CanUse(var/mob/living/L) +/datum/wires/robot/CanUse(mob/living/L) var/mob/living/silicon/robot/R = holder if(R.wiresexposed) return 1 diff --git a/code/datums/wires/smartfridge.dm b/code/datums/wires/smartfridge.dm index b611497e796..4c6a7c68637 100644 --- a/code/datums/wires/smartfridge.dm +++ b/code/datums/wires/smartfridge.dm @@ -10,9 +10,9 @@ var/const/SMARTFRIDGE_WIRE_ELECTRIFY = 1 var/const/SMARTFRIDGE_WIRE_THROW = 2 var/const/SMARTFRIDGE_WIRE_IDSCAN = 4 -/datum/wires/smartfridge/CanUse(var/mob/living/L) +/datum/wires/smartfridge/CanUse(mob/living/L) var/obj/machinery/smartfridge/S = holder - if(!istype(L, /mob/living/silicon)) + if(!issilicon(L)) if(S.seconds_electrified) if(S.shock(L, 100)) return 0 @@ -20,14 +20,14 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4 return 1 return 0 -/datum/wires/smartfridge/GetInteractWindow() +/datum/wires/smartfridge/get_status() + . = ..() 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.
" + . += "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." -/datum/wires/smartfridge/UpdatePulsed(var/index) +/datum/wires/smartfridge/UpdatePulsed(index) var/obj/machinery/smartfridge/S = holder switch(index) if(SMARTFRIDGE_WIRE_THROW) @@ -37,7 +37,7 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4 if(SMARTFRIDGE_WIRE_IDSCAN) S.scan_id = !S.scan_id -/datum/wires/smartfridge/UpdateCut(var/index, var/mended) +/datum/wires/smartfridge/UpdateCut(index, mended) var/obj/machinery/smartfridge/S = holder switch(index) if(SMARTFRIDGE_WIRE_THROW) diff --git a/code/datums/wires/syndicatebomb.dm b/code/datums/wires/syndicatebomb.dm index 3fa81883fce..b0a7b172727 100644 --- a/code/datums/wires/syndicatebomb.dm +++ b/code/datums/wires/syndicatebomb.dm @@ -10,13 +10,13 @@ var/const/WIRE_PROCEED = 8 // Lowers the timer, explodes if cut while the bomb var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if pulsed while already active, will stop a timer a bomb on cut -/datum/wires/syndicatebomb/CanUse(var/mob/living/L) +/datum/wires/syndicatebomb/CanUse(mob/living/L) var/obj/machinery/syndicatebomb/P = holder if(P.open_panel) return 1 return 0 -/datum/wires/syndicatebomb/UpdatePulsed(var/index) +/datum/wires/syndicatebomb/UpdatePulsed(index) var/obj/machinery/syndicatebomb/P = holder switch(index) if(WIRE_BOOM) @@ -48,7 +48,7 @@ var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if P.loc.visible_message("[bicon(holder)] The bomb seems to hesitate for a moment.") P.timer += 5 -/datum/wires/syndicatebomb/UpdateCut(var/index, var/mended) +/datum/wires/syndicatebomb/UpdateCut(index, mended) var/obj/machinery/syndicatebomb/P = holder switch(index) if(WIRE_EXPLODE) diff --git a/code/datums/wires/vending.dm b/code/datums/wires/vending.dm index 574c7961e09..119c81272c6 100644 --- a/code/datums/wires/vending.dm +++ b/code/datums/wires/vending.dm @@ -9,7 +9,7 @@ var/const/VENDING_WIRE_CONTRABAND = 2 var/const/VENDING_WIRE_ELECTRIFY = 4 var/const/VENDING_WIRE_IDSCAN = 8 -/datum/wires/vending/CanUse(var/mob/living/L) +/datum/wires/vending/CanUse(mob/living/L) var/obj/machinery/vending/V = holder if(!istype(L, /mob/living/silicon)) if(V.seconds_electrified) @@ -19,15 +19,15 @@ var/const/VENDING_WIRE_IDSCAN = 8 return 1 return 0 -/datum/wires/vending/GetInteractWindow() +/datum/wires/vending/get_status() + . = ..() var/obj/machinery/vending/V = holder - . += ..() - . += "
The orange light is [V.seconds_electrified ? "on" : "off"].
" - . += "The red light is [V.shoot_inventory ? "off" : "blinking"].
" - . += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"].
" - . += "A [V.scan_id ? "purple" : "yellow"] light is on.
" + . += "The orange light is [V.seconds_electrified ? "on" : "off"]." + . += "The red light is [V.shoot_inventory ? "off" : "blinking"]." + . += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"]." + . += "A [V.scan_id ? "purple" : "yellow"] light is on." -/datum/wires/vending/UpdatePulsed(var/index) +/datum/wires/vending/UpdatePulsed(index) var/obj/machinery/vending/V = holder switch(index) if(VENDING_WIRE_THROW) @@ -39,7 +39,7 @@ var/const/VENDING_WIRE_IDSCAN = 8 if(VENDING_WIRE_IDSCAN) V.scan_id = !V.scan_id -/datum/wires/vending/UpdateCut(var/index, var/mended) +/datum/wires/vending/UpdateCut(index, mended) var/obj/machinery/vending/V = holder switch(index) if(VENDING_WIRE_THROW) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 6d8866640e4..afafc1737f4 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -26,7 +26,7 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown", var/window_x = 370 var/window_y = 470 -/datum/wires/New(var/atom/holder) +/datum/wires/New(atom/holder) ..() src.holder = holder if(!istype(holder, holder_type)) @@ -68,106 +68,97 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown", src.wires[colour] = index //wires = shuffle(wires) +/datum/wires/proc/get_status() + return list() -/datum/wires/proc/Interact(var/mob/living/user) +/datum/wires/proc/Interact(mob/living/user) + if(user && istype(user) && holder && CanUse(user)) + ui_interact(user) - var/html = null - if(holder && CanUse(user)) - html = GetInteractWindow() - if(html) - user.set_machine(holder) - else - user.unset_machine() - // No content means no window. - user << browse(null, "window=wires") - return - var/datum/browser/popup = new(user, "wires", holder.name, window_x, window_y) - popup.set_content(html) - popup.set_title_image(user.browse_rsc_icon(holder.icon, holder.icon_state)) - popup.open() +/datum/wires/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) + ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open) + if(!ui) + ui = new(user, src, ui_key, "wires.tmpl", holder.name, window_x, window_y) + ui.open() -/datum/wires/proc/GetInteractWindow() - var/html = "
" - html += "

Exposed Wires

" - html += "" +/datum/wires/ui_data(mob/user, ui_key = "main", datum/topic_state/state = default_state) + var/data[0] + var/list/W[0] for(var/colour in wires) - html += "" - html += "[capitalize(colour)]" - html += "" - html += "[IsColourCut(colour) ? "Mend" : "Cut"]" - html += " Pulse" - html += " [IsAttached(colour) ? "Detach" : "Attach"] Signaller" - html += "" - html += "
" + W[++W.len] = list("colour" = capitalize(colour), "cut" = IsColourCut(colour), "attached" = IsAttached(colour)) - return html + if(W.len > 0) + data["wires"] = W + + var/list/status = get_status() + data["status_len"] = status.len + data["status"] = status + + return data + +/datum/wires/nano_host() + return holder /datum/wires/Topic(href, href_list) - ..() + if(..()) + return 1 + 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() + var/colour = lowertext(href_list["wire"]) holder.add_hiddenprint(L) - if(href_list["cut"]) // Toggles the cut/mend status - if(istype(I, /obj/item/weapon/wirecutters)) - playsound(holder, 'sound/items/Wirecutter.ogg', 20, 1) - var/colour = href_list["cut"] - CutWireColour(colour) - else - to_chat(L, "You need wirecutters!") - - else if(href_list["pulse"]) - if(istype(I, /obj/item/device/multitool)) - playsound(holder, 'sound/weapons/empty.ogg', 20, 1) - var/colour = href_list["pulse"] - PulseColour(colour) - else - to_chat(L, "You need a multitool!") - - else if(href_list["attach"]) - var/colour = href_list["attach"] - // Detach - if(IsAttached(colour)) - var/obj/item/O = Detach(colour) - if(O) - L.put_in_hands(O) - - // Attach - else - if(istype(I, /obj/item/device/assembly/signaler)) - L.drop_item() - Attach(colour, I) + switch(href_list["action"]) + if("cut") // Toggles the cut/mend status + if(istype(I, /obj/item/weapon/wirecutters)) + playsound(holder, 'sound/items/Wirecutter.ogg', 20, 1) + CutWireColour(colour) else - to_chat(L, "You need a remote signaller!") + to_chat(L, "You need wirecutters!") + if("pulse") + if(istype(I, /obj/item/device/multitool)) + playsound(holder, 'sound/weapons/empty.ogg', 20, 1) + PulseColour(colour) + else + to_chat(L, "You need a multitool!") + if("attach") + if(IsAttached(colour)) + var/obj/item/O = Detach(colour) + if(O) + L.put_in_hands(O) + else + if(istype(I, /obj/item/device/assembly/signaler)) + L.drop_item() + Attach(colour, I) + else + to_chat(L, "You need a remote signaller!") - - - - // Update Window - Interact(usr) - - if(href_list["close"]) - usr << browse(null, "window=wires") - usr.unset_machine(holder) + nanomanager.update_uis(src) + return 1 // // Overridable Procs // // Called when wires cut/mended. -/datum/wires/proc/UpdateCut(var/index, var/mended) +/datum/wires/proc/UpdateCut(index, mended) return // Called when wire pulsed. Add code here. -/datum/wires/proc/UpdatePulsed(var/index) +/datum/wires/proc/UpdatePulsed(index) return -/datum/wires/proc/CanUse(var/mob/living/L) +/datum/wires/proc/CanUse(mob/living/L) return 1 +/datum/wires/CanUseTopic(mob/user, datum/topic_state/state) + if(!CanUse(user)) + return STATUS_CLOSE + return ..() + // Example of use: /* @@ -194,15 +185,15 @@ var/const/POWER = 8 // Helper Procs // -/datum/wires/proc/PulseColour(var/colour) +/datum/wires/proc/PulseColour(colour) PulseIndex(GetIndex(colour)) -/datum/wires/proc/PulseIndex(var/index) +/datum/wires/proc/PulseIndex(index) if(IsIndexCut(index)) return UpdatePulsed(index) -/datum/wires/proc/GetIndex(var/colour) +/datum/wires/proc/GetIndex(colour) if(wires[colour]) var/index = wires[colour] return index @@ -213,28 +204,28 @@ var/const/POWER = 8 // Is Index/Colour Cut procs // -/datum/wires/proc/IsColourCut(var/colour) +/datum/wires/proc/IsColourCut(colour) var/index = GetIndex(colour) return IsIndexCut(index) -/datum/wires/proc/IsIndexCut(var/index) +/datum/wires/proc/IsIndexCut(index) return (index & wires_status) // // Signaller Procs // -/datum/wires/proc/IsAttached(var/colour) +/datum/wires/proc/IsAttached(colour) if(signallers[colour]) return 1 return 0 -/datum/wires/proc/GetAttached(var/colour) +/datum/wires/proc/GetAttached(colour) if(signallers[colour]) return signallers[colour] return null -/datum/wires/proc/Attach(var/colour, var/obj/item/device/assembly/signaler/S) +/datum/wires/proc/Attach(colour, obj/item/device/assembly/signaler/S) if(colour && S) if(!IsAttached(colour)) signallers[colour] = S @@ -242,7 +233,7 @@ var/const/POWER = 8 S.connected = src return S -/datum/wires/proc/Detach(var/colour) +/datum/wires/proc/Detach(colour) if(colour) var/obj/item/device/assembly/signaler/S = GetAttached(colour) if(S) @@ -252,7 +243,7 @@ var/const/POWER = 8 return S -/datum/wires/proc/Pulse(var/obj/item/device/assembly/signaler/S) +/datum/wires/proc/Pulse(obj/item/device/assembly/signaler/S) for(var/colour in signallers) if(S == signallers[colour]) @@ -264,11 +255,11 @@ var/const/POWER = 8 // Cut Wire Colour/Index procs // -/datum/wires/proc/CutWireColour(var/colour) +/datum/wires/proc/CutWireColour(colour) var/index = GetIndex(colour) CutWireIndex(index) -/datum/wires/proc/CutWireIndex(var/index) +/datum/wires/proc/CutWireIndex(index) if(IsIndexCut(index)) wires_status &= ~index UpdateCut(index, 1) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 419ba6cc5bc..ff1389067bd 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -180,11 +180,6 @@ var/global/list/default_medbay_channels = list( /mob/dead/observer/has_internal_radio_channel_access(var/mob/user, var/list/req_one_accesses) return can_admin_interact() -/obj/item/device/radio/proc/text_wires() - if(b_stat) - return wires.GetInteractWindow() - return - /obj/item/device/radio/proc/ToggleBroadcast() broadcasting = !broadcasting && !(wires.IsIndexCut(WIRE_TRANSMIT) || wires.IsIndexCut(WIRE_SIGNAL)) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 14f7030243e..ef0be0f4568 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -311,7 +311,7 @@ else dat += "Removed
" - dat += wires.GetInteractWindow() + wires.ui_interact(user) else dat += "
The bot is in maintenance mode and cannot be controlled.

" diff --git a/nano/templates/wires.tmpl b/nano/templates/wires.tmpl new file mode 100644 index 00000000000..cce49b84f95 --- /dev/null +++ b/nano/templates/wires.tmpl @@ -0,0 +1,24 @@ +
+ + {{for data.wires}} + + + + {{/for}} +
{{:value.colour}} + + {{:helper.link(value.cut ? 'Mend' : 'Cut', null, {'action' : 'cut', 'wire' : value.colour})}} + {{:helper.link('Pulse', null, {'action' : 'pulse', 'wire' : value.colour})}} + {{:helper.link(value.attached ? 'Detach' : 'Attach', null, {'action' : 'attach', 'wire' : value.colour})}} +
+
+{{if data.status_len}} +
+
+
+ {{for data.status}} +
{{:value}}
+ {{/for}} +
+
+{{/if}}