Files
lobby-server/scenes/data_bridge/game_state.gd

24 lines
604 B
GDScript3
Raw Normal View History

2026-08-07 03:02:53 -05:00
class_name GameState extends Node
func _init() -> void:
Globals.game_state = self
func set_game_scene(scene_str: String) -> void:
# NOTE: 'node_pth_str' needs to match game node structure else server sync throws errors.
var node_pth_str = "billiards/scene"
var scene = load(scene_str).instantiate()
var target = get_tree().root.get_node(node_pth_str)
scene.name = "lobby_screen"
clear_game_scene(target)
target.add_child(scene)
func clear_game_scene(container: Node) -> void:
for child in container.get_children():
child.queue_free()
await get_tree().process_frame