Delete a Child from a Node and adding to another closes all signal connections between them?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sirrandoom

The Title pretty much says everything, but let me explain in better detail. I have players with cards in a node called Hand, eventually in the game I need the last player to show the first player his cards, and first player select a few to exchange with last player. But the cards in the hands have signals connected to the players (to know when the player selected such card)

In order to do so, I get the players Hand, remove it from the player and set on the Table tree adding it in a hand_placeholder node (in a way only the trading players can see the cards in an internet multiplayer environment).

Do I need to rewire the cards’ signals with the player, or better asking, is it possible to rewire the cards with the players since they are not in their tree path anymore?

:bust_in_silhouette: Reply From: njamster

If by “deleting” you mean using remove_child and then add it somewhere else with add_child: no, existing connections won’t be closed. You have to take care of that yourself using is_connected and disconnect.

If by “deleting” you mean using queue_free or freeand then add a new instance of it somewhere else with load("<ScenePath>").instance() then the new instance will only hold connections created in the scenes script.