mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-02-08 23:39:32 +00:00
Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com> Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Co-authored-by: ATH1909 <42606352+ATH1909@users.noreply.github.com> Co-authored-by: Maurukas <66576896+Maurukas@users.noreply.github.com>
34 lines
720 B
Plaintext
34 lines
720 B
Plaintext
/**
|
|
* # Length Component
|
|
*
|
|
* Return the length of an input
|
|
*/
|
|
/obj/item/circuit_component/length
|
|
display_name = "Length"
|
|
|
|
/// The input port
|
|
var/datum/port/input/input_port
|
|
|
|
/// The result from the output
|
|
var/datum/port/output/output
|
|
has_trigger = TRUE
|
|
|
|
/obj/item/circuit_component/length/Initialize()
|
|
. = ..()
|
|
input_port = add_input_port("Input", PORT_TYPE_ANY)
|
|
|
|
output = add_output_port("Length", PORT_TYPE_NUMBER)
|
|
|
|
/obj/item/circuit_component/length/Destroy()
|
|
input_port = null
|
|
output = null
|
|
return ..()
|
|
|
|
/obj/item/circuit_component/length/input_received(datum/port/input/port)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
output.set_output(length(input_port.input_value))
|
|
trigger_output.set_output(COMPONENT_SIGNAL)
|