Adds the interrupt signal to the delay component, reorganises BCI files and circuit code improvements (#61393)

Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
Watermelon914
2021-09-19 08:21:52 +01:00
committed by GitHub
parent f2b6fcb253
commit 21e5cfe8d2
16 changed files with 75 additions and 56 deletions
+4 -4
View File
@@ -33,12 +33,12 @@
/obj/item/circuit_component/medical_console_data/populate_ports()
records = add_output_port("Crew Monitoring Data", PORT_TYPE_TABLE)
/obj/item/circuit_component/medical_console_data/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/medical_console_data/register_usb_parent(atom/movable/shell)
. = ..()
if(istype(parent, /obj/machinery/computer/crew))
attached_console = parent
if(istype(shell, /obj/machinery/computer/crew))
attached_console = shell
/obj/item/circuit_component/medical_console_data/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/medical_console_data/unregister_usb_parent(atom/movable/shell)
attached_console = null
return ..()
@@ -58,12 +58,12 @@
why_fail = add_output_port("Fail reason", PORT_TYPE_STRING)
on_fail = add_output_port("Failed", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/bluespace_launchpad/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/bluespace_launchpad/register_usb_parent(atom/movable/shell)
. = ..()
if(istype(parent, /obj/machinery/computer/launchpad))
attached_console = parent
if(istype(shell, /obj/machinery/computer/launchpad))
attached_console = shell
/obj/item/circuit_component/bluespace_launchpad/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/bluespace_launchpad/unregister_usb_parent(atom/movable/shell)
attached_console = null
return ..()
+8 -8
View File
@@ -50,12 +50,12 @@
records = add_output_port("Security Records", PORT_TYPE_TABLE)
on_fail = add_output_port("Failed", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/arrest_console_data/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/arrest_console_data/register_usb_parent(atom/movable/shell)
. = ..()
if(istype(parent, /obj/machinery/computer/secure_data))
attached_console = parent
if(istype(shell, /obj/machinery/computer/secure_data))
attached_console = shell
/obj/item/circuit_component/arrest_console_data/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/arrest_console_data/unregister_usb_parent(atom/movable/shell)
attached_console = null
return ..()
@@ -121,12 +121,12 @@
var/obj/machinery/computer/secure_data/attached_console
/obj/item/circuit_component/arrest_console_arrest/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/arrest_console_arrest/register_usb_parent(atom/movable/shell)
. = ..()
if(istype(parent, /obj/machinery/computer/secure_data))
attached_console = parent
if(istype(shell, /obj/machinery/computer/secure_data))
attached_console = shell
/obj/item/circuit_component/arrest_console_arrest/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/arrest_console_arrest/unregister_usb_parent(atom/movable/shell)
attached_console = null
return ..()
+4 -4
View File
@@ -237,16 +237,16 @@
possible_targets = add_output_port("Possible Targets", PORT_TYPE_LIST)
on_fail = add_output_port("Failed", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/teleporter_control_console/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/teleporter_control_console/register_usb_parent(atom/movable/shell)
. = ..()
if (istype(parent, /obj/machinery/computer/teleporter))
attached_console = parent
if (istype(shell, /obj/machinery/computer/teleporter))
attached_console = shell
RegisterSignal(attached_console, COMSIG_TELEPORTER_NEW_TARGET, .proc/on_teleporter_new_target)
update_targets()
/obj/item/circuit_component/teleporter_control_console/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/teleporter_control_console/unregister_usb_parent(atom/movable/shell)
UnregisterSignal(attached_console, COMSIG_TELEPORTER_NEW_TARGET)
attached_console = null
return attached_console
@@ -134,15 +134,15 @@
location = add_output_port("Location", PORT_TYPE_STRING)
travelling_output = add_output_port("Travelling", PORT_TYPE_NUMBER)
/obj/item/circuit_component/tram_controls/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/tram_controls/register_usb_parent(atom/movable/shell)
. = ..()
if (istype(parent, /obj/machinery/computer/tram_controls))
computer = parent
if (istype(shell, /obj/machinery/computer/tram_controls))
computer = shell
var/obj/structure/industrial_lift/tram/central/tram_part = computer.tram_ref?.resolve()
RegisterSignal(tram_part, COMSIG_TRAM_SET_TRAVELLING, .proc/on_tram_set_travelling)
RegisterSignal(tram_part, COMSIG_TRAM_TRAVEL, .proc/on_tram_travel)
/obj/item/circuit_component/tram_controls/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/tram_controls/unregister_usb_parent(atom/movable/shell)
var/obj/structure/industrial_lift/tram/central/tram_part = computer.tram_ref?.resolve()
computer = null
UnregisterSignal(tram_part, list(COMSIG_TRAM_SET_TRAVELLING, COMSIG_TRAM_TRAVEL))
+4 -4
View File
@@ -211,12 +211,12 @@
target_pad = add_input_port("Target Pad", PORT_TYPE_ATOM)
failed = add_output_port("On Fail", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/quantumpad/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/quantumpad/register_usb_parent(atom/movable/shell)
. = ..()
if(istype(parent, /obj/machinery/quantumpad))
attached_pad = parent
if(istype(shell, /obj/machinery/quantumpad))
attached_pad = shell
/obj/item/circuit_component/quantumpad/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/quantumpad/unregister_usb_parent(atom/movable/shell)
attached_pad = null
return ..()
@@ -950,12 +950,12 @@
air_alarm_options = add_option_port("Air Alarm Options", component_options)
options_map = component_options
/obj/item/circuit_component/air_alarm/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/air_alarm/register_usb_parent(atom/movable/shell)
. = ..()
if(istype(parent, /obj/machinery/airalarm))
connected_alarm = parent
if(istype(shell, /obj/machinery/airalarm))
connected_alarm = shell
/obj/item/circuit_component/air_alarm/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/air_alarm/unregister_usb_parent(atom/movable/shell)
connected_alarm = null
return ..()
+4 -4
View File
@@ -474,12 +474,12 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
. = ..()
. += create_ui_notice("Conveyor direction 0 means that it is stopped, 1 means that it is active and -1 means that it is working in reverse mode", "orange", "info")
/obj/item/circuit_component/conveyor_switch/register_usb_parent(atom/movable/parent)
/obj/item/circuit_component/conveyor_switch/register_usb_parent(atom/movable/shell)
. = ..()
if(istype(parent, /obj/machinery/conveyor_switch))
attached_switch = parent
if(istype(shell, /obj/machinery/conveyor_switch))
attached_switch = shell
/obj/item/circuit_component/conveyor_switch/unregister_usb_parent(atom/movable/parent)
/obj/item/circuit_component/conveyor_switch/unregister_usb_parent(atom/movable/shell)
attached_switch = null
return ..()
@@ -8,32 +8,43 @@
*/
/obj/item/circuit_component/delay
display_name = "Delay"
desc = "A component that delays a signal by a specified duration."
desc = "A component that delays a signal by a specified duration. Timer gets reset when triggered again."
/// Amount to delay by
var/datum/port/input/delay_amount
/// Input signal to fire the delay
var/datum/port/input/trigger
/// Interrupts the delay before it fires
var/datum/port/input/interrupt
var/timer_id = TIMER_ID_NULL
/// The output of the signal
var/datum/port/output/output
/obj/item/circuit_component/delay/populate_ports()
delay_amount = add_input_port("Delay", PORT_TYPE_NUMBER, trigger = null)
trigger = add_input_port("Trigger", PORT_TYPE_SIGNAL)
trigger = add_input_port("Trigger", PORT_TYPE_SIGNAL, trigger = .proc/trigger_delay)
interrupt = add_input_port("Interrupt", PORT_TYPE_SIGNAL, trigger = .proc/interrupt_timer)
output = add_output_port("Result", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/delay/input_received(datum/port/input/port)
if(!COMPONENT_TRIGGERED_BY(trigger, port))
return
/obj/item/circuit_component/delay/proc/trigger_delay(datum/port/input/port)
CIRCUIT_TRIGGER
var/delay = delay_amount.value
if(delay > COMP_DELAY_MIN_VALUE)
// Convert delay into deciseconds
addtimer(CALLBACK(output, /datum/port/output.proc/set_output, trigger.value), delay*10)
timer_id = addtimer(CALLBACK(output, /datum/port/output.proc/set_output, trigger.value), delay*10, TIMER_UNIQUE|TIMER_STOPPABLE|TIMER_OVERRIDE)
else
if(timer_id != TIMER_ID_NULL)
deltimer(timer_id)
timer_id = TIMER_ID_NULL
output.set_output(trigger.value)
/obj/item/circuit_component/delay/proc/interrupt_timer(datum/port/input/port)
CIRCUIT_TRIGGER
if(timer_id != TIMER_ID_NULL)
deltimer(timer_id)
timer_id = TIMER_ID_NULL
#undef COMP_DELAY_MIN_VALUE
+14 -2
View File
@@ -325,8 +325,20 @@
for(var/entry in entries)
. += create_ui_notice("Column Name: '[entry]'", "grey", "columns")
/obj/item/circuit_component/proc/register_usb_parent(atom/movable/parent)
/**
* Called when a circuit component is added to an object with a USB port.
*
* Arguments:
* * shell - The object that USB cables can connect to
*/
/obj/item/circuit_component/proc/register_usb_parent(atom/movable/shell)
return
/obj/item/circuit_component/proc/unregister_usb_parent(atom/movable/parent)
/**
* Called when a circuit component is removed from an object with a USB port.
*
* Arguments:
* * shell - The object that USB cables can connect to
*/
/obj/item/circuit_component/proc/unregister_usb_parent(atom/movable/shell)
return
+2 -6
View File
@@ -3,8 +3,6 @@
desc = "A gate able to perform mid-depth scans on any organisms who pass under it."
icon = 'icons/obj/machines/scangate.dmi'
icon_state = "scangate_black"
var/scanline_timer
var/locked = FALSE
/obj/structure/scanner_gate_shell/Initialize()
@@ -34,23 +32,21 @@
/obj/structure/scanner_gate_shell/proc/set_scanline(type, duration)
cut_overlays()
deltimer(scanline_timer)
add_overlay(type)
if(duration)
scanline_timer = addtimer(CALLBACK(src, .proc/set_scanline, "passive"), duration, TIMER_STOPPABLE)
addtimer(CALLBACK(src, .proc/set_scanline, "passive"), duration, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_STOPPABLE)
/obj/item/circuit_component/scanner_gate
display_name = "Scanner Gate"
desc = "A gate able to perform mid-depth scans on any object that pass through it."
circuit_flags = CIRCUIT_FLAG_OUTPUT_SIGNAL
var/datum/port/output/scanned
var/obj/structure/scanner_gate_shell/attached_gate
/obj/item/circuit_component/scanner_gate/populate_ports()
scanned = add_output_port("Scanned Object", PORT_TYPE_ATOM)
trigger_output = add_output_port("Triggered", PORT_TYPE_SIGNAL, order = 2)
/obj/item/circuit_component/scanner_gate/register_shell(atom/movable/shell)
. = ..()
+4 -4
View File
@@ -3845,10 +3845,10 @@
#include "code\modules\wiremod\components\atom\hear.dm"
#include "code\modules\wiremod\components\atom\self.dm"
#include "code\modules\wiremod\components\atom\species.dm"
#include "code\modules\wiremod\components\hud\bar_overlay.dm"
#include "code\modules\wiremod\components\hud\counter_overlay.dm"
#include "code\modules\wiremod\components\hud\object_overlay.dm"
#include "code\modules\wiremod\components\hud\target_intercept.dm"
#include "code\modules\wiremod\components\bci\hud\bar_overlay.dm"
#include "code\modules\wiremod\components\bci\hud\counter_overlay.dm"
#include "code\modules\wiremod\components\bci\hud\object_overlay.dm"
#include "code\modules\wiremod\components\bci\hud\target_intercept.dm"
#include "code\modules\wiremod\components\list\concat.dm"
#include "code\modules\wiremod\components\list\get_column.dm"
#include "code\modules\wiremod\components\list\index.dm"