From a3a177569612437e1deef8aef185e86253db2e3d Mon Sep 17 00:00:00 2001 From: davipatury Date: Sat, 25 Feb 2017 21:51:28 -0300 Subject: [PATCH 1/3] Wires nano-ui. --- code/datums/wires/airlock.dm | 28 +-- code/datums/wires/alarm.dm | 14 +- code/datums/wires/apc.dm | 14 +- code/datums/wires/autolathe.dm | 9 +- code/datums/wires/camera.dm | 18 +- code/datums/wires/explosive.dm | 8 +- code/datums/wires/mulebot.dm | 10 +- code/datums/wires/nuclearbomb.dm | 16 +- code/datums/wires/particle_accelerator.dm | 6 +- code/datums/wires/radio.dm | 6 +- code/datums/wires/robot.dm | 17 +- code/datums/wires/smartfridge.dm | 18 +- code/datums/wires/syndicatebomb.dm | 6 +- code/datums/wires/vending.dm | 18 +- code/datums/wires/wires.dm | 159 +++++++++--------- .../game/objects/items/devices/radio/radio.dm | 5 - .../mob/living/simple_animal/bot/mulebot.dm | 2 +- nano/templates/wires.tmpl | 24 +++ 18 files changed, 192 insertions(+), 186 deletions(-) create mode 100644 nano/templates/wires.tmpl 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}} From bf45dd3cad535f60195b688e5ee95221cbc0d9f8 Mon Sep 17 00:00:00 2001 From: davipatury Date: Sun, 26 Feb 2017 15:23:56 -0300 Subject: [PATCH 2/3] Updates holder ui when pulsed/cut. --- code/datums/wires/airlock.dm | 5 ++++- code/datums/wires/alarm.dm | 2 ++ code/datums/wires/apc.dm | 4 ++-- code/datums/wires/autolathe.dm | 15 ++++++++++++--- code/datums/wires/camera.dm | 4 ++-- code/datums/wires/explosive.dm | 2 ++ code/datums/wires/mulebot.dm | 1 + code/datums/wires/nuclearbomb.dm | 21 ++++++++++++++------- code/datums/wires/particle_accelerator.dm | 4 +++- code/datums/wires/radio.dm | 2 ++ code/datums/wires/robot.dm | 2 ++ code/datums/wires/smartfridge.dm | 2 ++ code/datums/wires/syndicatebomb.dm | 6 ++++-- code/datums/wires/vending.dm | 4 +++- code/datums/wires/wires.dm | 6 ++++-- 15 files changed, 59 insertions(+), 21 deletions(-) diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index a464f71d86b..51369836e2f 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -113,6 +113,7 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 if(AIRLOCK_WIRE_LIGHT) A.lights = mended A.update_icon() + ..() /datum/wires/airlock/UpdatePulsed(index) @@ -176,4 +177,6 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 if(AIRLOCK_WIRE_LIGHT) A.lights = !A.lights - A.update_icon() \ No newline at end of file + A.update_icon() + + ..() \ No newline at end of file diff --git a/code/datums/wires/alarm.dm b/code/datums/wires/alarm.dm index e087fcc9578..46f7c6cc885 100644 --- a/code/datums/wires/alarm.dm +++ b/code/datums/wires/alarm.dm @@ -52,6 +52,7 @@ var/const/AALARM_WIRE_AALARM = 16 if(A.alarm_area.atmosalert(2, A)) A.post_alert(2) A.update_icon() + ..() /datum/wires/alarm/UpdatePulsed(index) var/obj/machinery/alarm/A = holder @@ -94,3 +95,4 @@ var/const/AALARM_WIRE_AALARM = 16 if(A.alarm_area.atmosalert(0, A)) A.post_alert(0) A.update_icon() + ..() diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm index 5f8d423557d..26f8dd61f59 100644 --- a/code/datums/wires/apc.dm +++ b/code/datums/wires/apc.dm @@ -53,7 +53,7 @@ var/const/APC_WIRE_AI_CONTROL = 8 A.aidisabled = 0 A.updateDialog() - A.updateDialog() + ..() /datum/wires/apc/UpdateCut(index, mended) var/obj/machinery/power/apc/A = holder @@ -77,4 +77,4 @@ var/const/APC_WIRE_AI_CONTROL = 8 else if(A.aidisabled == 1) A.aidisabled = 0 - A.updateDialog() \ No newline at end of file + ..() \ No newline at end of file diff --git a/code/datums/wires/autolathe.dm b/code/datums/wires/autolathe.dm index 204082cb12c..29013f73e5e 100644 --- a/code/datums/wires/autolathe.dm +++ b/code/datums/wires/autolathe.dm @@ -28,6 +28,7 @@ var/const/AUTOLATHE_DISABLE_WIRE = 4 A.shocked = !mended if(AUTOLATHE_DISABLE_WIRE) A.disabled = !mended + ..() /datum/wires/autolathe/UpdatePulsed(index) if(IsIndexCut(index)) @@ -36,19 +37,27 @@ var/const/AUTOLATHE_DISABLE_WIRE = 4 switch(index) if(AUTOLATHE_HACK_WIRE) A.adjust_hacked(!A.hacked) + updateUIs() spawn(50) if(A && !IsIndexCut(index)) A.adjust_hacked(0) - Interact(usr) + updateUIs() if(AUTOLATHE_SHOCK_WIRE) A.shocked = !A.shocked + updateUIs() spawn(50) if(A && !IsIndexCut(index)) A.shocked = 0 - Interact(usr) + updateUIs() if(AUTOLATHE_DISABLE_WIRE) A.disabled = !A.disabled + updateUIs() spawn(50) if(A && !IsIndexCut(index)) A.disabled = 0 - Interact(usr) + updateUIs() + +/datum/wires/autolathe/proc/updateUIs() + nanomanager.update_uis(src) + if(holder) + nanomanager.update_uis(holder) \ No newline at end of file diff --git a/code/datums/wires/camera.dm b/code/datums/wires/camera.dm index a90c2aeaf79..0eb7e7ec577 100644 --- a/code/datums/wires/camera.dm +++ b/code/datums/wires/camera.dm @@ -46,7 +46,7 @@ var/const/CAMERA_WIRE_NOTHING2 = 32 C.triggerCameraAlarm() else C.cancelCameraAlarm() - return + ..() /datum/wires/camera/UpdatePulsed(index) var/obj/machinery/camera/C = holder @@ -65,7 +65,7 @@ var/const/CAMERA_WIRE_NOTHING2 = 32 if(CAMERA_WIRE_ALARM) C.visible_message("[bicon(C)] *beep*", "[bicon(C)] *beep*") - return + ..() /datum/wires/camera/proc/CanDeconstruct() if(IsIndexCut(CAMERA_WIRE_POWER) && IsIndexCut(CAMERA_WIRE_FOCUS) && IsIndexCut(CAMERA_WIRE_LIGHT) && IsIndexCut(CAMERA_WIRE_NOTHING1) && IsIndexCut(CAMERA_WIRE_NOTHING2)) diff --git a/code/datums/wires/explosive.dm b/code/datums/wires/explosive.dm index 16e418a3625..f6cce8e223a 100644 --- a/code/datums/wires/explosive.dm +++ b/code/datums/wires/explosive.dm @@ -10,12 +10,14 @@ var/const/WIRE_EXPLODE = 1 switch(index) if(WIRE_EXPLODE) explode() + ..() /datum/wires/explosive/UpdateCut(index, mended) switch(index) if(WIRE_EXPLODE) if(!mended) explode() + ..() /datum/wires/explosive/gibtonite holder_type = /obj/item/weapon/twohanded/required/gibtonite diff --git a/code/datums/wires/mulebot.dm b/code/datums/wires/mulebot.dm index d8b70f436d7..777a3ca05dc 100644 --- a/code/datums/wires/mulebot.dm +++ b/code/datums/wires/mulebot.dm @@ -31,6 +31,7 @@ var/const/WIRE_BEACON_RX = 256 // beacon ping recv holder.visible_message("\blue [bicon(holder)] The drive motor whines briefly.") else holder.visible_message("\blue [bicon(holder)] You hear a radio crackle.") + ..() // HELPER PROCS diff --git a/code/datums/wires/nuclearbomb.dm b/code/datums/wires/nuclearbomb.dm index f8bad15f11b..fcf28b96130 100644 --- a/code/datums/wires/nuclearbomb.dm +++ b/code/datums/wires/nuclearbomb.dm @@ -25,15 +25,17 @@ var/const/NUCLEARBOMB_WIRE_SAFETY = 4 switch(index) if(NUCLEARBOMB_WIRE_LIGHT) N.lighthack = !N.lighthack + updateUIs() spawn(100) N.lighthack = !N.lighthack + updateUIs() if(NUCLEARBOMB_WIRE_TIMING) if(N.timing) - spawn - message_admins("[key_name_admin(usr)] pulsed a nuclear bomb's detonation wire, causing it to explode (JMP)") - N.explode() + message_admins("[key_name_admin(usr)] pulsed a nuclear bomb's detonation wire, causing it to explode (JMP)") + N.explode() if(NUCLEARBOMB_WIRE_SAFETY) N.safety = !N.safety + updateUIs() spawn(100) N.safety = !N.safety if(N.safety == 1) @@ -45,15 +47,15 @@ var/const/NUCLEARBOMB_WIRE_SAFETY = 4 N.icon_state = "nuclearbomb1" else N.visible_message("\blue The [N] emits a quiet whirling noise!") + updateUIs() -/datum/wires/nuclearbomb/UpdateCut(var/index, var/mended) +/datum/wires/nuclearbomb/UpdateCut(index, mended) var/obj/machinery/nuclearbomb/N = holder switch(index) if(NUCLEARBOMB_WIRE_SAFETY) if(N.timing) - spawn - message_admins("[key_name_admin(usr)] cut a nuclear bomb's timing wire, causing it to explode (JMP)") - N.explode() + message_admins("[key_name_admin(usr)] cut a nuclear bomb's timing wire, causing it to explode (JMP)") + N.explode() if(NUCLEARBOMB_WIRE_TIMING) if(!N.lighthack) if(N.icon_state == "nuclearbomb2") @@ -62,3 +64,8 @@ var/const/NUCLEARBOMB_WIRE_SAFETY = 4 bomb_set = 0 if(NUCLEARBOMB_WIRE_LIGHT) N.lighthack = !N.lighthack + +/datum/wires/nuclearbomb/proc/updateUIs() + nanomanager.update_uis(src) + if(holder) + nanomanager.update_uis(holder) \ No newline at end of file diff --git a/code/datums/wires/particle_accelerator.dm b/code/datums/wires/particle_accelerator.dm index f7bf79976dd..463f6883c4a 100644 --- a/code/datums/wires/particle_accelerator.dm +++ b/code/datums/wires/particle_accelerator.dm @@ -29,6 +29,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(index, mended) var/obj/machinery/particle_accelerator/control_box/C = holder @@ -49,4 +50,5 @@ var/const/PARTICLE_LIMIT_POWER_WIRE = 8 // Determines how strong the PA can be. if(PARTICLE_LIMIT_POWER_WIRE) C.strength_upper_limit = (mended ? 2 : 3) if(C.strength_upper_limit < C.strength) - C.remove_strength() \ No newline at end of file + C.remove_strength() + ..() \ No newline at end of file diff --git a/code/datums/wires/radio.dm b/code/datums/wires/radio.dm index b1580d7f103..f947a9d84cc 100644 --- a/code/datums/wires/radio.dm +++ b/code/datums/wires/radio.dm @@ -24,6 +24,7 @@ var/const/WIRE_TRANSMIT = 4 if(WIRE_TRANSMIT) R.broadcasting = !R.broadcasting && !IsIndexCut(WIRE_SIGNAL) + ..() /datum/wires/radio/UpdateCut(index, mended) var/obj/item/device/radio/R = holder @@ -37,3 +38,4 @@ var/const/WIRE_TRANSMIT = 4 if(WIRE_TRANSMIT) R.broadcasting = mended && !IsIndexCut(WIRE_SIGNAL) + ..() diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index e361805caef..468589dce93 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -56,6 +56,7 @@ var/const/BORG_WIRE_LAWCHECK = 16 // Not used on MoMMIs if(BORG_WIRE_LOCKED_DOWN) R.SetLockdown(!mended) + ..() /datum/wires/robot/UpdatePulsed(index) @@ -75,6 +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(mob/living/L) var/mob/living/silicon/robot/R = holder diff --git a/code/datums/wires/smartfridge.dm b/code/datums/wires/smartfridge.dm index 4c6a7c68637..51ae8e95bf8 100644 --- a/code/datums/wires/smartfridge.dm +++ b/code/datums/wires/smartfridge.dm @@ -36,6 +36,7 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4 S.seconds_electrified = 30 if(SMARTFRIDGE_WIRE_IDSCAN) S.scan_id = !S.scan_id + ..() /datum/wires/smartfridge/UpdateCut(index, mended) var/obj/machinery/smartfridge/S = holder @@ -49,3 +50,4 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4 S.seconds_electrified = -1 if(SMARTFRIDGE_WIRE_IDSCAN) S.scan_id = 1 + ..() diff --git a/code/datums/wires/syndicatebomb.dm b/code/datums/wires/syndicatebomb.dm index b0a7b172727..51f460ff29e 100644 --- a/code/datums/wires/syndicatebomb.dm +++ b/code/datums/wires/syndicatebomb.dm @@ -47,6 +47,7 @@ var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if else P.loc.visible_message("[bicon(holder)] The bomb seems to hesitate for a moment.") P.timer += 5 + ..() /datum/wires/syndicatebomb/UpdateCut(index, mended) var/obj/machinery/syndicatebomb/P = holder @@ -58,7 +59,7 @@ var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if P.timer = 0 else P.defused = 1 - if(mended) + else P.defused = 0 //cutting and mending all the wires of an inactive bomb will thus cure any sabotage if(WIRE_UNBOLT) if(!mended && P.anchored) @@ -74,4 +75,5 @@ var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if P.loc.visible_message("[bicon(holder)] The timer stops! The bomb has been defused!") P.icon_state = "[initial(P.icon_state)]-inactive[P.open_panel ? "-wires" : ""]" P.active = 0 - P.defused = 1 \ No newline at end of file + P.defused = 1 + ..() \ No newline at end of file diff --git a/code/datums/wires/vending.dm b/code/datums/wires/vending.dm index 119c81272c6..98efe4136e2 100644 --- a/code/datums/wires/vending.dm +++ b/code/datums/wires/vending.dm @@ -38,6 +38,7 @@ var/const/VENDING_WIRE_IDSCAN = 8 V.seconds_electrified = 30 if(VENDING_WIRE_IDSCAN) V.scan_id = !V.scan_id + ..() /datum/wires/vending/UpdateCut(index, mended) var/obj/machinery/vending/V = holder @@ -52,4 +53,5 @@ var/const/VENDING_WIRE_IDSCAN = 8 else V.seconds_electrified = -1 if(VENDING_WIRE_IDSCAN) - V.scan_id = 1 \ No newline at end of file + V.scan_id = 1 + ..() \ No newline at end of file diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index afafc1737f4..9558ea56e1b 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -145,11 +145,13 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown", // Called when wires cut/mended. /datum/wires/proc/UpdateCut(index, mended) - return + if(holder) + nanomanager.update_uis(holder) // Called when wire pulsed. Add code here. /datum/wires/proc/UpdatePulsed(index) - return + if(holder) + nanomanager.update_uis(holder) /datum/wires/proc/CanUse(mob/living/L) return 1 From 3a10ee852a539fc7e4ed6484493daede0e5945f2 Mon Sep 17 00:00:00 2001 From: davipatury Date: Sat, 4 Mar 2017 14:17:57 -0300 Subject: [PATCH 3/3] Crazylemon's suggestion. --- code/datums/wires/wires.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 9558ea56e1b..9cc386a7975 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -131,8 +131,10 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown", L.put_in_hands(O) else if(istype(I, /obj/item/device/assembly/signaler)) - L.drop_item() - Attach(colour, I) + if(L.drop_item()) + Attach(colour, I) + else + to_chat(L, "[L.get_active_hand()] is stuck to your hand!") else to_chat(L, "You need a remote signaller!")