mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Created a basic Lobby system, to further test networking features
This commit is contained in:
@ -19,7 +19,7 @@ func _ready():
|
||||
|
||||
func _connect_to_server():
|
||||
get_tree().connect("connected_to_server", self, "_connected_ok")
|
||||
network.create_client(DEFAULT_IP, DEFAULT_PORT)
|
||||
network.create_client(selected_IP, selected_port)
|
||||
get_tree().set_network_peer(network)
|
||||
|
||||
func _player_connected(id):
|
||||
@ -30,9 +30,22 @@ func _player_disconnected(id):
|
||||
|
||||
func _connected_ok():
|
||||
print("Successfully connected to server")
|
||||
register_player()
|
||||
rpc_id(1, "send_player_info", local_player_id, player_data)
|
||||
|
||||
func _connected_fail():
|
||||
print("Failed to connect")
|
||||
|
||||
func _server_disconnected():
|
||||
print("Server Disconnected")
|
||||
|
||||
|
||||
func register_player():
|
||||
local_player_id = get_tree().get_network_unique_id()
|
||||
player_data = Save.save_data
|
||||
players[local_player_id] = player_data
|
||||
|
||||
|
||||
sync func update_waiting_room():
|
||||
get_tree().call_group("WaitingRoom", "refresh_players", players)
|
||||
|
||||
|
Reference in New Issue
Block a user