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 | |
category | The category of the component in the UI |
---|---|
circuit_flags | The flags of the circuit to control basic generalised behaviour. |
circuit_size | Determines the amount of space this circuit occupies in an integrated circuit. |
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 |
removable | Whether the component is removable or not. Only affects user UI |
required_shells | Defines which shells support this component. Only used as an informational guide, does not restrict placing these components in circuits. |
trigger_input | Generic trigger input for triggering this component |
ui_buttons | The UI buttons of this circuit component. An assoc list that has this format: "button_icon" = "action_name" |
ui_color | The colour this circuit component appears in the UI |
Procs | |
add_input_port | Adds an input port and returns it |
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 |
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() |
create_ui_notice | Creates a UI notice entry to be used in get_ui_notices() |
disconnect | Disconnects a component from other components |
get_location | Called when trying to get the physical location of this object |
get_ui_notices | Gets the UI notices to be displayed on the CircuitInfo panel. |
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. |
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_usb_parent | Called when a circuit component is added to an object with a USB port. |
remove_input_port | Removes an input port and deletes it. This will not cleanup any references made by derivatives of the circuit component |
remove_output_port | Removes an output port and deletes it. This will not cleanup any references made by derivatives of the circuit component |
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. |
trigger_component | Called whenever an input is received from one of the ports. |
ui_perform_action | Called when a special button is pressed on this component in the UI. |
unregister_shell | Called when a shell is unregistered from the component/the component is removed from a circuit. |
unregister_usb_parent | Called when a circuit component is removed from an object with a USB port. |
Var Details
category
The category of the component in the UI
circuit_flags
The flags of the circuit to control basic generalised behaviour.
circuit_size
Determines the amount of space this circuit occupies in an integrated circuit.
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
removable
Whether the component is removable or not. Only affects user UI
required_shells
Defines which shells support this component. Only used as an informational guide, does not restrict placing these components in circuits.
trigger_input
Generic trigger input for triggering this component
ui_buttons
The UI buttons of this circuit component. An assoc list that has this format: "button_icon" = "action_name"
ui_color
The colour this circuit component appears in the UI
Proc Details
add_input_port
Adds an input port and returns it
Arguments:
- name - The name of the input port
- type - The datatype it handles
- trigger - Whether this input port triggers an update on the component when updated.
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:
- name - The name of the output port
- type - The datatype it handles.
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_location
Called when trying to get the physical location of this object
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:
- port - Can be null. The port that sent the input
- return_values - Only defined if the component is receiving an input due to instant execution. Contains the values to be returned once execution has stopped.
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:
- shell - Shell being registered
register_usb_parent
Called when a circuit component is added to an object with a USB port.
Arguments:
- shell - The object that USB cables can connect to
remove_input_port
Removes an input port and deletes it. This will not cleanup any references made by derivatives of the circuit component
Arguments:
- input_port - The input port to remove.
remove_output_port
Removes an output port and deletes it. This will not cleanup any references made by derivatives of the circuit component
Arguments:
- output_port - The output port to remove.
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:
- port - Can be null. The port that sent the input
trigger_component
Called whenever an input is received from one of the ports.
Return value indicates whether the trigger was successful or not. Arguments:
- port - Can be null. The port that sent the input
- return_values - Only defined if the component is receiving an input due to instant execution. Contains the values to be returned once execution has stopped.
ui_perform_action
Called when a special button is pressed on this component in the UI.
Arguments:
- user - Interacting mob
- action - A string for which action is being performed. No parameters passed because it's only a button press.
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:
- shell - Shell being unregistered
unregister_usb_parent
Called when a circuit component is removed from an object with a USB port.
Arguments:
- shell - The object that USB cables can connect to