Refactor to fit game-shell structure; externalized lobby client code

This commit is contained in:
2026-08-23 12:55:53 -05:00
parent 2a99880a98
commit 9a067711c7
24 changed files with 81 additions and 625 deletions

View File

@@ -18,13 +18,19 @@ func _init() -> void:
func load_game_scene(scene_str: String) -> void:
var scene = load(scene_str).instantiate()
var target = get_tree().root.get_node("billiards/scene")
var target = get_tree().root.get_node_or_null("shell/scene")
if not target:
target = get_tree().root.get_node("game_core/scene")
target.add_child(scene)
func set_game_scene(scene_str: String) -> void:
var scene = load(scene_str).instantiate()
var target = get_tree().root.get_node("billiards/scene")
var scene = load(scene_str).instantiate()
var target = get_tree().root.get_node_or_null("shell/scene")
if not target:
target = get_tree().root.get_node("game_core/scene")
if "game" in scene_str:
scene.name = "game"

View File

@@ -1,31 +0,0 @@
class_name LobbyData extends Node
func _init() -> void:
Globals.lobby_data = self
@rpc("authority", "reliable")
func connect_to_game() -> void:
# NOTE: Leave the lobby
MessageBus.emit_local("lobby_close_connection", null)
# NOTE: Join target game server
MessageBus.emit_local(
"game_start_client",
[
Globals.game_data.game_address,
Globals.game_data.game_port
],
true
)
@rpc("authority", "reliable")
func go_back_to_match_screen() -> void:
if multiplayer.is_server(): return
push_warning("Client peer disconnected...")
Globals.game_state.set_game_scene(
"res://scenes/screens/lobby_screen/lobby.tscn"
)

View File

@@ -1 +0,0 @@
uid://6sfwe1hwgf0g

View File

@@ -11,7 +11,7 @@ func _init() -> void:
Globals.multiplayer_data = self
multiplayer_synchronizer.name = "multiplayer_synchronizer"
multiplayer_synchronizer.replication_config = synchronizer_config
multiplayer_synchronizer.root_path = "/root/billiards"
multiplayer_synchronizer.root_path = "/root/shell"
@rpc("authority", "call_local", "reliable")
func set_multiplayer_active() -> void:
@@ -33,7 +33,7 @@ func reset() -> void:
is_multiplayer_active = true
multiplayer_synchronizer.name = "multiplayer_synchronizer"
multiplayer_synchronizer.replication_config = synchronizer_config
multiplayer_synchronizer.root_path = "/root/billiards"
multiplayer_synchronizer.root_path = "/root/game_core"
func init_match() -> void:
var match_entry = Dictionary()