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
+4 -7
View File
@@ -37,9 +37,8 @@
dat += "<h3>Device Settings</h3><br>"
if(radio)
dat += "<b>Radio Uplink</b><br>"
dat += "Transmit: <A href='byond://?src=\ref[src];wires=4'>[(radio.wires & 4) ? "Enabled" : "Disabled"]</A><br>"
dat += "Receive: <A href='byond://?src=\ref[src];wires=2'>[(radio.wires & 2) ? "Enabled" : "Disabled"]</A><br>"
dat += "Signal Pulser: <A href='byond://?src=\ref[src];wires=1'>[(radio.wires & 1) ? "Enabled" : "Disabled"]</A><br>"
dat += "Transmit: <A href='byond://?src=\ref[src];wires=[WIRE_TRANSMIT]'>[(radio.wires.IsIndexCut(WIRE_TRANSMIT)) ? "Disabled" : "Enabled"]</A><br>"
dat += "Receive: <A href='byond://?src=\ref[src];wires=[WIRE_RECEIVE]'>[(radio.wires.IsIndexCut(WIRE_RECEIVE)) ? "Disabled" : "Enabled"]</A><br>"
else
dat += "<b>Radio Uplink</b><br>"
dat += "<font color=red><i>Radio firmware not loaded. Please install a pAI personality to load firmware.</i></font><br>"
@@ -87,10 +86,8 @@
removePersonality()
if(href_list["wires"])
var/t1 = text2num(href_list["wires"])
if (radio.wires & t1)
radio.wires &= ~t1
else
radio.wires |= t1
if(radio)
radio.wires.CutWireIndex(t1)
if(href_list["setlaws"])
var/newlaws = copytext(sanitize(input("Enter any additional directives you would like your pAI personality to follow. Note that these directives will not override the personality's allegiance to its imprinted master. Conflicting directives will be ignored.", "pAI Directive Configuration", pai.pai_laws) as message),1,MAX_MESSAGE_LEN)
if(newlaws)
+20 -26
View File
@@ -15,7 +15,8 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
var/traitor_frequency = 0 //tune to frequency to unlock traitor supplies
var/canhear_range = 3 // the range which mobs can hear this radio from
var/obj/item/device/radio/patch_link = null
var/wires = WIRE_SIGNAL | WIRE_RECEIVE | WIRE_TRANSMIT
var/datum/wires/radio/wires = null
var/prison_radio = 0
var/b_stat = 0
var/broadcasting = 0
var/listening = 1
@@ -32,16 +33,14 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
w_class = 2
g_amt = 25
m_amt = 75
var/const/WIRE_SIGNAL = 1 //sends a signal, like to set off a bomb or electrocute someone
var/const/WIRE_RECEIVE = 2
var/const/WIRE_TRANSMIT = 4
var/const/TRANSMISSION_DELAY = 5 // only 2/second/radio
var/const/FREQ_LISTENING = 1
//FREQ_BROADCASTING = 2
/obj/item/device/radio
var/datum/radio_frequency/radio_connection
var/list/datum/radio_frequency/secure_radio_connections = new
var/list/datum/radio_frequency/secure_radio_connections
proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
@@ -49,6 +48,10 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT)
/obj/item/device/radio/New()
wires = new(src)
if(prison_radio)
wires.CutWireIndex(WIRE_TRANSMIT)
secure_radio_connections = new
..()
if(radio_controller)
initialize()
@@ -104,21 +107,15 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
return
/obj/item/device/radio/proc/text_wires()
if (!b_stat)
return ""
return {"
<hr>
Green Wire: <A href='byond://?src=\ref[src];wires=4'>[(wires & 4) ? "Cut" : "Mend"] Wire</A><BR>
Red Wire: <A href='byond://?src=\ref[src];wires=2'>[(wires & 2) ? "Cut" : "Mend"] Wire</A><BR>
Blue Wire: <A href='byond://?src=\ref[src];wires=1'>[(wires & 1) ? "Cut" : "Mend"] Wire</A><BR>
"}
if (b_stat)
return wires.GetInteractWindow()
return
/obj/item/device/radio/proc/text_sec_channel(var/chan_name, var/chan_stat)
var/list = !!(chan_stat&FREQ_LISTENING)!=0
return {"
<B>[chan_name]</B><br>
Speaker: <A href='byond://?src=\ref[src];ch_name=[chan_name];listen=[!list]'>[list ? "Engaged" : "Disengaged"]</A><BR>
<B>[chan_name]</B>: <A href='byond://?src=\ref[src];ch_name=[chan_name];listen=[!list]'>[list ? "Engaged" : "Disengaged"]</A><BR>
"}
/obj/item/device/radio/Topic(href, href_list)
@@ -182,14 +179,6 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
channels[chan_name] &= ~FREQ_LISTENING
else
channels[chan_name] |= FREQ_LISTENING
else if (href_list["wires"])
var/t1 = text2num(href_list["wires"])
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
return
if (wires & t1)
wires &= ~t1
else
wires |= t1
if (!( master ))
if (istype(loc, /mob))
interact(loc)
@@ -202,6 +191,9 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
updateDialog()
add_fingerprint(usr)
/obj/item/device/radio/proc/isWireCut(var/index)
return wires.IsIndexCut(index)
/obj/item/device/radio/proc/autosay(var/message, var/from, var/channel) //BS12 EDIT
var/datum/radio_frequency/connection = null
if(channel && channels && channels.len > 0)
@@ -232,7 +224,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
// Uncommenting this. To the above comment:
// The permacell radios aren't suppose to be able to transmit, this isn't a bug and this "fix" is just making radio wires useless. -Giacom
if(!(src.wires & WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
if(isWireCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
return
@@ -256,6 +248,8 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
//world << "DEBUG: channel=\"[channel]\" switching to \"[channels[1]]\""
channel = channels[1]
connection = secure_radio_connections[channel]
if (!channels[channel]) // if the channel is turned off, don't broadcast
return
else
connection = radio_connection
channel = null
@@ -459,7 +453,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
else
eqjobname = "Unknown"
if (!(wires & WIRE_TRANSMIT))
if (isWireCut(WIRE_TRANSMIT))
return
var/list/receive = list()
@@ -619,7 +613,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
// what the range is in which mobs will hear the radio
// returns: -1 if can't receive, range otherwise
if (!(wires & WIRE_RECEIVE))
if (isWireCut(WIRE_RECEIVE))
return -1
if(!listening)
return -1
+70 -14
View File
@@ -1,6 +1,54 @@
/obj/item/weapon/plastique
name = "plastic explosives"
desc = "Used to put holes in specific areas without too much extra hole."
gender = PLURAL
icon = 'icons/obj/assemblies.dmi'
icon_state = "plastic-explosive0"
item_state = "plasticx"
flags = FPRINT | TABLEPASS | USEDELAY
w_class = 2.0
origin_tech = "syndicate=2"
var/datum/wires/explosive/plastic/wires = null
var/timer = 10
var/atom/target = null
var/open_panel = 0
/obj/item/weapon/plastique/New()
wires = new(src)
..()
/obj/item/weapon/plastique/suicide_act(var/mob/user)
. = (BRUTELOSS)
viewers(user) << "\red <b>[user] activates the C4 and holds it above his head! It looks like \he's going out with a bang!</b>"
var/message_say = "FOR NO RAISIN!"
if(user.mind)
if(user.mind.special_role)
var/role = lowertext(user.mind.special_role)
if(role == "traitor" || role == "syndicate")
message_say = "FOR THE SYNDICATE!"
else if(role == "changeling")
message_say = "FOR THE HIVE!"
else if(role == "cultist")
message_say = "FOR NARSIE!"
user.say(message_say)
target = user
explode(get_turf(user))
return .
/obj/item/weapon/plastique/attackby(var/obj/item/I, var/mob/user)
if(istype(I, /obj/item/weapon/screwdriver))
open_panel = !open_panel
user << "<span class='notice'>You [open_panel ? "open" : "close"] the wire panel.</span>"
else if(istype(I, /obj/item/weapon/wirecutters) || istype(I, /obj/item/device/multitool) || istype(I, /obj/item/device/assembly/signaler ))
wires.Interact(user)
else
..()
/obj/item/weapon/plastique/attack_self(mob/user as mob)
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num
if(newtime > 60000)
if(newtime < 60000)
newtime = 60000
timer = newtime
user << "Timer set for [timer] seconds."
@@ -20,11 +68,8 @@
if(do_after(user, 50) && in_range(user, target))
user.drop_item()
target = target
src.target = target
loc = null
var/location
if (isturf(target)) location = target
if (isobj(target)) location = target.loc
if (ismob(target))
var/mob/M = target
target:attack_log += "\[[time_stamp()]\]<font color='orange'> Had the [name] planted on them by [user.real_name] ([user.ckey])</font>"
@@ -36,15 +81,26 @@
target.overlays += image('icons/obj/assemblies.dmi', "plastic-explosive2")
user << "Bomb has been planted. Timer counting down from [timer]."
spawn(timer*10)
if(target)
explosion(location, -1, -1, 2, 3)
if (istype(target, /turf/simulated/wall)) target:dismantle_wall(1)
else target.ex_act(1)
if (isobj(target))
if (target)
del(target)
if (src)
del(src)
explode(get_turf(target))
/obj/item/weapon/plastique/proc/explode(var/location)
if(!target)
target = get_atom_on_turf(src)
if(!target)
target = src
if(location)
explosion(location, -1, -1, 2, 3)
if(target)
if (istype(target, /turf/simulated/wall))
target:dismantle_wall(1)
else
target.ex_act(1)
if (isobj(target))
if (target)
del(target)
del(src)
/obj/item/weapon/plastique/attack(mob/M as mob, mob/user as mob, def_zone)
return