Trying to add multiplayer again
This commit is contained in:
@ -39,8 +39,7 @@ func _on_host_pressed() -> void:
|
||||
|
||||
players[1] = player_info
|
||||
player_connected.emit(1, player_info)
|
||||
game_server_manager.add_player(1, "host")
|
||||
|
||||
GameServerManager.players[1] = {"id": "1", "name": "host"}
|
||||
func remove_multiplayer_peer():
|
||||
multiplayer.multiplayer_peer = null
|
||||
|
||||
@ -66,8 +65,12 @@ func _on_join_pressed() -> void:
|
||||
if error:
|
||||
print(error)
|
||||
multiplayer.multiplayer_peer = peer
|
||||
|
||||
add_player.rpc_id(1, multiplayer.get_unique_id(), "guest")
|
||||
|
||||
@rpc("call_remote")
|
||||
func add_player(id: int, name: String):
|
||||
if not GameServerManager.players.has(id):
|
||||
GameServerManager.players[1] = {"id": str(id), "name": name}
|
||||
|
||||
func _on_player_connected(id: Variant, player_info: Variant) -> void:
|
||||
print(player_info)
|
||||
|
Reference in New Issue
Block a user