mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 03:55:11 +01:00
Merge branch 'master' of https://github.com/tgstation/tgstation into upstream-25-02a
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/obj/item/circuit_component/equipment_action
|
||||
display_name = "Equipment Action"
|
||||
desc = "Represents an action the user can take when using supported shells."
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci, /obj/item/mod/module/circuit)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci, /obj/item/mod/module/circuit)
|
||||
|
||||
/// The icon of the button
|
||||
var/datum/port/input/option/icon_options
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
/// The input port
|
||||
var/datum/port/input/target_input
|
||||
var/datum/port/input/image_pixel_x = 0
|
||||
var/datum/port/input/image_pixel_y = 0
|
||||
var/datum/port/input/image_pixel_x
|
||||
var/datum/port/input/image_pixel_y
|
||||
|
||||
var/max_range = 7
|
||||
|
||||
|
||||
@@ -33,11 +33,19 @@
|
||||
|
||||
var/list/options_map
|
||||
|
||||
/obj/item/circuit_component/soundemitter/Initialize(mapload)
|
||||
if(CONFIG_GET(flag/disallow_circuit_sounds))
|
||||
update_ui_alerts(new_flag=CIRCUIT_FLAG_DISABLED)
|
||||
. = ..()
|
||||
|
||||
/obj/item/circuit_component/soundemitter/get_ui_notices()
|
||||
. = ..()
|
||||
. += create_ui_notice("Sound Cooldown: [DisplayTimeText(sound_cooldown)]", "orange", "stopwatch")
|
||||
if(CONFIG_GET(flag/disallow_circuit_sounds))
|
||||
. += create_ui_notice("Non-functional", "red", "exclamation")
|
||||
update_ui_alerts(new_flag=CIRCUIT_FLAG_DISABLED)
|
||||
else
|
||||
update_ui_alerts(remove_flag=CIRCUIT_FLAG_DISABLED)
|
||||
|
||||
|
||||
/obj/item/circuit_component/soundemitter/populate_ports()
|
||||
@@ -79,10 +87,11 @@
|
||||
|
||||
/obj/item/circuit_component/soundemitter/input_received(datum/port/input/port)
|
||||
if(CONFIG_GET(flag/disallow_circuit_sounds))
|
||||
ui_color = "red"
|
||||
// Without constantly checking the config 24/7 or sending a signal to every circuit, best we can do to update existing emitters is this.
|
||||
update_ui_alerts(new_flag=CIRCUIT_FLAG_DISABLED)
|
||||
return
|
||||
else
|
||||
ui_color = initial(ui_color)
|
||||
update_ui_alerts(remove_flag=CIRCUIT_FLAG_DISABLED)
|
||||
|
||||
if(!parent.shell)
|
||||
return
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
output_value.set_datatype(expected_output_type.value)
|
||||
|
||||
/obj/item/circuit_component/get_variable/input_received(datum/port/input/port)
|
||||
var/atom/object = entity?.value
|
||||
var/datum/object = entity?.value
|
||||
if(getvar_options.value == "Global")
|
||||
object = GLOB
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@
|
||||
desc = "Digitizes user's sight for surveillance-on-the-go. User must have fully functional eyes for digitizer to work. Camera range input is either 0 (near) or 1 (far). Network field is used for camera network."
|
||||
category = "BCI"
|
||||
camera_prefix = "BCI"
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci)
|
||||
|
||||
/// BCIs are organs, and thus the signal must be assigned ONLY when the shell has been installed in a mob - otherwise the camera will never update position
|
||||
camera_signal_move_override = TRUE
|
||||
@@ -314,13 +314,13 @@
|
||||
|
||||
/obj/item/circuit_component/remotecam/bci/register_shell(atom/movable/shell)
|
||||
. = ..()
|
||||
if(!istype(shell_parent, /obj/item/organ/internal/cyberimp/bci))
|
||||
if(!istype(shell_parent, /obj/item/organ/cyberimp/bci))
|
||||
return
|
||||
shell_camera = new /obj/machinery/camera (shell_parent)
|
||||
init_camera()
|
||||
RegisterSignal(shell_parent, COMSIG_ORGAN_IMPLANTED, PROC_REF(on_organ_implanted))
|
||||
RegisterSignal(shell_parent, COMSIG_ORGAN_REMOVED, PROC_REF(on_organ_removed))
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci = shell_parent
|
||||
var/obj/item/organ/cyberimp/bci/bci = shell_parent
|
||||
if(bci.owner) //If somehow the camera was added while shell is already installed inside a mob, assign signals
|
||||
if(bciuser) //This should never happen... But if it does, unassign move signal from old mob
|
||||
UnregisterSignal(bciuser, COMSIG_MOVABLE_MOVED, PROC_REF(update_camera_location))
|
||||
@@ -388,7 +388,7 @@
|
||||
if (current_camera_emp)
|
||||
close_camera()
|
||||
return
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci = shell_parent
|
||||
var/obj/item/organ/cyberimp/bci/bci = shell_parent
|
||||
//If shell is not currently inside a head, or user is currently blind, or user is dead
|
||||
if(!bci.owner || bci.owner.is_blind() || bci.owner.stat >= UNCONSCIOUS)
|
||||
close_camera()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
/obj/item/circuit_component/object_overlay/bar
|
||||
display_name = "Bar Overlay"
|
||||
desc = "Requires a BCI shell. A component that shows a bar overlay ontop of an object from a range of 0 to 100."
|
||||
desc = "Requires a BCI shell. A component that shows a bar overlay atop an object, ranging from 0 to 100."
|
||||
category = "BCI"
|
||||
|
||||
var/datum/port/input/option/bar_overlay_options
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
/obj/item/circuit_component/counter_overlay
|
||||
display_name = "Counter Overlay"
|
||||
desc = "A component that shows an three digit counter. Requires a BCI shell."
|
||||
desc = "A component that shows a three-digit counter. Requires a BCI shell."
|
||||
category = "BCI"
|
||||
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci)
|
||||
|
||||
var/datum/port/input/counter_number
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
var/datum/port/input/signal_update
|
||||
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci
|
||||
var/obj/item/organ/cyberimp/bci/bci
|
||||
var/list/numbers = list()
|
||||
var/datum/weakref/counter_appearance
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
image_pixel_y = add_input_port("Y-Axis Shift", PORT_TYPE_NUMBER)
|
||||
|
||||
/obj/item/circuit_component/counter_overlay/register_shell(atom/movable/shell)
|
||||
if(istype(shell, /obj/item/organ/internal/cyberimp/bci))
|
||||
if(istype(shell, /obj/item/organ/cyberimp/bci))
|
||||
bci = shell
|
||||
RegisterSignal(shell, COMSIG_ORGAN_REMOVED, PROC_REF(on_organ_removed))
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
desc = "Requires a BCI shell. A component that shows an overlay on top of an object."
|
||||
category = "BCI"
|
||||
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci)
|
||||
|
||||
var/datum/port/input/option/object_overlay_options
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
var/datum/port/input/signal_off
|
||||
|
||||
/// Reference to the BCI we're implanted inside
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci
|
||||
var/obj/item/organ/cyberimp/bci/bci
|
||||
|
||||
/// Assoc list of REF to the target atom to the overlay alt appearance it is using
|
||||
var/list/active_overlays = list()
|
||||
@@ -66,7 +66,7 @@
|
||||
options_map = component_options
|
||||
|
||||
/obj/item/circuit_component/object_overlay/register_shell(atom/movable/shell)
|
||||
if(istype(shell, /obj/item/organ/internal/cyberimp/bci))
|
||||
if(istype(shell, /obj/item/organ/cyberimp/bci))
|
||||
bci = shell
|
||||
RegisterSignal(shell, COMSIG_ORGAN_REMOVED, PROC_REF(on_organ_removed))
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
desc = "Requires a BCI shell. When activated, this component will allow user to target an object using their brain and will output the reference to said object."
|
||||
category = "BCI"
|
||||
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci)
|
||||
|
||||
var/datum/port/output/clicked_atom
|
||||
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci
|
||||
var/obj/item/organ/cyberimp/bci/bci
|
||||
var/intercept_cooldown = 1 SECONDS
|
||||
|
||||
/obj/item/circuit_component/target_intercept/populate_ports()
|
||||
@@ -23,7 +23,7 @@
|
||||
clicked_atom = add_output_port("Targeted Object", PORT_TYPE_ATOM)
|
||||
|
||||
/obj/item/circuit_component/target_intercept/register_shell(atom/movable/shell)
|
||||
if(istype(shell, /obj/item/organ/internal/cyberimp/bci))
|
||||
if(istype(shell, /obj/item/organ/cyberimp/bci))
|
||||
bci = shell
|
||||
RegisterSignal(shell, COMSIG_ORGAN_REMOVED, PROC_REF(on_organ_removed))
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
desc = "A component that detects when a BCI is installed or removed from its user."
|
||||
category = "BCI"
|
||||
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci)
|
||||
|
||||
var/datum/port/output/implanted
|
||||
var/datum/port/output/removed
|
||||
var/datum/port/output/current_state
|
||||
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci
|
||||
var/obj/item/organ/cyberimp/bci/bci
|
||||
|
||||
/obj/item/circuit_component/install_detector/populate_ports()
|
||||
. = ..()
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/obj/item/circuit_component/install_detector/register_shell(atom/movable/shell)
|
||||
. = ..()
|
||||
if(istype(shell, /obj/item/organ/internal/cyberimp/bci))
|
||||
if(istype(shell, /obj/item/organ/cyberimp/bci))
|
||||
bci = shell
|
||||
RegisterSignal(shell, COMSIG_ORGAN_IMPLANTED, PROC_REF(on_organ_implanted))
|
||||
RegisterSignal(shell, COMSIG_ORGAN_REMOVED, PROC_REF(on_organ_removed))
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
//SKYRAT EDIT CHANGE END
|
||||
circuit_flags = CIRCUIT_NO_DUPLICATES
|
||||
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci)
|
||||
|
||||
var/datum/port/input/inject
|
||||
var/datum/port/output/injected
|
||||
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci
|
||||
var/obj/item/organ/cyberimp/bci/bci
|
||||
|
||||
/obj/item/circuit_component/reagent_injector/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
/obj/item/circuit_component/reagent_injector/register_shell(atom/movable/shell)
|
||||
. = ..()
|
||||
if(istype(shell, /obj/item/organ/internal/cyberimp/bci))
|
||||
if(istype(shell, /obj/item/organ/cyberimp/bci))
|
||||
bci = shell
|
||||
bci.create_reagents(15, OPENCONTAINER)
|
||||
if(reagents.total_volume)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
desc = "A component that allows the user to input a string using their mind. Requires a BCI shell."
|
||||
category = "BCI"
|
||||
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci)
|
||||
|
||||
var/datum/port/input/input_name
|
||||
var/datum/port/input/input_desc
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
|
||||
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci
|
||||
var/obj/item/organ/cyberimp/bci/bci
|
||||
var/ready = TRUE
|
||||
|
||||
/obj/item/circuit_component/thought_listener/populate_ports()
|
||||
@@ -31,7 +31,7 @@
|
||||
failure = add_output_port("On Failure", PORT_TYPE_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/thought_listener/register_shell(atom/movable/shell)
|
||||
if(istype(shell, /obj/item/organ/internal/cyberimp/bci))
|
||||
if(istype(shell, /obj/item/organ/cyberimp/bci))
|
||||
bci = shell
|
||||
|
||||
/obj/item/circuit_component/thought_listener/unregister_shell(atom/movable/shell)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
desc = "A component that plays a local VOX Announcement for the user. Requires a BCI shell."
|
||||
category = "BCI"
|
||||
|
||||
required_shells = list(/obj/item/organ/internal/cyberimp/bci)
|
||||
required_shells = list(/obj/item/organ/cyberimp/bci)
|
||||
|
||||
var/datum/port/input/option/type_option
|
||||
var/current_type
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
|
||||
|
||||
var/obj/item/organ/internal/cyberimp/bci/bci
|
||||
var/obj/item/organ/cyberimp/bci/bci
|
||||
|
||||
/obj/item/circuit_component/vox/populate_options()
|
||||
type_option = add_option_port("VOX Type", list(PORT_TYPE_LIST(PORT_TYPE_STRING), PORT_TYPE_STRING))
|
||||
@@ -28,7 +28,7 @@
|
||||
word_list = add_input_port("Word List", PORT_TYPE_LIST(PORT_TYPE_STRING))
|
||||
|
||||
/obj/item/circuit_component/vox/register_shell(atom/movable/shell)
|
||||
if(istype(shell, /obj/item/organ/internal/cyberimp/bci))
|
||||
if(istype(shell, /obj/item/organ/cyberimp/bci))
|
||||
bci = shell
|
||||
|
||||
/obj/item/circuit_component/vox/unregister_shell(atom/movable/shell)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define COMP_ARITHMETIC_SUBTRACT "Subtract"
|
||||
#define COMP_ARITHMETIC_MULTIPLY "Multiply"
|
||||
#define COMP_ARITHMETIC_DIVIDE "Divide"
|
||||
#define COMP_ARITHMETIC_MODULO "Modulo"
|
||||
#define COMP_ARITHMETIC_MIN "Minimum"
|
||||
#define COMP_ARITHMETIC_MAX "Maximum"
|
||||
|
||||
@@ -34,6 +35,7 @@
|
||||
COMP_ARITHMETIC_SUBTRACT,
|
||||
COMP_ARITHMETIC_MULTIPLY,
|
||||
COMP_ARITHMETIC_DIVIDE,
|
||||
COMP_ARITHMETIC_MODULO,
|
||||
COMP_ARITHMETIC_MIN,
|
||||
COMP_ARITHMETIC_MAX,
|
||||
)
|
||||
@@ -75,6 +77,8 @@
|
||||
result = null
|
||||
break
|
||||
result /= value
|
||||
if(COMP_ARITHMETIC_MODULO)
|
||||
result %= value
|
||||
if(COMP_ARITHMETIC_MAX)
|
||||
result = max(result, value)
|
||||
if(COMP_ARITHMETIC_MIN)
|
||||
@@ -86,5 +90,6 @@
|
||||
#undef COMP_ARITHMETIC_SUBTRACT
|
||||
#undef COMP_ARITHMETIC_MULTIPLY
|
||||
#undef COMP_ARITHMETIC_DIVIDE
|
||||
#undef COMP_ARITHMETIC_MODULO
|
||||
#undef COMP_ARITHMETIC_MIN
|
||||
#undef COMP_ARITHMETIC_MAX
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* # NFC Receiver Component
|
||||
*
|
||||
* Sends a data package through NFC directly to a shell
|
||||
* if we ever get more shells like BCI's that are nested, keep in mind this may not work correctly unless adjusted
|
||||
*/
|
||||
|
||||
|
||||
/obj/item/circuit_component/nfc_receive
|
||||
display_name = "NFC Receiver"
|
||||
desc = "Receives data packages through NFC. If Encryption Key is set then only signals with the same Encryption Key will be received."
|
||||
category = "Utility"
|
||||
|
||||
circuit_flags = CIRCUIT_FLAG_OUTPUT_SIGNAL //trigger_output
|
||||
|
||||
/// The list type
|
||||
var/datum/port/input/option/list_options
|
||||
|
||||
/// Data being received
|
||||
var/datum/port/output/data_package
|
||||
|
||||
/// Encryption key
|
||||
var/datum/port/input/enc_key
|
||||
|
||||
/obj/item/circuit_component/nfc_receive/populate_options()
|
||||
list_options = add_option_port("List Type", GLOB.wiremod_basic_types)
|
||||
|
||||
/obj/item/circuit_component/nfc_receive/populate_ports()
|
||||
data_package = add_output_port("Data Package", PORT_TYPE_LIST(PORT_TYPE_ANY))
|
||||
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING)
|
||||
|
||||
/obj/item/circuit_component/nfc_receive/register_shell(atom/movable/shell)
|
||||
RegisterSignal(shell, COMSIG_CIRCUIT_NFC_DATA_SENT, PROC_REF(nfc_receive))
|
||||
RegisterSignal(shell, COMSIG_ORGAN_IMPLANTED, PROC_REF(on_organ_implanted))
|
||||
RegisterSignal(shell, COMSIG_ORGAN_REMOVED, PROC_REF(on_organ_removed))
|
||||
|
||||
/obj/item/circuit_component/nfc_receive/unregister_shell(atom/movable/shell)
|
||||
UnregisterSignal(shell, list(
|
||||
COMSIG_CIRCUIT_NFC_DATA_SENT,
|
||||
COMSIG_ORGAN_IMPLANTED,
|
||||
COMSIG_ORGAN_REMOVED,
|
||||
))
|
||||
|
||||
/obj/item/circuit_component/nfc_receive/proc/on_organ_implanted(datum/source, mob/living/carbon/owner)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
RegisterSignal(owner, COMSIG_CIRCUIT_NFC_DATA_SENT, PROC_REF(nfc_receive))
|
||||
|
||||
/obj/item/circuit_component/nfc_receive/proc/on_organ_removed(datum/source, mob/living/carbon/owner)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
UnregisterSignal(owner, COMSIG_CIRCUIT_NFC_DATA_SENT)
|
||||
|
||||
|
||||
/obj/item/circuit_component/nfc_receive/pre_input_received(datum/port/input/port)
|
||||
if(port == list_options)
|
||||
var/new_datatype = list_options.value
|
||||
data_package.set_datatype(PORT_TYPE_LIST(new_datatype))
|
||||
|
||||
|
||||
/obj/item/circuit_component/nfc_receive/proc/nfc_receive(obj/item/circuit_component/source,obj/sender, list/data)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(get_dist(sender,parent) >= 10)
|
||||
return
|
||||
|
||||
if(data["enc_key"] != enc_key.value)
|
||||
return
|
||||
|
||||
var/datum/weakref/ref = data["port"]
|
||||
var/datum/port/input/port = ref?.resolve()
|
||||
if(!port)
|
||||
return
|
||||
|
||||
var/datum/circuit_datatype/datatype_handler = data_package.datatype_handler
|
||||
if(!datatype_handler?.can_receive_from_datatype(port.datatype))
|
||||
return
|
||||
|
||||
data_package.set_output(data["data"])
|
||||
trigger_output.set_output(COMPONENT_SIGNAL)
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* # NFC Transmitter Component
|
||||
*
|
||||
* Sends a data package through NFC
|
||||
* Only the targeted shell will receive the message
|
||||
*/
|
||||
|
||||
/obj/item/circuit_component/nfc_send
|
||||
display_name = "NFC Transmitter"
|
||||
desc = "Sends a data package through NTNet. If Encryption Key is set then transmitted data will be only picked up by receivers with the same Encryption Key."
|
||||
category = "Utility"
|
||||
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
|
||||
|
||||
/// The list type
|
||||
var/datum/port/input/option/list_options
|
||||
|
||||
/// The targeted circuit
|
||||
var/datum/port/input/target
|
||||
|
||||
/// Data being sent
|
||||
var/datum/port/input/data_package
|
||||
|
||||
/// Encryption key
|
||||
var/datum/port/input/enc_key
|
||||
|
||||
/obj/item/circuit_component/nfc_send/populate_options()
|
||||
list_options = add_option_port("List Type", GLOB.wiremod_basic_types)
|
||||
|
||||
/obj/item/circuit_component/nfc_send/populate_ports()
|
||||
data_package = add_input_port("Data Package", PORT_TYPE_LIST(PORT_TYPE_ANY))
|
||||
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING)
|
||||
target = add_input_port("Target", PORT_TYPE_ATOM)
|
||||
|
||||
/obj/item/circuit_component/nfc_send/should_receive_input(datum/port/input/port)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return FALSE
|
||||
|
||||
/obj/item/circuit_component/nfc_send/pre_input_received(datum/port/input/port)
|
||||
if(port == list_options)
|
||||
var/new_datatype = list_options.value
|
||||
data_package.set_datatype(PORT_TYPE_LIST(new_datatype))
|
||||
|
||||
/obj/item/circuit_component/nfc_send/input_received(datum/port/input/port)
|
||||
if(isatom(target.value))
|
||||
var/atom/target_enty = target.value
|
||||
SEND_SIGNAL(target_enty, COMSIG_CIRCUIT_NFC_DATA_SENT, parent, list("data" = data_package.value, "enc_key" = enc_key.value, "port" = WEAKREF(data_package)))
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* # NFC Transmitter List Literal Component
|
||||
*
|
||||
* Create a list literal and send a data package through NFC
|
||||
*
|
||||
* This file is based off of nfc_sendl.dm
|
||||
* Any changes made to those files should be copied over with discretion
|
||||
*/
|
||||
/obj/item/circuit_component/list_literal/nfc_send
|
||||
display_name = "NFC Transmitter List Literal"
|
||||
desc = "Creates a list literal data package and sends it through NFC. If Encryption Key is set then transmitted data will be only picked up by receivers with the same Encryption Key."
|
||||
category = "Utility"
|
||||
|
||||
/// Encryption key
|
||||
var/datum/port/input/enc_key
|
||||
|
||||
/// The targeted circuit
|
||||
var/datum/port/input/target
|
||||
|
||||
/obj/item/circuit_component/list_literal/nfc_send/populate_ports()
|
||||
. = ..()
|
||||
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING)
|
||||
target = add_input_port("Target", PORT_TYPE_ATOM)
|
||||
|
||||
/obj/item/circuit_component/list_literal/nfc_send/should_receive_input(datum/port/input/port)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return FALSE
|
||||
/// If the server is down, don't use power or attempt to send data
|
||||
return find_functional_ntnet_relay()
|
||||
|
||||
/obj/item/circuit_component/list_literal/nfc_send/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(isatom(target.value))
|
||||
var/atom/target_enty = target.value
|
||||
SEND_SIGNAL(target_enty, COMSIG_CIRCUIT_NFC_DATA_SENT, list("data" = list_output.value, "enc_key" = enc_key.value, "port" = WEAKREF(list_output)))
|
||||
@@ -0,0 +1,115 @@
|
||||
/obj/item/circuit_component/wire_bundle
|
||||
display_name = "Wire Bundle"
|
||||
desc = "A bundle of exposed wires that assemblies can be attached to. Ports will only show up once the circuit is inserted into a shell."
|
||||
category = "Utility"
|
||||
circuit_flags = CIRCUIT_FLAG_REFUSE_MODULE
|
||||
|
||||
var/datum/wires/wire_bundle_component/tracked_wires
|
||||
|
||||
var/list/wire_input_ports = list()
|
||||
var/list/wire_output_ports = list()
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/get_ui_notices()
|
||||
. = ..()
|
||||
. += create_ui_notice("Port count is proportional to shell capacity.", "orange", "plug")
|
||||
. += create_ui_notice("Max port count: [MAX_WIRE_COUNT]", "orange", "plug")
|
||||
. += create_ui_notice("Incompatible with assembly shell.", "red", "plug-circle-xmark")
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/register_shell(atom/movable/shell)
|
||||
. = ..()
|
||||
if(isassembly(shell) && !parent.admin_only)
|
||||
return
|
||||
if(shell.wires) // Don't add wires to shells that already have some.
|
||||
return
|
||||
tracked_wires = new(shell)
|
||||
shell.set_wires(tracked_wires)
|
||||
for(var/wire in tracked_wires.wires)
|
||||
wire_input_ports[add_input_port("Pulse [wire]", PORT_TYPE_SIGNAL)] = wire
|
||||
wire_output_ports[wire] = add_output_port("[wire] Pulsed", PORT_TYPE_SIGNAL)
|
||||
RegisterSignal(tracked_wires, COMSIG_PULSE_WIRE, PROC_REF(on_pulse_wire))
|
||||
RegisterSignal(shell, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, PROC_REF(on_shell_requesting_context))
|
||||
RegisterSignal(shell, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY, PROC_REF(on_shell_secondary_interaction))
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/unregister_shell(atom/movable/shell)
|
||||
. = ..()
|
||||
if(shell.wires != tracked_wires)
|
||||
return
|
||||
UnregisterSignal(shell, list(COMSIG_ATOM_ITEM_INTERACTION_SECONDARY, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM))
|
||||
for(var/color in tracked_wires.colors)
|
||||
var/obj/item/assembly/assembly = tracked_wires.detach_assembly(color)
|
||||
if(assembly)
|
||||
assembly.forceMove(drop_location())
|
||||
shell.set_wires(null)
|
||||
QDEL_NULL(tracked_wires)
|
||||
for(var/datum/port/input/in_port in wire_input_ports)
|
||||
remove_input_port(in_port)
|
||||
for(var/wire in wire_output_ports)
|
||||
var/datum/port/output/out_port = wire_output_ports[wire]
|
||||
remove_output_port(out_port)
|
||||
wire_input_ports.Cut()
|
||||
wire_output_ports.Cut()
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/add_to(obj/item/integrated_circuit/added_to)
|
||||
. = ..()
|
||||
if(HAS_TRAIT(added_to, TRAIT_COMPONENT_WIRE_BUNDLE))
|
||||
return FALSE
|
||||
ADD_TRAIT(added_to, TRAIT_COMPONENT_WIRE_BUNDLE, REF(src))
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/removed_from(obj/item/integrated_circuit/removed_from)
|
||||
. = ..()
|
||||
REMOVE_TRAIT(removed_from, TRAIT_COMPONENT_WIRE_BUNDLE, REF(src))
|
||||
return ..()
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(!port)
|
||||
return
|
||||
var/wire = wire_input_ports[port]
|
||||
if(!wire)
|
||||
return
|
||||
if(tracked_wires.is_cut(wire))
|
||||
return
|
||||
var/color = tracked_wires.get_color_of_wire(wire)
|
||||
var/obj/item/assembly/attached = tracked_wires.get_attached(color)
|
||||
attached?.activate()
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/proc/on_pulse_wire(source, wire)
|
||||
SIGNAL_HANDLER
|
||||
if(tracked_wires.is_cut(wire))
|
||||
return
|
||||
var/datum/port/output/port = wire_output_ports[wire]
|
||||
if(!istype(port))
|
||||
return
|
||||
port.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/proc/can_access_wires(atom/source)
|
||||
if(ismachinery(source))
|
||||
var/obj/machinery/machine = source
|
||||
return machine.panel_open
|
||||
return TRUE
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/proc/on_shell_requesting_context(atom/source, list/context, obj/item/item, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
. = NONE
|
||||
|
||||
if(!is_wire_tool(item))
|
||||
return
|
||||
if(!can_access_wires(source))
|
||||
return
|
||||
context[SCREENTIP_CONTEXT_RMB] = "Interact with wires"
|
||||
return CONTEXTUAL_SCREENTIP_SET
|
||||
|
||||
/obj/item/circuit_component/wire_bundle/proc/on_shell_secondary_interaction(atom/source, mob/user, obj/item/tool)
|
||||
SIGNAL_HANDLER
|
||||
if(!is_wire_tool(tool))
|
||||
return
|
||||
if(!can_access_wires(source))
|
||||
return
|
||||
var/datum/component/shell/shell_comp = source.GetComponent(/datum/component/shell)
|
||||
if(shell_comp.locked)
|
||||
source.balloon_alert(user, "locked!")
|
||||
return ITEM_INTERACT_FAILURE
|
||||
if(source.attempt_wire_interaction(user) == WIRE_INTERACTION_BLOCK)
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/obj/item/circuit_component/wirenet_receive
|
||||
display_name = "Wirenet Receiver"
|
||||
desc = "Receives data packets through the connected cable network. If Encryption Key is set then only signals with the same Encryption Key will be received."
|
||||
category = "Utility"
|
||||
|
||||
circuit_flags = CIRCUIT_FLAG_OUTPUT_SIGNAL //trigger_output
|
||||
|
||||
ui_buttons = list(
|
||||
"1" = CABLE_LAYER_1_NAME,
|
||||
"2" = CABLE_LAYER_2_NAME,
|
||||
"3" = CABLE_LAYER_3_NAME,
|
||||
)
|
||||
|
||||
var/cable_layer = /datum/component/circuit_component_wirenet_connection::cable_layer
|
||||
|
||||
/// The list type
|
||||
var/datum/port/input/option/list_options
|
||||
|
||||
/// Data being received
|
||||
var/datum/port/output/data_package
|
||||
|
||||
/// Encryption key
|
||||
var/datum/port/input/enc_key
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(\
|
||||
/datum/component/circuit_component_wirenet_connection,\
|
||||
connection_callback = CALLBACK(src, PROC_REF(on_powernet_connection)),\
|
||||
disconnection_callback = CALLBACK(src, PROC_REF(on_powernet_disconnection)),\
|
||||
post_set_cable_layer_callback = CALLBACK(src, PROC_REF(on_set_cable_layer)),\
|
||||
)
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/proc/on_powernet_connection(datum/powernet/new_powernet)
|
||||
RegisterSignal(new_powernet, COMSIG_POWERNET_CIRCUIT_TRANSMISSION, PROC_REF(on_circuit_transmission))
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/proc/on_powernet_disconnection(datum/powernet/old_powernet)
|
||||
UnregisterSignal(old_powernet, COMSIG_POWERNET_CIRCUIT_TRANSMISSION)
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/proc/on_set_cable_layer(new_layer)
|
||||
cable_layer = new_layer
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/get_ui_notices()
|
||||
. = ..()
|
||||
. += create_ui_notice("Set the cable layer to connect to with the \"1\", \"2\", and \"3\" buttons.", "green", "info")
|
||||
. += create_ui_notice("Currently connected to: [GLOB.cable_layer_to_name["[cable_layer]"]]", "green", "info")
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/populate_options()
|
||||
list_options = add_option_port("List Type", GLOB.wiremod_basic_types)
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/populate_ports()
|
||||
data_package = add_output_port("Data Package", PORT_TYPE_LIST(PORT_TYPE_ANY))
|
||||
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING)
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/pre_input_received(datum/port/input/port)
|
||||
if(port == list_options)
|
||||
var/new_datatype = list_options.value
|
||||
data_package.set_datatype(PORT_TYPE_LIST(new_datatype))
|
||||
|
||||
/obj/item/circuit_component/wirenet_receive/proc/on_circuit_transmission(_source, list/data)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(data["enc_key"] != enc_key.value)
|
||||
return
|
||||
|
||||
var/datum/weakref/ref = data["port"]
|
||||
var/datum/port/input/port = ref?.resolve()
|
||||
if(!port)
|
||||
return
|
||||
|
||||
var/datum/circuit_datatype/datatype_handler = data_package.datatype_handler
|
||||
if(!datatype_handler?.can_receive_from_datatype(port.datatype))
|
||||
return
|
||||
|
||||
data_package.set_output(data["data"])
|
||||
trigger_output.set_output(COMPONENT_SIGNAL)
|
||||
@@ -0,0 +1,68 @@
|
||||
/obj/item/circuit_component/wirenet_send
|
||||
display_name = "Wirenet Transmitter"
|
||||
desc = "Sends a data package through the connected cable network. If Encryption Key is set then transmitted data will be only picked up by receivers with the same Encryption Key."
|
||||
category = "Utility"
|
||||
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
|
||||
|
||||
ui_buttons = list(
|
||||
"1" = CABLE_LAYER_1_NAME,
|
||||
"2" = CABLE_LAYER_2_NAME,
|
||||
"3" = CABLE_LAYER_3_NAME,
|
||||
)
|
||||
|
||||
var/cable_layer = /datum/component/circuit_component_wirenet_connection::cable_layer
|
||||
|
||||
/// Powernet reference provided by the circuit_component_wirenet_connection component
|
||||
var/datum/powernet/connected_powernet
|
||||
|
||||
/// The list type
|
||||
var/datum/port/input/option/list_options
|
||||
|
||||
/// Data being sent
|
||||
var/datum/port/input/data_package
|
||||
|
||||
/// Encryption key
|
||||
var/datum/port/input/enc_key
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(\
|
||||
/datum/component/circuit_component_wirenet_connection,\
|
||||
connection_callback = CALLBACK(src, PROC_REF(on_powernet_connection)),\
|
||||
disconnection_callback = CALLBACK(src, PROC_REF(on_powernet_disconnection)),\
|
||||
post_set_cable_layer_callback = CALLBACK(src, PROC_REF(on_set_cable_layer)),\
|
||||
)
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/Destroy()
|
||||
. = ..()
|
||||
connected_powernet = null
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/proc/on_powernet_connection(datum/powernet/new_powernet)
|
||||
connected_powernet = new_powernet
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/proc/on_powernet_disconnection(datum/powernet/old_powernet)
|
||||
connected_powernet = null
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/proc/on_set_cable_layer(new_layer)
|
||||
cable_layer = new_layer
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/get_ui_notices()
|
||||
. = ..()
|
||||
. += create_ui_notice("Set the cable layer to connect to with the \"1\", \"2\", and \"3\" buttons.", "green", "info")
|
||||
. += create_ui_notice("Currently connected to: [GLOB.cable_layer_to_name["[cable_layer]"]]", "green", "info")
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/populate_options()
|
||||
list_options = add_option_port("List Type", GLOB.wiremod_basic_types)
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/populate_ports()
|
||||
data_package = add_input_port("Data Package", PORT_TYPE_LIST(PORT_TYPE_ANY))
|
||||
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING)
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/pre_input_received(datum/port/input/port)
|
||||
if(port == list_options)
|
||||
var/new_datatype = list_options.value
|
||||
data_package.set_datatype(PORT_TYPE_LIST(new_datatype))
|
||||
|
||||
/obj/item/circuit_component/wirenet_send/input_received(datum/port/input/port)
|
||||
connected_powernet?.data_transmission(data_package.value, enc_key.value, WEAKREF(data_package))
|
||||
@@ -0,0 +1,54 @@
|
||||
/obj/item/circuit_component/list_literal/wirenet_send
|
||||
display_name = "Wirenet Transmitter List Literal"
|
||||
desc = "Creates a list literal data package and sends it through the connected cable network. If Encryption Key is set then transmitted data will be only picked up by receivers with the same Encryption Key."
|
||||
category = "Utility"
|
||||
|
||||
ui_buttons = list(
|
||||
"1" = CABLE_LAYER_1_NAME,
|
||||
"2" = CABLE_LAYER_2_NAME,
|
||||
"3" = CABLE_LAYER_3_NAME,
|
||||
"plus" = "add",
|
||||
"minus" = "remove",
|
||||
)
|
||||
|
||||
var/cable_layer = /datum/component/circuit_component_wirenet_connection::cable_layer
|
||||
|
||||
/// Powernet reference provided by the circuit_component_wirenet_connection component
|
||||
var/datum/powernet/connected_powernet
|
||||
|
||||
/// Encryption key
|
||||
var/datum/port/input/enc_key
|
||||
|
||||
/obj/item/circuit_component/list_literal/wirenet_send/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(\
|
||||
/datum/component/circuit_component_wirenet_connection,\
|
||||
connection_callback = CALLBACK(src, PROC_REF(on_powernet_connection)),\
|
||||
disconnection_callback = CALLBACK(src, PROC_REF(on_powernet_disconnection)),\
|
||||
post_set_cable_layer_callback = CALLBACK(src, PROC_REF(on_set_cable_layer)),\
|
||||
)
|
||||
|
||||
/obj/item/circuit_component/list_literal/wirenet_send/Destroy()
|
||||
. = ..()
|
||||
connected_powernet = null
|
||||
|
||||
/obj/item/circuit_component/list_literal/wirenet_send/proc/on_powernet_connection(datum/powernet/new_powernet)
|
||||
connected_powernet = new_powernet
|
||||
|
||||
/obj/item/circuit_component/list_literal/wirenet_send/proc/on_powernet_disconnection(datum/powernet/old_powernet)
|
||||
connected_powernet = null
|
||||
|
||||
/obj/item/circuit_component/list_literal/wirenet_send/proc/on_set_cable_layer(new_layer)
|
||||
cable_layer = new_layer
|
||||
|
||||
/obj/item/circuit_component/list_literal/wirenet_send/get_ui_notices()
|
||||
. = ..()
|
||||
. += create_ui_notice("Set the cable layer to connect to with the \"1\", \"2\", and \"3\" buttons.", "green", "info")
|
||||
. += create_ui_notice("Currently connected to: [GLOB.cable_layer_to_name["[cable_layer]"]]", "green", "info")
|
||||
|
||||
/obj/item/circuit_component/list_literal/wirenet_send/populate_ports()
|
||||
. = ..()
|
||||
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING)
|
||||
|
||||
/obj/item/circuit_component/list_literal/wirenet_send/input_received(datum/port/input/port)
|
||||
connected_powernet?.data_transmission(list_output.value, enc_key.value, WEAKREF(list_output))
|
||||
Reference in New Issue
Block a user