[MIRROR] Circuit ID Components [MDB IGNORE] (#10472)

* Circuit ID Components (#63817)

This PR adds several circuit components used for scanning and checking ID cards:

The Get ID component returns the ID the target is wearing or holding
The Read ID Info component returns the name, rank, and age registered on the ID
The Read ID Access component returns a list of all the accesses on the ID
The Access Checker component does comparisons on lists of numbers, specifically tailored for checking ID access
Due to the access checker using a similar UI element to the airlock electronics, that element has been moved to its own file in tgui/interfaces/common. This change is not player-facing.

* Circuit ID Components

Co-authored-by: Y0SH1M4S73R <legoboyo@earthlink.net>
This commit is contained in:
SkyratBot
2022-01-06 14:15:41 +01:00
committed by GitHub
parent aefe93f9be
commit 4b80bb178a
10 changed files with 454 additions and 133 deletions
@@ -0,0 +1,32 @@
/obj/item/circuit_component/id_access_reader
display_name = "Read ID Access"
desc = "A component that reads the access on an ID."
category = "ID"
/// The input port
var/datum/port/input/target
/// A list of the accesses on the ID
var/datum/port/output/access_port
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
var/max_range = 1
/obj/item/circuit_component/id_access_reader/get_ui_notices()
. = ..()
. += create_ui_notice("Maximum Range: [max_range] tiles.", "orange", "info")
/obj/item/circuit_component/id_access_reader/populate_ports()
target = add_input_port("Target", PORT_TYPE_ATOM)
access_port = add_output_port("Access", PORT_TYPE_LIST(PORT_TYPE_NUMBER))
/obj/item/circuit_component/id_access_reader/input_received(datum/port/input/port)
var/obj/item/card/id/target_item = target.value
var/turf/current_turf = get_location()
var/turf/target_turf = get_turf(target_item)
if(!istype(target_item) || get_dist(current_turf, target_turf) > max_range || current_turf.z != target_turf.z)
access_port.set_output(null)
return
access_port.set_output(target_item.GetAccess())