diff --git a/baystation12.dme b/baystation12.dme
index aaad35c05b6..d0886c1839c 100644
--- a/baystation12.dme
+++ b/baystation12.dme
@@ -207,6 +207,7 @@
#include "code\datums\wires\camera.dm"
#include "code\datums\wires\explosive.dm"
#include "code\datums\wires\mulebot.dm"
+#include "code\datums\wires\nuclearbomb.dm"
#include "code\datums\wires\particle_accelerator.dm"
#include "code\datums\wires\radio.dm"
#include "code\datums\wires\robot.dm"
diff --git a/code/datums/wires/nuclearbomb.dm b/code/datums/wires/nuclearbomb.dm
new file mode 100644
index 00000000000..a8f5357840a
--- /dev/null
+++ b/code/datums/wires/nuclearbomb.dm
@@ -0,0 +1,62 @@
+/datum/wires/nuclearbomb
+ holder_type = /obj/machinery/nuclearbomb
+ random = 1
+ wire_count = 7
+
+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)
+ var/obj/machinery/nuclearbomb/N = holder
+ if(N.panel_open)
+ return 1
+ return 0
+
+/datum/wires/nuclearbomb/GetInteractWindow()
+ 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"].
"
+
+/datum/wires/nuclearbomb/UpdatePulsed(var/index)
+ var/obj/machinery/nuclearbomb/N = holder
+ switch(index)
+ if(NUCLEARBOMB_WIRE_LIGHT)
+ N.lighthack = !N.lighthack
+ spawn(100)
+ N.lighthack = !N.lighthack
+ 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()
+ if(NUCLEARBOMB_WIRE_SAFETY)
+ N.safety = !N.safety
+ spawn(100)
+ N.safety = !N.safety
+ if(N.safety == 1)
+ N.visible_message("\The [N] quiets down.")
+ if(!N.lighthack)
+ if (N.icon_state == "nuclearbomb2")
+ N.icon_state = "nuclearbomb1"
+ else
+ N.visible_message("\The [N] emits a quiet whirling noise!")
+
+/datum/wires/nuclearbomb/UpdateCut(var/index, var/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()
+ if(NUCLEARBOMB_WIRE_TIMING)
+ if(!N.lighthack)
+ if (N.icon_state == "nuclearbomb2")
+ N.icon_state = "nuclearbomb1"
+ N.timing = 0
+ bomb_set = 0
+ if(NUCLEARBOMB_WIRE_LIGHT)
+ N.lighthack = !N.lighthack
diff --git a/code/game/machinery/nuclear_bomb.dm b/code/game/machinery/nuclear_bomb.dm
index a8ca3f1dbea..fb2a4994e33 100644
--- a/code/game/machinery/nuclear_bomb.dm
+++ b/code/game/machinery/nuclear_bomb.dm
@@ -17,34 +17,21 @@ var/bomb_set
var/yes_code = 0.0
var/safety = 1.0
var/obj/item/weapon/disk/nuclear/auth = null
- var/list/wires = list()
- var/light_wire
- var/safety_wire
- var/timing_wire
var/removal_stage = 0 // 0 is no removal, 1 is covers removed, 2 is covers open,
// 3 is sealant open, 4 is unwrenched, 5 is removed from bolts.
use_power = 0
-
+ var/datum/wires/nuclearbomb/wires
/obj/machinery/nuclearbomb/New()
..()
r_code = "[rand(10000, 99999.0)]"//Creates a random code upon object spawn.
+ wires = new(src)
- src.wires["Red"] = 0
- src.wires["Blue"] = 0
- src.wires["Green"] = 0
- src.wires["Marigold"] = 0
- src.wires["Fuschia"] = 0
- src.wires["Black"] = 0
- src.wires["Pearl"] = 0
- var/list/w = list("Red","Blue","Green","Marigold","Black","Fuschia","Pearl")
- src.light_wire = pick(w)
- w -= src.light_wire
- src.timing_wire = pick(w)
- w -= src.timing_wire
- src.safety_wire = pick(w)
- w -= src.safety_wire
+/obj/machinery/nuclearbomb/Destroy()
+ qdel(wires)
+ wires = null
+ return ..()
/obj/machinery/nuclearbomb/process()
if (src.timing)
@@ -58,7 +45,6 @@ var/bomb_set
return
/obj/machinery/nuclearbomb/attackby(obj/item/weapon/O as obj, mob/user as mob)
-
if (istype(O, /obj/item/weapon/screwdriver))
src.add_fingerprint(user)
if (src.auth)
@@ -83,7 +69,7 @@ var/bomb_set
return
if (istype(O, /obj/item/weapon/wirecutters) || istype(O, /obj/item/device/multitool))
if (src.opened == 1)
- nukehack_win(user)
+ wires.Interact(user)
return
if (src.extended)
@@ -202,17 +188,6 @@ var/bomb_set
src.extended = 1
return
-obj/machinery/nuclearbomb/proc/nukehack_win(mob/user as mob)
- var/dat as text
- dat += "Nuclear Fission Explosive
\nNuclear Device Wires:
"
- for(var/wire in src.wires)
- dat += text("[wire] Wire: [src.wires[wire] ? "Mend" : "Cut"] Pulse
")
- dat += text("
The device is [src.timing ? "shaking!" : "still"]
")
- dat += text("The device is [src.safety ? "quiet" : "whirring"].
")
- dat += text("The lights are [src.lighthack ? "static" : "functional"].
")
- user << browse("Bomb Defusion[dat]","window=nukebomb_hack")
- onclose(user, "nukebomb_hack")
-
/obj/machinery/nuclearbomb/verb/make_deployable()
set category = "Object"
set name = "Make Deployable"
@@ -239,47 +214,6 @@ obj/machinery/nuclearbomb/proc/nukehack_win(mob/user as mob)
return
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))))
usr.set_machine(src)
- if(href_list["act"])
- var/temp_wire = href_list["wire"]
- if(href_list["act"] == "pulse")
- if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
- usr << "You need a multitool!"
- else
- if(src.wires[temp_wire])
- usr << "You can't pulse a cut wire."
- else
- if(src.light_wire == temp_wire)
- src.lighthack = !src.lighthack
- spawn(100) src.lighthack = !src.lighthack
- if(src.timing_wire == temp_wire)
- if(src.timing)
- explode()
- if(src.safety_wire == temp_wire)
- src.safety = !src.safety
- spawn(100) src.safety = !src.safety
- if(src.safety == 1)
- visible_message("The [src] quiets down.")
- if(!src.lighthack)
- if (src.icon_state == "nuclearbomb2")
- src.icon_state = "nuclearbomb1"
- else
- visible_message("The [src] emits a quiet whirling noise!")
- if(href_list["act"] == "wire")
- if (!istype(usr.get_active_hand(), /obj/item/weapon/wirecutters))
- usr << "You need wirecutters!"
- else
- wires[temp_wire] = !wires[temp_wire]
- if(src.safety_wire == temp_wire)
- if(src.timing)
- explode()
- if(src.timing_wire == temp_wire)
- if(!src.lighthack)
- if (src.icon_state == "nuclearbomb2")
- src.icon_state = "nuclearbomb1"
- src.timing = 0
- bomb_set = 0
- if(src.light_wire == temp_wire)
- src.lighthack = !src.lighthack
if (href_list["auth"])
if (src.auth)