mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-26 00:51:23 +00:00
* More circuit components. Restructures the circuit components folder to be more organised. * Mirror! Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Funce <funce.973@gmail.com>
34 lines
717 B
Plaintext
34 lines
717 B
Plaintext
/**
|
|
* # Logic Component
|
|
*
|
|
* General logic unit with AND OR capabilities
|
|
*/
|
|
/obj/item/circuit_component/not
|
|
display_name = "Not"
|
|
|
|
/// The input port
|
|
var/datum/port/input/input_port
|
|
|
|
/// The result from the output
|
|
var/datum/port/output/result
|
|
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
|
|
|
|
/obj/item/circuit_component/not/Initialize()
|
|
. = ..()
|
|
input_port = add_input_port("Input", PORT_TYPE_ANY)
|
|
|
|
result = add_output_port("Result", PORT_TYPE_NUMBER)
|
|
|
|
/obj/item/circuit_component/not/Destroy()
|
|
input_port = null
|
|
result = null
|
|
return ..()
|
|
|
|
/obj/item/circuit_component/not/input_received(datum/port/input/port)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
result.set_output(!input_port.input_value)
|
|
|