diff options
Diffstat (limited to 'client/menu/lobby.gd')
-rw-r--r-- | client/menu/lobby.gd | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/client/menu/lobby.gd b/client/menu/lobby.gd index 6e315a19..a31b38e9 100644 --- a/client/menu/lobby.gd +++ b/client/menu/lobby.gd @@ -20,8 +20,6 @@ const PLAYER = preload("res://menu/lobby/player.tscn") var selected_map := 0 var selected_map_name: String -var joined := false -var join_sent := false @onready var game: Game = $"../Game" @onready var map_count = game.map_names.size() @@ -38,6 +36,7 @@ func _ready(): initialize() game.data_updated.connect(initialize) game.joined.connect(_on_game_joined) + game.left.connect(_on_game_left) func initialize(): map_count = game.map_names.size() @@ -60,7 +59,7 @@ func update_players(player_list: Dictionary): player_container.add_child(p) p.setup(player_list[i].username) -func _input(event): +func _input(_event): if not visible: return @@ -73,7 +72,10 @@ func _on_game_joined(): map_selector.show() start_button.text = tr("Start Game") start_button.disabled = false - joined = true + +func _on_game_left(): + map_selector.hide() + start_button.text = tr("Join Game") func _on_left_pressed(): selected_map = (selected_map - 1) % map_count @@ -84,10 +86,9 @@ func _on_right_pressed(): select_map(selected_map) func _on_controller_button_pressed(): - if joined: + if game.is_joined: if selected_map_name != null: game.mp.send_chat("/start %s" % selected_map_name) - elif not join_sent: - join_sent = true + elif not game.join_sent: start_button.disabled = true game.join() |