diff --git a/classes/deck/deck.gd b/classes/deck/deck.gd index f32ef42..b2bd3f9 100644 --- a/classes/deck/deck.gd +++ b/classes/deck/deck.gd @@ -22,7 +22,6 @@ static var type_assoc: Dictionary = { } - func add_node(node: GDScript, meta: Dictionary = {}) -> DeckNode: # TODO: accept instances of DeckNode instead of instancing here? var uuid := UUID.v4() @@ -44,9 +43,9 @@ func get_node(uuid: String) -> DeckNode: func connect_nodes(from_node: DeckNode, to_node: DeckNode, from_port: int, to_port: int) -> bool: # first, check that we can do the type conversion. - var type_a: Types = from_node.input_ports[from_port].type - var type_b: Types = to_node.output_ports[to_port].type - var err: DeckType = (type_assoc[type_b] as GDScript).from(type_assoc[type_a]) + var type_a: Types = from_node.output_ports[from_port].type + var type_b: Types = to_node.input_ports[to_port].type + var err: DeckType = (type_assoc[type_b]).from(type_assoc[type_a].new()) if err is DeckType.DeckTypeError: print(err.error_message) return false diff --git a/classes/deck/deck_node.gd b/classes/deck/deck_node.gd index 62f0ab6..73b97bf 100644 --- a/classes/deck/deck_node.gd +++ b/classes/deck/deck_node.gd @@ -20,7 +20,7 @@ func add_output_port(type: Deck.Types, label: String, descriptor: String = "") - func send(from_port: int, data: DeckType, extra_data: Array = []) -> void: - if !(outgoing_connections.get(from_port)): + if outgoing_connections.get(from_port) == null: return for connection in outgoing_connections[from_port]: