Input ports now connect to multiple output ports. Remove combiner. (#60494)

* tgui bsod

* debug disconnections

* prelim

* recomment

* set_value -> put ._.

* DAMN IT

* reinsert subsystem

* prepare

* unditch signals

* remove combiner

* remove combiner some more

* how did router.dm get here? deleting.

* These two COMSIGS should be one.

* critical typo

* inline cast

* have your signals

* Have your set_input & set_output.

* make compile

* upgrade save/load to n-to-n-wires

* have your documentation

* have your unsafe proc

* pay no attention to the compile errors

* unlist the ref

* paste my for block back in ._.

* fix manual input

* oops pushed too soon

* Have your !port.connected_to?.length

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
This commit is contained in:
Gurkenglas
2021-08-11 18:48:29 +03:00
committed by GitHub
co-authored by Watermelon914
parent e64b101750
commit e0fad671fd
66 changed files with 280 additions and 386 deletions
@@ -28,7 +28,7 @@
if(.)
return
if(on.input_value)
if(on.value)
start_process()
else
stop_process()
@@ -1,48 +0,0 @@
/**
* # Combiner Component
*
* Combines multiple inputs into 1 output port.
*/
/obj/item/circuit_component/combiner
display_name = "Combiner"
desc = "A component that combines multiple inputs to provide 1 output."
/// The amount of input ports to have
var/input_port_amount = 4
var/datum/port/input/option/combiner_options
var/datum/port/output/output_port
var/list/combiner_ports = list()
var/current_type
/obj/item/circuit_component/combiner/populate_options()
var/static/component_options = list(
PORT_TYPE_ANY,
PORT_TYPE_STRING,
PORT_TYPE_NUMBER,
PORT_TYPE_LIST,
PORT_TYPE_ATOM,
PORT_TYPE_SIGNAL,
)
combiner_options = add_option_port("Combiner Options", component_options)
/obj/item/circuit_component/combiner/Initialize()
. = ..()
current_type = combiner_options.input_value
for(var/port_id in 1 to input_port_amount)
var/letter = ascii2text(text2ascii("A") + (port_id-1))
combiner_ports += add_input_port(letter, current_type)
output_port = add_output_port("Output", current_type)
/obj/item/circuit_component/combiner/input_received(datum/port/input/port)
. = ..()
if(current_type != combiner_options.input_value)
current_type = combiner_options.input_value
for(var/datum/port/input/input_port as anything in combiner_ports)
input_port.set_datatype(current_type)
output_port.set_datatype(current_type)
if(. || !port)
return TRUE
output_port.set_output(port.input_value)
@@ -33,11 +33,11 @@
if(!COMPONENT_TRIGGERED_BY(trigger, port))
return
var/delay = delay_amount.input_value
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.input_value), delay*10)
addtimer(CALLBACK(output, /datum/port/output.proc/set_output, trigger.value), delay*10)
else
output.set_output(trigger.input_value)
output.set_output(trigger.value)
#undef COMP_DELAY_MIN_VALUE
@@ -52,8 +52,8 @@
/obj/item/circuit_component/ram/input_received(datum/port/input/port)
. = ..()
if(current_type != ram_options.input_value)
current_type = ram_options.input_value
if(current_type != ram_options.value)
current_type = ram_options.value
input_port.set_datatype(current_type)
output.set_datatype(current_type)
@@ -67,6 +67,6 @@
if(!COMPONENT_TRIGGERED_BY(trigger, port))
return TRUE
var/input_val = input_port.input_value
var/input_val = input_port.value
output.set_output(input_val)
@@ -37,7 +37,7 @@
/obj/item/circuit_component/router/Initialize()
. = ..()
current_type = router_options.input_value
current_type = router_options.value
if(input_port_amount > 1)
input_selector = add_input_port("Input Selector", PORT_TYPE_NUMBER, default = 1)
if(output_port_amount > 1)
@@ -63,7 +63,7 @@
#define WRAPACCESS(L, I) L[(((I||1)-1)%length(L)+length(L))%length(L)+1]
/obj/item/circuit_component/router/input_received(datum/port/input/port)
. = ..()
var/current_option = router_options.input_value
var/current_option = router_options.value
if(current_type != current_option)
current_type = current_option
for(var/datum/port/input/input as anything in ins)
@@ -72,9 +72,9 @@
output.set_datatype(current_type)
if(.)
return
var/datum/port/input/input = WRAPACCESS(ins, input_selector ? input_selector.input_value : 1)
var/datum/port/output/output = WRAPACCESS(outs, output_selector ? output_selector.input_value : 1)
output.set_output(input.input_value)
var/datum/port/input/input = WRAPACCESS(ins, input_selector ? input_selector.value : 1)
var/datum/port/output/output = WRAPACCESS(outs, output_selector ? output_selector.value : 1)
output.set_output(input.value)
/obj/item/circuit_component/router/multiplexer
display_name = "Multiplexer"
@@ -18,7 +18,7 @@
/obj/item/circuit_component/typecast/Initialize()
. = ..()
current_type = typecast_options.input_value
current_type = typecast_options.value
input_value = add_input_port("Input", PORT_TYPE_ANY)
output_value = add_output_port("Output", current_type)
@@ -33,7 +33,7 @@
/obj/item/circuit_component/typecast/input_received(datum/port/input/port)
. = ..()
var/current_option = typecast_options.input_value
var/current_option = typecast_options.value
if(current_type != current_option)
current_type = current_option
output_value.set_datatype(current_type)
@@ -41,7 +41,7 @@
if(.)
return
var/value = input_value.input_value
var/value = input_value.value
var/value_to_set = null
switch(current_option)
if(PORT_TYPE_STRING)
@@ -31,8 +31,8 @@
// We're only comparing the first port/value. There shouldn't be any more.
var/datum/port/input/input_port = ports[1]
var/input_val = input_port.input_value
switch(typecheck_options.input_value)
var/input_val = input_port.value
switch(typecheck_options.value)
if(PORT_TYPE_STRING)
return istext(input_val)
if(PORT_TYPE_NUMBER)