class_name DeckNode var name: String var input_ports: Array[Port] var output_ports: Array[Port] var outgoing_connections: Dictionary var _belonging_to: Deck var _id: String func add_input_port(type: Deck.Types, label: String, descriptor: String = "") -> void: var port := Port.new(type, label, descriptor) input_ports.append(port) func add_output_port(type: Deck.Types, label: String, descriptor: String = "") -> void: var port := Port.new(type, label, descriptor) output_ports.append(port) func send(from_port: int, data: DeckType, extra_data: Array = []) -> void: if outgoing_connections.get(from_port) == null: return for connection in outgoing_connections[from_port]: connection = connection as Dictionary # key is node uuid # value is input port on destination node for node in connection: _belonging_to.get_node(node)._receive(connection[node], data, extra_data) func _receive(to_port: int, data: DeckType, extra_data: Array = []) -> void: pass func add_outgoing_connection(from_port: int, to_node: String, to_port: int) -> void: var port_connections: Array = outgoing_connections.get(from_port, []) port_connections.append({to_node: to_port}) outgoing_connections[from_port] = port_connections