Merge pull request #11073 from RemieRichards/WireModernisation

RnD Machines + Pizza bombs now use Wire datums
This commit is contained in:
Cheridan
2015-08-12 22:23:18 -05:00
6 changed files with 171 additions and 123 deletions
+46
View File
@@ -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 <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[P.loc.x];Y=[P.loc.y];Z=[P.loc.z]'>(JMP)</a> 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 <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[P.loc.x];Y=[P.loc.y];Z=[P.loc.z]'>(JMP)</a> 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("<br>The red light is [P.primed ? "on" : "off"].<br>")
. += text("The green light is [P.disarmed ? "on": "off"].<br>")
+51
View File
@@ -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("<br>The red light is [R.disabled ? "off" : "on"].<br>")
. += text("The green light is [R.shocked ? "off" : "on"].<br>")
. += text("The blue light is [R.hacked ? "off" : "on"].<br>")
+5
View File
@@ -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
//