Wire hacking recode from /tg/.

Conflicts:
	baystation12.dme
	code/__HELPERS/mobs.dm
	code/defines/obj/weapon.dm
	code/game/machinery/alarm.dm
	code/game/machinery/doors/airlock.dm
	code/game/machinery/machinery.dm
	code/game/machinery/vending.dm
	code/game/objects/items/devices/paicard.dm
	code/game/objects/items/weapons/explosives.dm
	code/global.dm
	code/modules/assembly/signaler.dm
	code/modules/mob/living/silicon/mommi/life.dm
	code/modules/mob/living/silicon/mommi/mommi.dm
	code/modules/mob/living/silicon/robot/robot.dm
	code/modules/mob/living/silicon/robot/wires.dm
This commit is contained in:
Rob Nelson
2014-01-12 22:37:55 -05:00
committed by ZomgPonies
parent 7fdb4ac503
commit 55e918cc6a
30 changed files with 1354 additions and 935 deletions
@@ -14,11 +14,15 @@
construction_state = 0
active = 0
dir = 1
var/strength_upper_limit = 2
var/interface_control = 1
var/list/obj/structure/particle_accelerator/connected_parts
var/assembled = 0
var/parts = null
var/datum/wires/particle_acc/control_box/wires = null
/obj/machinery/particle_accelerator/control_box/New()
wires = new(src)
connected_parts = list()
..()
@@ -26,6 +30,8 @@
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
if(construction_state >= 3)
interact(user)
else if(construction_state == 2) // Wires exposed
wires.Interact(user)
/obj/machinery/particle_accelerator/control_box/update_state()
if(construction_state < 3)
@@ -67,11 +73,11 @@
return
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
..()
//Ignore input if we are broken, !silicon guy cant touch us, or nonai controlling from super far away
if(stat & (BROKEN|NOPOWER) || (get_dist(src, usr) > 1 && !istype(usr, /mob/living/silicon)) || (get_dist(src, usr) > 8 && !istype(usr, /mob/living/silicon/ai)))
usr.unset_machine()
usr << browse(null, "window=pacontrol")
if(..())
return
if(!interface_control)
usr << "<span class='error'>ERROR: Request timed out. Check wire contacts.</span>"
return
if( href_list["close"] )
@@ -79,45 +85,54 @@
usr.unset_machine()
return
if(href_list["togglep"])
src.toggle_power()
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr.key]","singulo")
if (active)
message_admins("PA Control Computer turned ON by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("PA Control Computer turned ON by [usr.ckey]([usr]) in ([x],[y],[z])")
if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE))
src.toggle_power()
else if(href_list["scan"])
src.part_scan()
else if(href_list["strengthup"])
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
add_strength()
else if(href_list["strengthdown"])
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
remove_strength()
src.updateDialog()
src.update_icon()
return
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = strength
part.update_icon()
/obj/machinery/particle_accelerator/control_box/proc/add_strength(var/s)
if(assembled)
strength++
if(strength > 2)
strength = 2
if(strength > strength_upper_limit)
strength = strength_upper_limit
else
message_admins("PA Control Computer increased to [strength] by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("PA Control Computer increased to [strength] by [usr.ckey]([usr]) in ([x],[y],[z])")
investigate_log("increased to <font color='red'>[strength]</font> by [usr.key]","singulo")
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = strength
part.update_icon()
strength_change()
else if(href_list["strengthdown"])
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(var/s)
if(assembled)
strength--
if(strength < 0)
strength = 0
else
investigate_log("decreased to <font color='green'>[strength]</font> by [usr.key]","singulo")
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = strength
part.update_icon()
src.updateDialog()
src.update_icon()
return
strength_change()
/obj/machinery/particle_accelerator/control_box/power_change()
..()
if(stat & NOPOWER)
active = 0
use_power = 0
else if(!stat && construction_state == 3)
else if(!stat && construction_state <= 3)
use_power = 1
return
@@ -187,6 +202,10 @@
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
src.active = !src.active
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
if (active)
message_admins("PA Control Computer turned ON by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("PA Control Computer turned ON by [usr.ckey]([usr]) in ([x],[y],[z])")
if(src.active)
src.use_power = 2
for(var/obj/structure/particle_accelerator/part in connected_parts)