Bugfixes + Menu.

This commit is contained in:
Patrick 2024-12-12 15:23:16 +01:00
parent 1ee6f6cc6d
commit 26ee79c57d
6 changed files with 94 additions and 21 deletions

View file

@ -54,8 +54,9 @@ func _ready() -> void:
match launchmode:
0:
# Will eventually redirect to the main menu
pass
# Menu
if get_tree().change_scene_to_file("res://scenes/ui/create_room.tscn") != OK:
Log.error("Couldn't change to the create room scene! Closing application.", "Couldn't change to the create room scene!")
1:
# Client with direct join
Networking.join_room()

View file

@ -9,16 +9,16 @@ signal playerlist_changed()
# Connect the signals.
func _ready() -> void:
if multiplayer.connected_to_server.connect(_on_connected_ok) != OK:
Log.error("FAILED to connect the connected_to_server signal to _on_connected_ok!", "Internal Error: Failed to connect signal.")
if multiplayer.connection_failed.connect(close_network) != OK:
Log.error("FAILED to connect the connection_failed signal to _on_connected_fail!", "Internal Error: Failed to connect signal.")
if multiplayer.server_disconnected.connect(close_network) != OK:
Log.error("FAILED to connect the server_disconnected signal to _on_server_disconnected!", "Internal Error: Failed to connect signal.")
if multiplayer.peer_disconnected.connect(_on_peer_disconnected) != OK:
Log.error("FAILED to connect the peer_disconnected signal to _on_peer_disconnected!", "Internal Error: Failed to connect signal.")
if playerlist_changed.connect(_on_playerlist_changed) != OK:
Log.error("FAILED to connect the playerlist_changed signal to _on_playerlist_changed!", "Internal Error: Failed to connect signal.")
if multiplayer.connected_to_server.connect(_on_connected_ok):
pass
if multiplayer.connection_failed.connect(close_network):
pass
if multiplayer.server_disconnected.connect(close_network):
pass
if multiplayer.peer_disconnected.connect(_on_peer_disconnected):
pass
if playerlist_changed.connect(_on_playerlist_changed):
pass
func _on_playerlist_changed() -> void:
pass
@ -139,8 +139,7 @@ func host_disconnected_message() -> void:
Log.info("Host disconnected from the session.")
managerID = 1
close_network()
if get_tree().change_scene_to_file("res://start.tscn"):
Log.warning("Failed to change back to the main scene!")
Game._ready()
# This is the message sent out if a peer in the room has left.
@rpc("authority", "call_remote", "reliable")