diff --git a/code/datums/wires/pizza_bomb.dm b/code/datums/wires/pizza_bomb.dm
new file mode 100644
index 00000000000..d3c64225e54
--- /dev/null
+++ b/code/datums/wires/pizza_bomb.dm
@@ -0,0 +1,46 @@
+
+/datum/wires/pizza_bomb
+ random = 1
+ holder_type = /obj/item/device/pizza_bomb
+ wire_count = 4
+
+var/const/PIZZA_WIRE_DISARM = 1 // No boom
+
+
+/datum/wires/pizza_bomb/UpdatePulsed(index)
+ var/obj/item/device/pizza_bomb/P = holder
+ switch(index)
+ if(PIZZA_WIRE_DISARM)
+ var/was_primed = P.primed
+ P.disarm()
+ if(was_primed)
+ spawn(100) //Rearm after a short time
+ if(P)
+ P.arm()
+ else
+ if(!P.disarmed)
+ message_admins("a pizza bomb at (JMP) armed by [key_name_admin(P.armer)] has exploded via wire pulsing.")
+ log_game("a pizza bomb ([P.loc.x],[P.loc.y],[P.loc.z]) armed by [key_name(P.armer)] has exploded via wire pulsing.")
+ P.go_boom()
+
+
+/datum/wires/pizza_bomb/UpdateCut(index,mended)
+ var/obj/item/device/pizza_bomb/P = holder
+ switch(index)
+ if(PIZZA_WIRE_DISARM)
+ if(mended)
+ P.disarmed = 0
+ else
+ P.disarm()
+ else
+ if(!mended && !P.disarmed)
+ message_admins("a pizza bomb at (JMP) armed by [key_name_admin(P.armer)] has exploded via wire pulsing.")
+ log_game("a pizza bomb ([P.loc.x],[P.loc.y],[P.loc.z]) armed by [key_name(P.armer)] has exploded via wire pulsing.")
+ P.go_boom()
+
+
+/datum/wires/pizza_bomb/GetInteractWindow()
+ . = ..()
+ var/obj/item/device/pizza_bomb/P = holder
+ . += text("
The red light is [P.primed ? "on" : "off"].
")
+ . += text("The green light is [P.disarmed ? "on": "off"].
")
diff --git a/code/datums/wires/r_n_d.dm b/code/datums/wires/r_n_d.dm
new file mode 100644
index 00000000000..3f91c08da62
--- /dev/null
+++ b/code/datums/wires/r_n_d.dm
@@ -0,0 +1,51 @@
+
+/datum/wires/r_n_d
+ random = 1
+ holder_type = /obj/machinery/r_n_d
+ wire_count = 6
+
+var/const/RD_WIRE_HACK = 1 // Hacks the r_n_d machine
+var/const/RD_WIRE_SHOCK = 2 // Shocks the user, 50% chance
+var/const/RD_WIRE_DISABLE = 4 // Disables the machine
+
+
+/datum/wires/r_n_d/CanUse(mob/living/L)
+ var/obj/machinery/r_n_d/R = holder
+ if(R.panel_open)
+ return 1
+ return 0
+
+
+/datum/wires/r_n_d/UpdatePulsed(index)
+ var/obj/machinery/r_n_d/R = holder
+ switch(index)
+ if(RD_WIRE_HACK)
+ R.hacked = !R.hacked
+ if(RD_WIRE_DISABLE)
+ R.disabled = !R.disabled
+ if(RD_WIRE_SHOCK)
+ var/Rshock = R.shocked
+ R.shocked = !R.shocked
+ spawn(100)
+ if(R)
+ R.shocked = Rshock
+
+
+/datum/wires/r_n_d/UpdateCut(index,mended)
+ var/obj/machinery/r_n_d/R = holder
+ switch(index)
+ if(RD_WIRE_HACK)
+ R.hacked = !mended
+ if(RD_WIRE_DISABLE)
+ R.disabled = !mended
+ if(RD_WIRE_SHOCK)
+ R.shocked = !mended
+
+
+/datum/wires/r_n_d/GetInteractWindow()
+ . = ..()
+ var/obj/machinery/r_n_d/R = holder
+ . += text("
The red light is [R.disabled ? "off" : "on"].
")
+ . += text("The green light is [R.shocked ? "off" : "on"].
")
+ . += text("The blue light is [R.hacked ? "off" : "on"].
")
+
diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm
index 350c878a95e..38a62f01487 100644
--- a/code/datums/wires/wires.dm
+++ b/code/datums/wires/wires.dm
@@ -206,6 +206,11 @@ var/const/POWER = 8
else
CRASH("[colour] is not a key in wires.")
+/datum/wires/proc/GetColour(index)
+ for(var/colour in wires)
+ if(wires[colour] == index)
+ return colour
+
//
// Is Index/Colour Cut procs
//
diff --git a/code/game/objects/items/devices/pizza_bomb.dm b/code/game/objects/items/devices/pizza_bomb.dm
index 6ef61b2b75d..942c66e1742 100644
--- a/code/game/objects/items/devices/pizza_bomb.dm
+++ b/code/game/objects/items/devices/pizza_bomb.dm
@@ -8,9 +8,8 @@
var/timer_set = 0
var/primed = 0
var/disarmed = 0
- var/wires = list("orange", "green", "blue", "yellow", "aqua", "purple")
- var/correct_wire
var/armer //Used for admin purposes
+ var/datum/wires/pizza_bomb/wires
/obj/item/device/pizza_bomb/suicide_act(mob/user)
user.visible_message("[user] is opening [src]! It looks like \he's hungry and looking for pizza.")
@@ -44,16 +43,10 @@
desc = "A box suited for pizzas."
return
if(!primed)
- name = "pizza bomb"
- desc = "OH GOD THAT'S NOT A PIZZA"
- icon_state = "pizzabox_bomb"
- audible_message("\icon[src] *beep* *beep*")
user << "That's no pizza! That's a bomb!"
message_admins("[key_name_admin(usr)]? (FLW) has triggered a pizza bomb armed by [key_name_admin(armer)] at (JMP).")
log_game("[key_name(usr)] has triggered a pizza bomb armed by [key_name(armer)] ([loc.x],[loc.y],[loc.z]).")
- primed = 1
- sleep(timer)
- return go_boom()
+ arm()
/obj/item/device/pizza_bomb/burn() //Instead of burning to ashes, it will just explode
go_boom()
@@ -61,52 +54,66 @@
/obj/item/device/pizza_bomb/proc/go_boom()
if(disarmed)
- visible_message("\icon[src] Sparks briefly jump out of the [correct_wire] wire on \the [src], but it's disarmed!")
+ visible_message("\icon[src] Sparks briefly jump out of \the [src], but it's disarmed!")
return
src.audible_message("\icon[src] [src] beeps, \"Enjoy the pizza!\"")
src.visible_message("\The [src] violently explodes!")
explosion(src.loc,1,2,4,flame_range = 2) //Identical to a minibomb
qdel(src)
+
+/obj/item/device/pizza_bomb/attack_hand(mob/user)
+ if(loc == user || primed)
+ wires.Interact(user)
+ else
+ ..()
+
+
/obj/item/device/pizza_bomb/attackby(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/weapon/wirecutters) && primed)
- user << "Oh God, what wire do you cut?!"
- var/chosen_wire = input(user, "OH GOD OH GOD", "WHAT WIRE?!") in wires
- if(!user.canUseTopic(src))
- return
- playsound(src, 'sound/items/Wirecutter.ogg', 50, 1, 1)
- user.visible_message("[user] cuts the [chosen_wire] wire!", "You cut the [chosen_wire] wire!")
- sleep(5)
- if(chosen_wire == correct_wire)
- src.audible_message("\icon[src] \The [src] suddenly stops beeping and seems lifeless.")
- user << "You did it!"
- icon_state = "pizzabox_bomb_[correct_wire]"
- name = "pizza bomb"
- desc = "A devious contraption, made of a small explosive payload hooked up to pressure-sensitive wires. It's disarmed."
- disarmed = 1
- primed = 0
+ if(istype(I, /obj/item/weapon/wirecutters))
+ if(disarmed)
+ if(!in_range(user, src))
+ user << "You can't see the box well enough to cut the wires out!"
+ return
+ user.visible_message("[user] starts removing the payload and wires from \the [src].", "You start removing the payload and wires from \the [src]...")
+ if(do_after(user, 40, target = src))
+ playsound(src, 'sound/items/Wirecutter.ogg', 50, 1, 1)
+ user.unEquip(src)
+ user.visible_message("[user] removes the insides of \the [src]!", "You remove the insides of \the [src].")
+ var/obj/item/stack/cable_coil/C = new /obj/item/stack/cable_coil(src.loc)
+ C.amount = 3
+ new /obj/item/weapon/bombcore/miniature(src.loc)
+ new /obj/item/pizzabox(src.loc)
+ qdel(src)
return
else
- user << "WRONG WIRE!"
- go_boom()
+ attack_hand(user)
return
- if(istype(I, /obj/item/weapon/wirecutters) && disarmed)
- if(!in_range(user, src))
- user << "You can't see the box well enough to cut the wires out!"
- return
- user.visible_message("[user] starts removing the payload and wires from \the [src].", "You start removing the payload and wires from \the [src]...")
- if(do_after(user, 40, target = src))
- playsound(src, 'sound/items/Wirecutter.ogg', 50, 1, 1)
- user.unEquip(src)
- user.visible_message("[user] removes the insides of \the [src]!", "You remove the insides of \the [src].")
- var/obj/item/stack/cable_coil/C = new /obj/item/stack/cable_coil(src.loc)
- C.amount = 3
- new /obj/item/weapon/bombcore/miniature(src.loc)
- new /obj/item/pizzabox(src.loc)
- qdel(src)
+ if(istype(I, /obj/item/device/multitool))
+ attack_hand(user)
return
+
..()
/obj/item/device/pizza_bomb/New()
..()
- correct_wire = pick(wires)
+ wires = new(src)
+
+
+/obj/item/device/pizza_bomb/proc/disarm()
+ audible_message("\icon[src] \The [src] suddenly stops beeping and seems lifeless.")
+ icon_state = "pizzabox_bomb_[wires.GetColour(PIZZA_WIRE_DISARM)]"
+ name = "pizza bomb"
+ desc = "A devious contraption, made of a small explosive payload hooked up to pressure-sensitive wires. It's disarmed."
+ disarmed = 1
+ primed = 0
+
+
+/obj/item/device/pizza_bomb/proc/arm()
+ name = "pizza bomb"
+ desc = "OH GOD THAT'S NOT A PIZZA"
+ icon_state = "pizzabox_bomb"
+ audible_message("\icon[src] *beep* *beep*")
+ primed = 1
+ sleep(timer)
+ return go_boom()
\ No newline at end of file
diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm
index 91a33aa41be..7300f924b1a 100644
--- a/code/modules/research/rdmachines.dm
+++ b/code/modules/research/rdmachines.dm
@@ -13,94 +13,31 @@
var/hacked = 0
var/disabled = 0
var/shocked = 0
- var/list/wires = list()
- var/hack_wire
- var/disable_wire
- var/shock_wire
var/obj/machinery/computer/rdconsole/linked_console
+ var/datum/wires/r_n_d/wires
/obj/machinery/r_n_d/New()
..()
- wires["Red"] = 0
- wires["Blue"] = 0
- wires["Green"] = 0
- wires["Yellow"] = 0
- wires["Black"] = 0
- wires["White"] = 0
- var/list/w = list("Red","Blue","Green","Yellow","Black","White")
- src.hack_wire = pick(w)
- w -= src.hack_wire
- src.shock_wire = pick(w)
- w -= src.shock_wire
- src.disable_wire = pick(w)
- w -= src.disable_wire
+ wires = new(src)
-/obj/machinery/r_n_d/proc/
- shock(mob/user, prb)
- if(stat & (BROKEN|NOPOWER)) // unpowered, no shock
- return 0
- if(!prob(prb))
- return 0
- var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
- s.set_up(5, 1, src)
- s.start()
- if (electrocute_mob(user, get_area(src), src, 0.7))
- return 1
- else
- return 0
+/obj/machinery/r_n_d/proc/shock(mob/user, prb)
+ if(stat & (BROKEN|NOPOWER)) // unpowered, no shock
+ return 0
+ if(!prob(prb))
+ return 0
+ var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
+ s.set_up(5, 1, src)
+ s.start()
+ if (electrocute_mob(user, get_area(src), src, 0.7))
+ return 1
+ else
+ return 0
/obj/machinery/r_n_d/attack_hand(mob/user)
- if (shocked)
+ if(shocked)
shock(user,50)
if(panel_open)
- var/dat as text
- dat += "[src.name] Wires:
"
- for(var/wire in src.wires)
- dat += text("[wire] Wire: [src.wires[wire] ? "Mend" : "Cut"] Pulse
")
-
- dat += text("The red light is [src.disabled ? "off" : "on"].
")
- dat += text("The green light is [src.shocked ? "off" : "on"].
")
- dat += text("The blue light is [src.hacked ? "off" : "on"].
")
- user << browse("[src.name] Hacking[dat]","window=hack_win")
- return
+ wires.Interact(user)
+
-/obj/machinery/r_n_d/Topic(href, href_list)
- if(..())
- return
- usr.set_machine(src)
- src.add_fingerprint(usr)
- if(href_list["pulse"])
- var/temp_wire = href_list["wire"]
- 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.hack_wire == href_list["wire"])
- src.hacked = !src.hacked
- spawn(100) src.hacked = !src.hacked
- if(src.disable_wire == href_list["wire"])
- src.disabled = !src.disabled
- src.shock(usr,50)
- spawn(100) src.disabled = !src.disabled
- if(src.shock_wire == href_list["wire"])
- src.shocked = !src.shocked
- src.shock(usr,50)
- spawn(100) src.shocked = !src.shocked
- if(href_list["cut"])
- if (!istype(usr.get_active_hand(), /obj/item/weapon/wirecutters))
- usr << "You need wirecutters!"
- else
- var/temp_wire = href_list["wire"]
- wires[temp_wire] = !wires[temp_wire]
- if(src.hack_wire == temp_wire)
- src.hacked = !src.hacked
- if(src.disable_wire == temp_wire)
- src.disabled = !src.disabled
- src.shock(usr,50)
- if(src.shock_wire == temp_wire)
- src.shocked = !src.shocked
- src.shock(usr,50)
- src.updateUsrDialog()
diff --git a/tgstation.dme b/tgstation.dme
index 8a694fdef77..d1c27f3f512 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -252,6 +252,8 @@
#include "code\datums\wires\explosive.dm"
#include "code\datums\wires\mulebot.dm"
#include "code\datums\wires\particle_accelerator.dm"
+#include "code\datums\wires\pizza_bomb.dm"
+#include "code\datums\wires\r_n_d.dm"
#include "code\datums\wires\radio.dm"
#include "code\datums\wires\robot.dm"
#include "code\datums\wires\syndicatebomb.dm"