extends Control signal join_lobby(addr: String, port: int) @rpc("reliable", "authority", "call_local") func add(port: int): var lobby_button := preload("res://server/lobby_list_entry.tscn").instantiate() var addr := "127.0.0.1" if not multiplayer.is_server(): var peer := (multiplayer.multiplayer_peer as ENetMultiplayerPeer).get_peer(1) addr = peer.get_remote_address() lobby_button.address = addr lobby_button.port = port $Lobbies.add_child(lobby_button, true) lobby_button.pressed.connect(emit_join_lobby.bind(addr, port)) func emit_join_lobby(addr: String, port: int): join_lobby.emit(addr, port) func lobbies(): return $Lobbies.get_children()