Refactor wire datums

Finish wire port and refactor wire datums to use string keys; widen color
range to support more wires and more colors.
This commit is contained in:
Bjorn Neergaard
2016-01-22 19:22:09 -06:00
parent cda2f26d56
commit 87b0857b93
40 changed files with 945 additions and 1141 deletions
+4 -4
View File
@@ -37,8 +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=[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>"
dat += "Transmit: <A href='byond://?src=\ref[src];wires=[radio.wires.W_TX]'>[(radio.wires.is_cut(radio.wires.W_TX)) ? "Disabled" : "Enabled"]</A><br>"
dat += "Receive: <A href='byond://?src=\ref[src];wires=[radio.wires.W_RX]'>[(radio.wires.is_cut(radio.wires.W_RX)) ? "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>"
@@ -86,9 +86,9 @@
pai.death(0)
removePersonality()
if(href_list["wires"])
var/t1 = text2num(href_list["wires"])
var/wire = text2num(href_list["wires"])
if(radio)
radio.wires.CutWireIndex(t1)
radio.wires.cut(wire)
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.laws.supplied[1]) as message),1,MAX_MESSAGE_LEN)
if(newlaws && pai)
@@ -57,6 +57,8 @@
if(disarmed)
visible_message("<span class='danger'>\icon[src] Sparks briefly jump out of \the [src], but it's disarmed!")
return
message_admins("a pizza bomb at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[loc.x];Y=[loc.y];Z=[loc.z]'>(JMP)</a> armed by [key_name_admin(armer)] has exploded.")
log_game("a pizza bomb ([loc.x],[loc.y],[loc.z]) armed by [key_name(armer)] has exploded.")
src.audible_message("\icon[src] <b>[src]</b> beeps, \"Enjoy the pizza!\"")
src.visible_message("<span class='userdanger'>\The [src] violently explodes!</span>")
explosion(src.loc,1,2,4,flame_range = 2) //Identical to a minibomb
@@ -65,7 +67,7 @@
/obj/item/device/pizza_bomb/attack_hand(mob/user)
if(loc == user || primed)
wires.Interact(user)
wires.interact(user)
else
..()
@@ -90,7 +92,7 @@
else
attack_hand(user)
return
if(wires.IsInteractionTool(I))
if(is_wire_tool(I))
attack_hand(user)
return
@@ -107,7 +109,7 @@
/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)]"
icon_state = "pizzabox_bomb_disarmed"
name = "pizza bomb"
desc = "A devious contraption, made of a small explosive payload hooked up to pressure-sensitive wires. It's disarmed."
disarmed = 1
@@ -31,7 +31,7 @@
/obj/item/device/radio/intercom/receive_range(freq, level)
if(!on)
return -1
if(wires.IsIndexCut(WIRE_RECEIVE))
if(wires.is_cut(wires.W_RX))
return -1
if(!(0 in level))
var/turf/position = get_turf(src)
@@ -50,7 +50,7 @@
/obj/item/device/radio/New()
wires = new(src)
if(prison_radio)
wires.CutWireIndex(WIRE_TRANSMIT)
wires.cut(wires.W_TX) // OH GOD WHY
secure_radio_connections = new
..()
if(SSradio)
@@ -106,12 +106,11 @@
for(var/ch_name in channels)
secure_radio_connections[ch_name] = add_radio(src, radiochannels[ch_name])
/obj/item/device/radio/interact(mob/user)
if (..())
return
if(b_stat && !istype(user, /mob/living/silicon/ai))
wires.Interact(user)
wires.interact(user)
else
ui_interact(user)
@@ -188,9 +187,7 @@
// Fix for permacell radios, but kinda eh about actually fixing them.
if(!M || !message) return
// 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(wires.IsIndexCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
if(wires.is_cut(wires.W_TX))
return
if(!M.IsVocal())
@@ -449,7 +446,7 @@
// what the range is in which mobs will hear the radio
// returns: -1 if can't receive, range otherwise
if (wires.IsIndexCut(WIRE_RECEIVE))
if (wires.is_cut(wires.W_RX))
return -1
if(!listening)
return -1
@@ -55,8 +55,8 @@
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(wires.IsInteractionTool(I))
wires.Interact(user)
else if(is_wire_tool(I))
wires.interact(user)
else
..()