aboutsummaryrefslogtreecommitdiff
path: root/client/gui
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2025-12-18 22:37:32 +0100
committertpart <tpart120@proton.me>2025-12-18 22:37:37 +0100
commit384973975e8d9760d4be6d25c3e8d3dab3758d6f (patch)
tree1dcc77c293db4613b73613104c9f0d0026f3ca67 /client/gui
parent9018c2a56dce9f4552952444ebd3b2cbb98bc4f4 (diff)
downloadhurrycurry-384973975e8d9760d4be6d25c3e8d3dab3758d6f.tar
hurrycurry-384973975e8d9760d4be6d25c3e8d3dab3758d6f.tar.bz2
hurrycurry-384973975e8d9760d4be6d25c3e8d3dab3758d6f.tar.zst
Implement fallback address support in client (Closes #537)
Diffstat (limited to 'client/gui')
-rw-r--r--client/gui/menus/main/play.gd23
1 files changed, 11 insertions, 12 deletions
diff --git a/client/gui/menus/main/play.gd b/client/gui/menus/main/play.gd
index 4633ee1a..bb2ecf3c 100644
--- a/client/gui/menus/main/play.gd
+++ b/client/gui/menus/main/play.gd
@@ -81,12 +81,11 @@ func update_server_list(lists: Array[Array]):
var server_item: ServerListItem = server_list_item.instantiate()
server_list.add_child(server_item)
- var address: Array[String] = []
- address.append_array(i.address)
+ var urls: Array[String] = []
+ urls.append_array(i.address)
- # TODO: Implement fallback address correctly
- server_item.setup(i.name, roundi(i.players_online), i.version, address)
- server_item.button.pressed.connect(connect_to.bind(i.address[0]))
+ server_item.setup(i.name, roundi(i.players_online), i.version, urls)
+ server_item.button.pressed.connect(connect_to.bind(urls))
# Focus the same server with the same index as the previously focused one
if idx == prev_selected_idx:
server_item.button.grab_focus()
@@ -119,8 +118,9 @@ func _on_connect_pressed():
url = url + ":27032"
connect_uri.text = url
Profile.write("last_server_url", url)
- connect_to(url)
+ connect_to([url])
+# TODO unused code
func _on_quick_connect_pressed():
if OS.has_feature("web"):
connect_to(JavaScriptBridge.eval("""
@@ -129,11 +129,10 @@ func _on_quick_connect_pressed():
: `ws://${window.location.hostname}:27032/`
"""))
else:
- connect_to("wss://hurrycurry.metamuffin.org/")
+ connect_to(["wss://hurrycurry.metamuffin.org/"])
-func connect_to(url: String):
- print("Connecting to %s" % url)
- get_parent().replace_menu("res://gui/menus/game.tscn", url)
+func connect_to(urls: Array[String]):
+ get_parent().replace_menu("res://gui/menus/game.tscn", urls)
func _on_server_control_pressed():
match Server.state:
@@ -148,10 +147,10 @@ func _on_editor_control_pressed():
Service.State.FAILED: Editor.start()
func _on_server_connect_pressed():
- connect_to("ws://%s:%d" % [ServerService.connect_address(), Settings.read("server.bind_port")])
+ connect_to(["ws://%s:%d" % [ServerService.connect_address(), Settings.read("server.bind_port")]])
func _on_editor_connect_pressed():
- connect_to("ws://[::1]:27035/")
+ connect_to(["ws://[::1]:27035/"])
func _process(_delta):
server_control.disabled = false