Files
Bubberstation/code/modules/wiremod/components/utility/clock.dm
SkyratBot 9e74cd4a03 [MIRROR] Input ports now connect to multiple output ports. Remove combiner. (#7505)
* 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>

* Input ports now connect to multiple output ports. Remove combiner.

Co-authored-by: Gurkenglas <gurkenglas@hotmail.de>
Co-authored-by: Watermelon914 <37270891+Watermelon914@ users.noreply.github.com>
2021-08-11 20:27:29 +01:00

58 lines
1.3 KiB
Plaintext

/**
* # Clock Component
*
* Fires every tick of the circuit timer SS
*/
/obj/item/circuit_component/clock
display_name = "Clock"
desc = "A component that repeatedly fires."
/// Whether the clock is on or not
var/datum/port/input/on
/// The signal from this clock component
var/datum/port/output/signal
/obj/item/circuit_component/clock/get_ui_notices()
. = ..()
. += create_ui_notice("Clock Interval: [DisplayTimeText(COMP_CLOCK_DELAY)]", "orange", "clock")
/obj/item/circuit_component/clock/Initialize()
. = ..()
on = add_input_port("On", PORT_TYPE_NUMBER)
signal = add_output_port("Signal", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/clock/input_received(datum/port/input/port)
. = ..()
if(.)
return
if(on.value)
start_process()
else
stop_process()
/obj/item/circuit_component/clock/Destroy()
stop_process()
return ..()
/obj/item/circuit_component/clock/process(delta_time)
signal.set_output(COMPONENT_SIGNAL)
/**
* Adds the component to the SSclock_component process list
*
* Starts ticking to send signals between periods of time
*/
/obj/item/circuit_component/clock/proc/start_process()
START_PROCESSING(SSclock_component, src)
/**
* Removes the component to the SSclock_component process list
*
* Signals stop getting sent.
*/
/obj/item/circuit_component/clock/proc/stop_process()
STOP_PROCESSING(SSclock_component, src)