test disconnections but 2

This commit is contained in:
Lera Elvoé 2023-06-13 16:06:17 +03:00
parent a5acd3a1c3
commit 83d5fae1bd
No known key found for this signature in database

View file

@ -32,6 +32,7 @@ func _ready() -> void:
)
connection_request.connect(attempt_connection)
disconnection_request.connect(attempt_disconnect)
func attempt_connection(from_node_name: StringName, from_port: int, to_node_name: StringName, to_port: int) -> void:
@ -43,3 +44,15 @@ func attempt_connection(from_node_name: StringName, from_port: int, to_node_name
if deck.connect_nodes(from_node, to_node, from_output, to_input):
connect_node(from_node_name, from_port, to_node_name, to_port)
func attempt_disconnect(from_node_name: StringName, from_port: int, to_node_name: StringName, to_port: int) -> void:
var from_node: DeckNode = get_node(NodePath(from_node_name)).node
var to_node: DeckNode = get_node(NodePath(to_node_name)).node
var from_output := from_node.get_global_port_idx_from_output(from_port)
var to_input := to_node.get_global_port_idx_from_input(to_port)
deck.disconnect_nodes(from_node, to_node, from_output, to_input)
disconnect_node(from_node_name, from_port, to_node_name, to_port)