Skip to main content

connect

source
Expand description

This extremely confusing "connection system" allows the connection between

"engines" and "processes". Basically, a process can "register" itself with any number of "engines".

The "engines" can then iterate through all the connected processes. If a process is destroyed, it will

be removed from all engines. It is okay to connect a process to multiple engines, or even to the same engine

multiple times.



Some example uses:

- a "foreground-engine" has connections to all foreground objects that need to be drawn on each frame.

- when a process wants to change a game setting, it opens a connection to the settings engine to request a change.

when the process is killed (or it stops requesting the change), the setting change is reverted.



A "connection" is really just a function that gets called when the engine runs, or a set of parameters that the engine can iterate through.

Types


connectable

connectable: structuresource
Fields
next0: connectable
prev0: connectable
next1: connectable
prev1: connectable

connection

connection: connectablesource
Fields
next0: connectable
prev0: connectable
next1: connectable
prev1: connectable
param0: basic
param1: basic
param2: int32
param3: int32
quad: uint128
Methods
get-engine(obj: connection) => enginesource

Get the engine for this connection. This must be used on a live connection.

get-process(obj: connection) => processsource

Get the process for this connection

belongs-to-engine?(obj: connection, arg0: engine) => symbolsource

Check to see if this connection is located in the data section of the engine.
This works on dead or alive connections.

belongs-to-process?(obj: connection, arg0: process) => symbolsource

Does this connection belong to the given process?

move-to-dead(obj: connection) => connectionsource

Move this connection from the alive list to the dead list

connection-pers

connection-pers: structuresource
Fields
next: connection-pers
key: object
update-time: time-frame
param: object
param-int32: int32
param-int64: int64
param-float: float
param-quat: uint128

engine

engine: basicsource
Fields
type: type
name: symbol
engine-time: time-frame
allocated-length: int16
length: int16
element-type: type
alive-list: connectable
alive-list-end: connectable
dead-list: connectable
dead-list-end: connectable
data: connection
Methods
inspect-all-connections(obj: engine) => enginesource

inspect all of the connections.

apply-to-connections(obj: engine, arg0: function) => intsource

Apply f to all connections for the engine. It's okay to have f remove the connection.

apply-to-connections-reverse(obj: engine, arg0: function) => intsource

Apply f to all connections, reverse order.
Do not use f to remove yourself from the list.

execute-connections(obj: engine, arg0: object) => intsource

Run the engine!

execute-connections-and-move-to-dead(obj: engine, arg0: object) => intsource

Run the engine! If any objects return 'dead, then remove them

execute-connections-if-needed(obj: engine, arg0: object) => intsource

Execute connections, but only if it hasn't been done on this frame.

add-connection(obj: engine, arg0: process, arg1: object, arg2: object, arg3: object, arg4: object) => connectionsource

Add a connection between this engine and a given process.

remove-from-process(obj: engine, arg0: process) => intsource

Remove all connections from process for this engine

remove-matching(obj: engine, arg0: function) => intsource

call the given function on each connection and the engine.
if it returns truthy, move to dead that connection.

remove-all(obj: engine) => intsource

Remove all connections from an engine

remove-by-param0(obj: engine, arg0: object) => intsource

Remove all connections with param0 matching arg0

remove-by-param1(obj: engine, arg0: int) => intsource

Remove all connections with param1 matching arg0

remove-by-param2(obj: engine, arg0: int) => intsource

Remove all connections with param2 matching arg0

get-first-connectable(obj: engine) => connectablesource
get-last-connectable(obj: engine) => connectablesource
get-next-connectable(obj: engine, arg0: connectable) => connectablesource
get-prev-connectable(obj: engine, arg0: connectable) => connectablesource

engine-pers

engine-pers: basicsource
Fields
type: type
name: symbol
length: int16
allocated-length: int16
element-type: type
execute-time: time-frame
alive-list: connection-pers
dead-list: connection-pers
data: connection-pers
Methods
schedule-callback(obj: engine-pers, arg0: object, arg1: time-frame) => connection-perssource

Get a connection for this key.
If no connection exists, add it.
Schedule an update to happen in arg1 seconds.

kill-callback(obj: engine-pers, arg0: connection-pers) => nonesource

Called when a connection is removed.

kill-by-key(obj: engine-pers, arg0: object) => nonesource

Remove connections with this key, calling kill-callback.

kill-matching(obj: engine-pers, arg0: function, arg1: object, arg2: object) => nonesource

Call the given function on each connection. If it returns truthy, kill that connection.

update-callback(obj: engine-pers) => nonesource

Called when a connection is run.
Users can override this as needed.

run-pending-updates!(obj: engine-pers, arg0: time-frame) => nonesource

Run updates if they scheduled. If something is found that has no pending update, kill it.
Note that we won't kill things on this call if they fail to update their update-time.
They will survive until the next call to run-pending-updates!
(or you can modify their update-time before that to prevent them from being killed)

Functions


connection-process-apply

connection-process-apply(arg0: process, arg1: function) => symbolsource

Apply a function to all connectables of a process.

process-disconnect

process-disconnect(arg0: process) => intsource

Disconnect all connections for the given process.

engines

source

Variables


*background-draw-engine*

*background-draw-engine*: enginesource

*camera-engine*

*camera-engine*: enginesource

*debug-engine*

*debug-engine*: enginesource

*hud-engine*

*hud-engine*: enginesource

*lightning-engine*

*lightning-engine*: enginesource

*matrix-engine*

*matrix-engine*: arraysource

*pad-engine*

*pad-engine*: enginesource

*part-engine*

*part-engine*: enginesource

*task-manager-engine*

*task-manager-engine*: enginesource

MATRIX_ENGINE_AMOUNT

MATRIX_ENGINE_AMOUNT: unknownsource