Files
Billiards/scenes/data/lobby_data.gd

32 lines
674 B
GDScript3
Raw Normal View History

2026-08-07 02:50:54 -05:00
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)
2026-08-07 02:50:54 -05:00
# NOTE: Join target game server
MessageBus.emit_local(
"game_start_client",
[
Globals.game_data.game_address,
Globals.game_data.game_port
],
true
2026-08-07 02:50:54 -05:00
)
@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"
)