/tg/ Station 13 - Modules - TypesVar Details - Proc Details

Integrated Circuit Component

A component that performs a function when given an input

Can be attached to an integrated circuitboard, where it can then be connected between other components to provide an output or to receive an input. This is the base type of all components

Vars

circuit_flagsThe flags of the circuit to control basic generalised behaviour.
display_nameThe name of the component shown on the UI
input_portsA list that contains the components the input ports on this component Used to connect between the ports
output_portsA list that contains the outpurt ports on this component Used to connect between the ports
parentThe integrated_circuit that this component is attached to.
power_usage_per_inputThe power usage whenever this component receives an input
rel_xUsed to determine the x position of the component within the UI
rel_yUsed to determine the y position of the component within the UI
trigger_inputGeneric trigger input for triggering this component
ui_colorThe colour this circuit component appears in the UI

Procs

add_input_portAdds an input port and returns it
add_option_portExtension of add_input_port. Simplifies the code to make an option port to reduce boilerplate
add_output_portAdds an output port and returns it
add_toCalled when this component is about to be added to an integrated_circuit.
create_table_noticesCreates a table UI notice entry to be used in get_ui_notices()
create_ui_noticeCreates a UI notice entry to be used in get_ui_notices()
disconnectDisconnects a component from other components
get_ui_noticesGets the UI notices to be displayed on the CircuitInfo panel.
input_receivedCalled from trigger_component. General component behaviour should go in this proc. This is the default proc that is called if no trigger proc is specified.
load_data_from_listLoads data from a list
populate_optionsCalled when the option ports should be set up
populate_portsCalled when the rest of the ports should be set up
pre_input_receivedCalled before input_received and should_receive_input. Used to perform behaviour that shouldn't care whether the input should be received or not.
register_shellCalled when a shell is registered from the component/the component is added to a circuit.
register_usb_parentCalled when a circuit component is added to an object with a USB port.
remove_input_portRemoves an input port and deletes it. This will not cleanup any references made by derivatives of the circuit component
remove_output_portRemoves an output port and deletes it. This will not cleanup any references made by derivatives of the circuit component
removed_fromCalled when this component is removed from an integrated_circuit.
save_data_to_listSaves data to a list. Shouldn't be used unless you are quite literally saving the data of a component to a list. Input value is the list to save the data to
should_receive_inputCalled whether this circuit component should receive an input. If this returns false, the proc that is supposed to be triggered will not be called and an output signal will not be sent. This is to only return false if flow of execution should be stopped because something bad has happened (e.g. no power) Returning no value in input_received() is not an issue because it means flow of execution will continue even if the component failed to execute properly.
trigger_componentCalled whenever an input is received from one of the ports.
unregister_shellCalled when a shell is unregistered from the component/the component is removed from a circuit.
unregister_usb_parentCalled when a circuit component is removed from an object with a USB port.

Var Details

circuit_flags

The flags of the circuit to control basic generalised behaviour.

display_name

The name of the component shown on the UI

input_ports

A list that contains the components the input ports on this component Used to connect between the ports

output_ports

A list that contains the outpurt ports on this component Used to connect between the ports

parent

The integrated_circuit that this component is attached to.

power_usage_per_input

The power usage whenever this component receives an input

rel_x

Used to determine the x position of the component within the UI

rel_y

Used to determine the y position of the component within the UI

trigger_input

Generic trigger input for triggering this component

ui_color

The colour this circuit component appears in the UI

Proc Details

add_input_port

Adds an input port and returns it

Arguments:

add_option_port

Extension of add_input_port. Simplifies the code to make an option port to reduce boilerplate

add_output_port

Adds an output port and returns it

Arguments:

add_to

Called when this component is about to be added to an integrated_circuit.

create_table_notices

Creates a table UI notice entry to be used in get_ui_notices()

Returns a list that can then be added to the return list in get_ui_notices() Used by components to list their available columns. Recommended to use at the end of get_ui_notices()

create_ui_notice

Creates a UI notice entry to be used in get_ui_notices()

Returns a list that can then be added to the return list in get_ui_notices()

disconnect

Disconnects a component from other components

Disconnects both the input and output ports of the component

get_ui_notices

Gets the UI notices to be displayed on the CircuitInfo panel.

Returns a list of buttons in the following format list( "icon" = ICON(string) "content" = CONTENT(string) "color" = COLOR(string, not a hex) )

input_received

Called from trigger_component. General component behaviour should go in this proc. This is the default proc that is called if no trigger proc is specified.

Return value indicates that the circuit should not send an output signal. Arguments:

load_data_from_list

Loads data from a list

populate_options

Called when the option ports should be set up

populate_ports

Called when the rest of the ports should be set up

pre_input_received

Called before input_received and should_receive_input. Used to perform behaviour that shouldn't care whether the input should be received or not.

register_shell

Called when a shell is registered from the component/the component is added to a circuit.

Register all signals here on the shell. Arguments:

register_usb_parent

Called when a circuit component is added to an object with a USB port.

Arguments:

remove_input_port

Removes an input port and deletes it. This will not cleanup any references made by derivatives of the circuit component

Arguments:

remove_output_port

Removes an output port and deletes it. This will not cleanup any references made by derivatives of the circuit component

Arguments:

removed_from

Called when this component is removed from an integrated_circuit.

save_data_to_list

Saves data to a list. Shouldn't be used unless you are quite literally saving the data of a component to a list. Input value is the list to save the data to

should_receive_input

Called whether this circuit component should receive an input. If this returns false, the proc that is supposed to be triggered will not be called and an output signal will not be sent. This is to only return false if flow of execution should be stopped because something bad has happened (e.g. no power) Returning no value in input_received() is not an issue because it means flow of execution will continue even if the component failed to execute properly.

Return value indicates whether or not Arguments:

trigger_component

Called whenever an input is received from one of the ports.

Return value indicates whether the trigger was successful or not. Arguments:

unregister_shell

Called when a shell is unregistered from the component/the component is removed from a circuit.

Unregister all signals here on the shell. Arguments:

unregister_usb_parent

Called when a circuit component is removed from an object with a USB port.

Arguments: