summaryrefslogtreecommitdiff
path: root/Network/Lobby.gd
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-06-18 16:43:22 +0200
committerDaniel Weipert <code@drogueronin.de>2023-06-18 16:43:22 +0200
commit395c25b1fbe51f42decf402f97e51eabcc8c0a77 (patch)
tree72a17c71a39b53d328a76e111ae205d9538d64d0 /Network/Lobby.gd
parent2686ec6d4af6b5437a5f5a5cac008f3d38295f78 (diff)
Godot v3 -> v4
Diffstat (limited to 'Network/Lobby.gd')
-rw-r--r--Network/Lobby.gd20
1 files changed, 11 insertions, 9 deletions
diff --git a/Network/Lobby.gd b/Network/Lobby.gd
index be045b0..67a1f34 100644
--- a/Network/Lobby.gd
+++ b/Network/Lobby.gd
@@ -2,15 +2,17 @@ extends Control
func _ready():
- Network.connect("connection_succeeded", self, "_on_connection_succeeded")
- Network.connect("connection_failed", self, "_on_connection_failed")
- Network.connect("player_list_changed", self, "refresh_lobby")
- Network.connect("game_error", self, "_on_game_error")
- Network.connect("game_ended", self, "_on_game_ended")
- $HTTPRequest.connect("request_completed", self, '_set_remote_ip')
+ Network.connect("connection_succeeded", Callable(self, "_on_connection_succeeded"))
+ Network.connect("connection_failed", Callable(self, "_on_connection_failed"))
+ Network.connect("player_list_changed", Callable(self, "refresh_lobby"))
+ Network.connect("game_error", Callable(self, "_on_game_error"))
+ Network.connect("game_ended", Callable(self, "_on_game_ended"))
+ $HTTPRequest.connect("request_completed", Callable(self, '_set_remote_ip'))
if OS.has_environment("USERNAME"):
$Connect/Name.text = OS.get_environment("USERNAME")
+ elif OS.has_environment("USER"):
+ $Connect/Name.text = OS.get_environment("USER")
else:
var desktop_path = OS.get_system_dir(0).replace("\\", "/").split("/")
$Connect/Name.text = desktop_path[desktop_path.size() - 2]
@@ -36,7 +38,7 @@ func refresh_lobby():
for p in players:
$Players/List.add_item(p.name)
- $Players/Start.disabled = not get_tree().is_network_server()
+ $Players/Start.disabled = not multiplayer.is_server()
func set_ip():
@@ -53,7 +55,7 @@ func set_remote_ip():
$Players/RemoteIP.text = ""
$HTTPRequest.request("https://ipv4.icanhazip.com/")
-func _set_remote_ip(result, response_code, headers, body):
+func _set_remote_ip(_result, response_code, _headers, body):
if response_code == 200:
$Players/RemoteIP.text = body.get_string_from_utf8()
else:
@@ -73,7 +75,7 @@ func _on_connection_failed():
func _on_game_error(error):
$ErrorDialog.dialog_text = error
- $ErrorDialog.popup_centered_minsize()
+ $ErrorDialog.popup_centered_clamped()
self.disable_connect_buttons()