From bf45dd3cad535f60195b688e5ee95221cbc0d9f8 Mon Sep 17 00:00:00 2001 From: davipatury Date: Sun, 26 Feb 2017 15:23:56 -0300 Subject: [PATCH] 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