[MIRROR] Added circuit component UI details, added multiplexer and allowed inserting components directly into shells. (#6479)

* Added circuit component UI details, added multiplexer and allowed inserting components directly into shells. (#59635)

Adds the multiplexer circuit component - en.wikipedia.org/wiki/Multiplexer
Circuit components can now be directly inserted into shells rather than having to take the integrated circuit out.
Special information can be accessed from components now through the "Info" button besides the eject button on a component.

* Added circuit component UI details, added multiplexer and allowed inserting components directly into shells.

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-06-23 23:50:59 +02:00
committed by GitHub
parent 1a2f4f5d69
commit 5ab9aba9d4
41 changed files with 398 additions and 95 deletions
@@ -6,6 +6,7 @@
*/
/obj/item/circuit_component/arithmetic
display_name = "Arithmetic"
display_desc = "General arithmetic component with arithmetic capabilities."
/// The amount of input ports to have
var/input_port_amount = 4
@@ -15,17 +16,18 @@
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
GLOBAL_LIST_INIT(comp_arithmetic_options, list(
COMP_ARITHMETIC_ADD,
COMP_ARITHMETIC_SUBTRACT,
COMP_ARITHMETIC_MULTIPLY,
COMP_ARITHMETIC_DIVIDE,
COMP_ARITHMETIC_MIN,
COMP_ARITHMETIC_MAX,
))
/obj/item/circuit_component/arithmetic/populate_options()
var/static/component_options = list(
COMP_ARITHMETIC_ADD,
COMP_ARITHMETIC_SUBTRACT,
COMP_ARITHMETIC_MULTIPLY,
COMP_ARITHMETIC_DIVIDE,
COMP_ARITHMETIC_MIN,
COMP_ARITHMETIC_MAX,
)
options = component_options
/obj/item/circuit_component/arithmetic/Initialize()
options = GLOB.comp_arithmetic_options
. = ..()
for(var/port_id in 1 to input_port_amount)
var/letter = ascii2text(text2ascii("A") + (port_id-1))
@@ -5,22 +5,21 @@
*/
/obj/item/circuit_component/compare/comparison
display_name = "Comparison"
display_desc = "A component that compares two objects."
input_port_amount = 2
var/current_type = PORT_TYPE_ANY
GLOBAL_LIST_INIT(comp_comparison_options, list(
COMP_COMPARISON_EQUAL,
COMP_COMPARISON_NOT_EQUAL,
COMP_COMPARISON_GREATER_THAN,
COMP_COMPARISON_LESS_THAN,
COMP_COMPARISON_GREATER_THAN_OR_EQUAL,
COMP_COMPARISON_LESS_THAN_OR_EQUAL
))
/obj/item/circuit_component/compare/comparison/Initialize()
options = GLOB.comp_comparison_options
return ..()
/obj/item/circuit_component/compare/comparison/populate_options()
var/static/component_options = list(
COMP_COMPARISON_EQUAL,
COMP_COMPARISON_NOT_EQUAL,
COMP_COMPARISON_GREATER_THAN,
COMP_COMPARISON_LESS_THAN,
COMP_COMPARISON_GREATER_THAN_OR_EQUAL,
COMP_COMPARISON_LESS_THAN_OR_EQUAL,
)
options = component_options
/obj/item/circuit_component/compare/comparison/input_received(datum/port/input/port)
switch(current_option)
@@ -5,6 +5,7 @@
*/
/obj/item/circuit_component/index
display_name = "Index List"
display_desc = "A component that returns the value of a list at a given index."
/// The input port
var/datum/port/input/list_port
@@ -5,6 +5,7 @@
*/
/obj/item/circuit_component/length
display_name = "Length"
display_desc = "A component that returns the length of its input."
/// The input port
var/datum/port/input/input_port
+8 -10
View File
@@ -5,17 +5,15 @@
*/
/obj/item/circuit_component/compare/logic
display_name = "Logic"
display_desc = "A component with 'and' and 'or' capabilities."
GLOBAL_LIST_INIT(comp_logic_options, list(
COMP_LOGIC_AND,
COMP_LOGIC_OR,
COMP_LOGIC_XOR
))
/obj/item/circuit_component/compare/logic/Initialize()
options = GLOB.comp_logic_options
return ..()
/obj/item/circuit_component/compare/logic/populate_options()
var/static/component_options = list(
COMP_LOGIC_AND,
COMP_LOGIC_OR,
COMP_LOGIC_XOR,
)
options = component_options
/obj/item/circuit_component/compare/logic/do_comparisons(list/ports)
. = FALSE
@@ -5,6 +5,7 @@
*/
/obj/item/circuit_component/not
display_name = "Not"
display_desc = "A component that inverts its input."
/// The input port
var/datum/port/input/input_port
@@ -5,6 +5,7 @@
*/
/obj/item/circuit_component/random
display_name = "Random"
display_desc = "A component that returns random values."
/// The minimum value that the random number can be
var/datum/port/input/minimum