From 96087dcf671e878f2bcf6b6f4627675d858a36f5 Mon Sep 17 00:00:00 2001
From: Cyberboss
Date: Thu, 22 Sep 2016 18:24:57 -0400
Subject: [PATCH] Station Blueprints now contain wire legend (#20559)
Added a submenu to the Station Blueprints that lists wire color purposes for the round for NT made items
Does not list duds
Removed WIRE_ELECTRIFY as it was synonymous with WIRE_SHOCK
---
code/__DEFINES/wires.dm | 88 +++++++++++------------
code/datums/wires/airalarm.dm | 1 +
code/datums/wires/airlock.dm | 1 +
code/datums/wires/apc.dm | 1 +
code/datums/wires/autolathe.dm | 1 +
code/datums/wires/explosive.dm | 1 +
code/datums/wires/particle_accelerator.dm | 1 +
code/datums/wires/radio.dm | 1 +
code/datums/wires/suit_storage_unit.dm | 1 +
code/datums/wires/vending.dm | 7 +-
code/datums/wires/wires.dm | 6 +-
code/game/objects/items/blueprints.dm | 54 +++++++++++---
12 files changed, 107 insertions(+), 56 deletions(-)
diff --git a/code/__DEFINES/wires.dm b/code/__DEFINES/wires.dm
index 344c9fa23bb..c5954b01f62 100644
--- a/code/__DEFINES/wires.dm
+++ b/code/__DEFINES/wires.dm
@@ -1,44 +1,44 @@
-#define WIRE_ACTIVATE "activate"
-#define WIRE_AI "ai"
-#define WIRE_ALARM "alarm"
-#define WIRE_AVOIDANCE "avoidance"
-#define WIRE_BACKUP1 "backup1"
-#define WIRE_BACKUP2 "backup2"
-#define WIRE_BEACON "beacon"
-#define WIRE_BOLTS "bolts"
-#define WIRE_BOOM "boom"
-#define WIRE_CAMERA "camera"
-#define WIRE_CONTRABAND "contraband"
-#define WIRE_DELAY "delay"
-#define WIRE_DISABLE "disable"
-#define WIRE_DISARM "disarm"
-#define WIRE_ELECTRIFY "electrify"
-#define WIRE_HACK "hack"
-#define WIRE_IDSCAN "idscan"
-#define WIRE_INTERFACE "interface"
-#define WIRE_LAWSYNC "lawsync"
-#define WIRE_LIGHT "light"
-#define WIRE_LIMIT "limit"
-#define WIRE_LOADCHECK "loadcheck"
-#define WIRE_LOCKDOWN "lockdown"
-#define WIRE_MOTOR1 "motor1"
-#define WIRE_MOTOR2 "motor2"
-#define WIRE_OPEN "open"
-#define WIRE_PANIC "panic"
-#define WIRE_POWER "power"
-#define WIRE_POWER1 "power1"
-#define WIRE_POWER2 "power2"
-#define WIRE_PROCEED "proceed"
-#define WIRE_RX "recieve"
-#define WIRE_SAFETY "safety"
-#define WIRE_SHOCK "shock"
-#define WIRE_SIGNAL "signal"
-#define WIRE_SPEAKER "speaker"
-#define WIRE_STRENGTH "strength"
-#define WIRE_THROW "throw"
-#define WIRE_TIMING "timing"
-#define WIRE_TX "transmit"
-#define WIRE_UNBOLT "unbolt"
-#define WIRE_ZAP "zap"
-#define WIRE_ZAP1 "zap1"
-#define WIRE_ZAP2 "zap2"
+#define WIRE_DUD_PREFIX "__dud"
+#define WIRE_ACTIVATE "Activate"
+#define WIRE_AI "AI Connection"
+#define WIRE_ALARM "Alarm"
+#define WIRE_AVOIDANCE "Avoidance"
+#define WIRE_BACKUP1 "Auxillary Power 1"
+#define WIRE_BACKUP2 "Auxillary Power 2"
+#define WIRE_BEACON "Beacon"
+#define WIRE_BOLTS "Bolts"
+#define WIRE_BOOM "Boom"
+#define WIRE_CAMERA "Camera"
+#define WIRE_CONTRABAND "Contraband"
+#define WIRE_DELAY "Delay"
+#define WIRE_DISABLE "Disable"
+#define WIRE_DISARM "Disarm"
+#define WIRE_HACK "Hack"
+#define WIRE_IDSCAN "ID Scan"
+#define WIRE_INTERFACE "Interface"
+#define WIRE_LAWSYNC "AI Law Synchronization"
+#define WIRE_LIGHT "Bolt Lights"
+#define WIRE_LIMIT "Limiter"
+#define WIRE_LOADCHECK "Load Check"
+#define WIRE_LOCKDOWN "Lockdown"
+#define WIRE_MOTOR1 "Motor 1"
+#define WIRE_MOTOR2 "Motor 2"
+#define WIRE_OPEN "Open"
+#define WIRE_PANIC "Panic Siphon"
+#define WIRE_POWER "Power"
+#define WIRE_POWER1 "Main Power 1"
+#define WIRE_POWER2 "Main Power 2"
+#define WIRE_PROCEED "Proceed"
+#define WIRE_RX "Recieve"
+#define WIRE_SAFETY "Safety"
+#define WIRE_SHOCK "High Voltage Ground"
+#define WIRE_SIGNAL "Signal"
+#define WIRE_SPEAKER "Speaker"
+#define WIRE_STRENGTH "Strength"
+#define WIRE_THROW "Throw"
+#define WIRE_TIMING "Timing"
+#define WIRE_TX "Transmit"
+#define WIRE_UNBOLT "Unbolt"
+#define WIRE_ZAP "High Voltage Circuit"
+#define WIRE_ZAP1 "High Voltage Circuit 1"
+#define WIRE_ZAP2 "High Voltage Circuit 2"
diff --git a/code/datums/wires/airalarm.dm b/code/datums/wires/airalarm.dm
index e682045cd7a..073b4610d11 100644
--- a/code/datums/wires/airalarm.dm
+++ b/code/datums/wires/airalarm.dm
@@ -1,5 +1,6 @@
/datum/wires/airalarm
holder_type = /obj/machinery/airalarm
+ proper_name = "Air Alarm"
/datum/wires/airalarm/New(atom/holder)
wires = list(
diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm
index f39494cefbc..6209aed807e 100644
--- a/code/datums/wires/airlock.dm
+++ b/code/datums/wires/airlock.dm
@@ -1,5 +1,6 @@
/datum/wires/airlock
holder_type = /obj/machinery/door/airlock
+ proper_name = "Airlock"
/datum/wires/airlock/secure
randomize = TRUE
diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm
index 860cb37e086..8ef49216487 100644
--- a/code/datums/wires/apc.dm
+++ b/code/datums/wires/apc.dm
@@ -1,5 +1,6 @@
/datum/wires/apc
holder_type = /obj/machinery/power/apc
+ proper_name = "APC"
/datum/wires/apc/New(atom/holder)
wires = list(
diff --git a/code/datums/wires/autolathe.dm b/code/datums/wires/autolathe.dm
index 9aa1f60e6e1..7deba0a4ed1 100644
--- a/code/datums/wires/autolathe.dm
+++ b/code/datums/wires/autolathe.dm
@@ -1,5 +1,6 @@
/datum/wires/autolathe
holder_type = /obj/machinery/autolathe
+ proper_name = "Autolathe"
/datum/wires/autolathe/New(atom/holder)
wires = list(
diff --git a/code/datums/wires/explosive.dm b/code/datums/wires/explosive.dm
index 830aa7805a7..2ab4eb09b9b 100644
--- a/code/datums/wires/explosive.dm
+++ b/code/datums/wires/explosive.dm
@@ -14,6 +14,7 @@
/datum/wires/explosive/c4
holder_type = /obj/item/weapon/c4
+ randomize = TRUE //Same behaviour since no wire actually disarms it
/datum/wires/explosive/c4/interactable(mob/user)
var/obj/item/weapon/c4/P = holder
diff --git a/code/datums/wires/particle_accelerator.dm b/code/datums/wires/particle_accelerator.dm
index 939e93c4917..6c69742f9b1 100644
--- a/code/datums/wires/particle_accelerator.dm
+++ b/code/datums/wires/particle_accelerator.dm
@@ -1,5 +1,6 @@
/datum/wires/particle_accelerator/control_box
holder_type = /obj/machinery/particle_accelerator/control_box
+ proper_name = "Particle Accelerator"
/datum/wires/particle_accelerator/control_box/New(atom/holder)
wires = list(
diff --git a/code/datums/wires/radio.dm b/code/datums/wires/radio.dm
index 3db229b1878..298406c3718 100644
--- a/code/datums/wires/radio.dm
+++ b/code/datums/wires/radio.dm
@@ -1,5 +1,6 @@
/datum/wires/radio
holder_type = /obj/item/device/radio
+ proper_name = "Radio"
/datum/wires/radio/New(atom/holder)
wires = list(
diff --git a/code/datums/wires/suit_storage_unit.dm b/code/datums/wires/suit_storage_unit.dm
index d51e4c850b6..8be1c4be672 100644
--- a/code/datums/wires/suit_storage_unit.dm
+++ b/code/datums/wires/suit_storage_unit.dm
@@ -1,5 +1,6 @@
/datum/wires/suit_storage_unit
holder_type = /obj/machinery/suit_storage_unit
+ proper_name = "Suit Storage Unit"
/datum/wires/suit_storage_unit/New(atom/holder)
wires = list(
diff --git a/code/datums/wires/vending.dm b/code/datums/wires/vending.dm
index a067aa14f90..2e715eaea59 100644
--- a/code/datums/wires/vending.dm
+++ b/code/datums/wires/vending.dm
@@ -1,9 +1,10 @@
/datum/wires/vending
holder_type = /obj/machinery/vending
+ proper_name = "Vending Unit"
/datum/wires/vending/New(atom/holder)
wires = list(
- WIRE_THROW, WIRE_ELECTRIFY, WIRE_SPEAKER,
+ WIRE_THROW, WIRE_SHOCK, WIRE_SPEAKER,
WIRE_CONTRABAND, WIRE_IDSCAN
)
add_duds(1)
@@ -33,7 +34,7 @@
V.shoot_inventory = !V.shoot_inventory
if(WIRE_CONTRABAND)
V.extended_inventory = !V.extended_inventory
- if(WIRE_ELECTRIFY)
+ if(WIRE_SHOCK)
V.seconds_electrified = 30
if(WIRE_IDSCAN)
V.scan_id = !V.scan_id
@@ -47,7 +48,7 @@
V.shoot_inventory = !mend
if(WIRE_CONTRABAND)
V.extended_inventory = FALSE
- if(WIRE_ELECTRIFY)
+ if(WIRE_SHOCK)
if(mend)
V.seconds_electrified = FALSE
else
diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm
index cf4b1f1e862..c65098f5b5c 100644
--- a/code/datums/wires/wires.dm
+++ b/code/datums/wires/wires.dm
@@ -17,6 +17,7 @@ var/list/wire_colors = list(
"yellow",
)
var/list/wire_color_directory = list()
+var/list/wire_name_directory = list()
/proc/is_wire_tool(obj/item/I)
if(istype(I, /obj/item/device/multitool))
@@ -35,12 +36,14 @@ var/list/wire_color_directory = list()
/datum/wires
var/atom/holder = null // The holder (atom that contains these wires).
var/holder_type = null // The holder's typepath (used to make wire colors common to all holders).
+ var/proper_name = "Unknown" // The display name for the wire set shown in station blueprints. Not used if randomize is true or it's an item NT wouldn't know about (Explosives/Nuke)
var/list/wires = list() // List of wires.
var/list/cut_wires = list() // List of wires that have been cut.
var/list/colors = list() // Dictionary of colors to wire.
var/list/assemblies = list() // List of attached assemblies.
var/randomize = 0 // If every instance of these wires should be random.
+ // Prevents wires from showing up in station blueprints
/datum/wires/New(atom/holder)
..()
@@ -55,6 +58,7 @@ var/list/wire_color_directory = list()
if(!wire_color_directory[holder_type])
randomize()
wire_color_directory[holder_type] = colors
+ wire_name_directory[holder_type] = proper_name
else
colors = wire_color_directory[holder_type]
@@ -65,7 +69,7 @@ var/list/wire_color_directory = list()
/datum/wires/proc/add_duds(duds)
while(duds)
- var/dud = "dud[--duds]"
+ var/dud = WIRE_DUD_PREFIX + "[--duds]"
if(dud in wires)
continue
wires += dud
diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm
index 509f41dabea..9f3b53a8ac0 100644
--- a/code/game/objects/items/blueprints.dm
+++ b/code/game/objects/items/blueprints.dm
@@ -54,6 +54,7 @@
fluffnotice = "Property of Nanotrasen. For heads of staff only. Store in high-secure storage."
var/list/image/showing = list()
var/client/viewing
+ var/legend = FALSE //Viewing the wire legend
/obj/item/areaeditor/blueprints/Destroy()
@@ -63,15 +64,25 @@
/obj/item/areaeditor/blueprints/attack_self(mob/user)
. = ..()
- var/area/A = get_area()
- if(get_area_type() == AREA_STATION)
- . += "According to \the [src], you are now in \"[html_encode(A.name)]\".
"
- . += "You may make an amendment to the drawing.
"
- if(!viewing)
- . += "View structural data
"
+ if(!legend)
+ var/area/A = get_area()
+ if(get_area_type() == AREA_STATION)
+ . += "According to \the [src], you are now in \"[html_encode(A.name)]\".
"
+ . += "You may make an amendment to the drawing.
"
+ . += "View wire colour legend
"
+ if(!viewing)
+ . += "View structural data
"
+ else
+ . += "Refresh structural data
"
+ . += "Hide structural data
"
else
- . += "Refresh structural data
"
- . += "Hide structural data
"
+ if(legend == TRUE)
+ . += "<< Back"
+ . += view_wire_devices(user);
+ else
+ //legend is a wireset
+ . += "<< Back"
+ . += view_wire_set(user, legend)
var/datum/browser/popup = new(user, "blueprints", "[src]", 700, 500)
popup.set_content(.)
popup.open()
@@ -84,6 +95,12 @@
if(get_area_type()!=AREA_STATION)
return
edit_area()
+ if(href_list["exit_legend"])
+ legend = FALSE;
+ if(href_list["view_legend"])
+ legend = TRUE;
+ if(href_list["view_wireset"])
+ legend = href_list["view_wireset"];
if(href_list["view_blueprints"])
set_viewer(usr, "You flip the blueprints over to view the complex information diagram.")
if(href_list["hide_blueprints"])
@@ -122,6 +139,7 @@
/obj/item/areaeditor/blueprints/dropped(mob/user)
..()
clear_viewer()
+ legend = FALSE
/obj/item/areaeditor/proc/get_area()
@@ -149,6 +167,26 @@
return AREA_SPECIAL
return AREA_STATION
+/obj/item/areaeditor/blueprints/proc/view_wire_devices(mob/user)
+ var/message = "
You examine the wire legend.
"
+ for(var/wireset in wire_color_directory)
+ message += "
[wire_name_directory[wireset]]"
+ message += "
"
+ return message
+
+/obj/item/areaeditor/blueprints/proc/view_wire_set(mob/user, wireset)
+ //for some reason you can't use wireset directly as a derefencer so this is the next best :/
+ for(var/device in wire_color_directory)
+ if("[device]" == wireset) //I know... don't change it...
+ var/message = "[wire_name_directory[device]]:"
+ for(var/Col in wire_color_directory[device])
+ var/wire_name = wire_color_directory[device][Col]
+ if(!findtext(wire_name, WIRE_DUD_PREFIX)) //don't show duds
+ message += "
[Col]: [wire_name]
"
+ message += ""
+ return message
+ return ""
+
/proc/create_area(mob/living/creator)
var/res = detect_room(get_turf(creator))
if(!istype(res,/list))