aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-07-07 19:18:13 +0200
committertpart <tpart120@proton.me>2024-07-07 19:18:13 +0200
commit9bc74b3a9e2fef5f9ab278e4d0c4c9c1cc5b1f12 (patch)
tree246606d32287c4a7ba440e56b7ee9b5c75346470
parentfaf2c3c45f4a27769662c923f34672e7dfd7254d (diff)
downloadhurrycurry-9bc74b3a9e2fef5f9ab278e4d0c4c9c1cc5b1f12.tar
hurrycurry-9bc74b3a9e2fef5f9ab278e4d0c4c9c1cc5b1f12.tar.bz2
hurrycurry-9bc74b3a9e2fef5f9ab278e4d0c4c9c1cc5b1f12.tar.zst
Add cancel game button
-rw-r--r--client/game.gd4
-rw-r--r--client/menu/ingame.gd7
-rw-r--r--client/menu/ingame.tscn6
3 files changed, 16 insertions, 1 deletions
diff --git a/client/game.gd b/client/game.gd
index 97460c01..0bbc4ab0 100644
--- a/client/game.gd
+++ b/client/game.gd
@@ -29,6 +29,7 @@ var tile_index_by_name: Dictionary = {}
var tile_collide: Array = []
var tile_interact: Array = []
var map_names: Array = []
+var in_lobby := false
var marker_target = Vector3(0,0,0)
var players := {}
@@ -206,7 +207,8 @@ func _ready():
mp.send_join(Global.profile["username"], Global.profile["character"])
- mp.set_ingame.connect(func (state, _lobby):
+ mp.set_ingame.connect(func (state, in_lobby_):
+ in_lobby = in_lobby_
if state:
map.gi_bake()
await get_parent().menu_anim_open()
diff --git a/client/menu/ingame.gd b/client/menu/ingame.gd
index f8d4d144..e6ec7c54 100644
--- a/client/menu/ingame.gd
+++ b/client/menu/ingame.gd
@@ -2,10 +2,13 @@ extends Menu
@onready var anim = $AnimationPlayer
@onready var options = $Side/Margin/Options
+@onready var game: Game = $"../Game"
+@onready var lobby_button: Button = $Side/Margin/Options/Lobby
var opened
func _ready():
opened = Time.get_ticks_msec()
+ lobby_button.disabled = game.in_lobby
super()
func anim_setup(): pass
@@ -32,3 +35,7 @@ func _on_reconnect_pressed():
func _on_quit_pressed():
quit()
+
+func _on_lobby_pressed():
+ game.mp.send_chat("/end")
+ exit()
diff --git a/client/menu/ingame.tscn b/client/menu/ingame.tscn
index f704f348..0ed86884 100644
--- a/client/menu/ingame.tscn
+++ b/client/menu/ingame.tscn
@@ -102,6 +102,11 @@ layout_mode = 2
text = "Resume"
alignment = 0
+[node name="Lobby" type="Button" parent="Side/Margin/Options"]
+layout_mode = 2
+text = "Cancel game"
+alignment = 0
+
[node name="Reconnect" type="Button" parent="Side/Margin/Options"]
layout_mode = 2
text = "Reconnect"
@@ -123,6 +128,7 @@ text = "Quit game"
alignment = 0
[connection signal="pressed" from="Side/Margin/Options/Resume" to="." method="_on_resume_pressed"]
+[connection signal="pressed" from="Side/Margin/Options/Lobby" to="." method="_on_lobby_pressed"]
[connection signal="pressed" from="Side/Margin/Options/Reconnect" to="." method="_on_reconnect_pressed"]
[connection signal="pressed" from="Side/Margin/Options/Settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="Side/Margin/Options/MainMenu" to="." method="_on_main_menu_pressed"]