refactor: decouple game networking from lobby client

* Replace direct client/server networking references with GameClient/GameServer scenes
* Refactor message bus to support local emission and argument expansion
* Move lobby connection lifecycle handling to message bus events
* Remove multiplayer connection wait helpers and direct lobby client coupling
* Rename Server to ServerNetworking and update lobby client references
* Update scene resources and export configuration
This commit is contained in:
2026-08-09 18:41:18 -05:00
parent 50439bc8e0
commit 93a2be399c
20 changed files with 174 additions and 77 deletions

View File

@@ -17,8 +17,31 @@ func start_client(address: String = "127.0.0.1", port: int = 8080) -> void:
multiplayer.server_disconnected.connect(client_disconnected_from_server)
multiplayer.connection_failed.connect(client_connection_failed_to_server)
func _wait_for_connection() -> void:
while not peer:
await get_tree().process_frame
while peer.get_connection_status() != 2:
await get_tree().process_frame
func _wait_close_connection():
close_connection()
while peer:
await get_tree().process_frame
func client_connected_to_server() -> void:
push_warning("Connected to server!")
assert(false, "This method needs to be overridden...")
func client_disconnected_from_server() -> void:
assert(false, "This method needs to be overridden...")
func client_connection_failed_to_server() -> void:
assert(false, "This method needs to be overridden...")
func close_connection() -> void:
if not peer: return
@@ -27,13 +50,6 @@ func close_connection() -> void:
unset_client()
func client_disconnected_from_server() -> void:
push_warning("Disconnected from, server...")
func client_connection_failed_to_server() -> void:
push_warning("Connection failed!")
unset_client()
func unset_client() -> void:
if not peer: return

View File

@@ -1,4 +1,4 @@
class_name Server extends Node
class_name ServerNetworking extends Node
var peer: ENetMultiplayerPeer