diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-07-08 18:54:22 +0200 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-07-08 18:54:22 +0200 |
| commit | b0d43c7e78e8cf706b257e3931c3fca126ef3814 (patch) | |
| tree | 573517f5d185e56371af992fd78260c3db67cc21 /client/menu/lobby.gd | |
| parent | 5e50f6e05b4503be23fd17819ed612db1c45cf04 (diff) | |
| parent | fbf9286b3b4c7791a49d8546204ea5bf28e1b4db (diff) | |
| download | hurrycurry-b0d43c7e78e8cf706b257e3931c3fca126ef3814.tar hurrycurry-b0d43c7e78e8cf706b257e3931c3fca126ef3814.tar.bz2 hurrycurry-b0d43c7e78e8cf706b257e3931c3fca126ef3814.tar.zst | |
Merge branch 'master' of https://codeberg.org/metamuffin/hurrycurry
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() |