feat: Add player character scene, Nakama multiplayer manager, and a new arena scene.
This commit is contained in:
@@ -33,9 +33,30 @@ func _init_client():
|
||||
|
||||
func set_server(host: String, port: int = 7350):
|
||||
nakama_host = host
|
||||
nakama_port = port
|
||||
|
||||
# Auto-detect secure tunnels (Tailscale, ngrok, playit, cloudflare)
|
||||
if host.ends_with(".ts.net") or host.ends_with(".gg") or host.begins_with("https://"):
|
||||
if host.begins_with("https://"):
|
||||
nakama_host = host.replace("https://", "")
|
||||
if host.begins_with("http://"):
|
||||
nakama_host = host.replace("http://", "")
|
||||
if nakama_host.ends_with("/"):
|
||||
nakama_host = nakama_host.substr(0, nakama_host.length() - 1)
|
||||
|
||||
nakama_port = 443
|
||||
nakama_scheme = "https"
|
||||
else:
|
||||
# Extract port if they typed something like 192.168.1.1:7350
|
||||
if ":" in host and not host.begins_with("http"):
|
||||
var parts = host.split(":")
|
||||
nakama_host = parts[0]
|
||||
nakama_port = parts[1].to_int()
|
||||
else:
|
||||
nakama_port = port
|
||||
nakama_scheme = "http"
|
||||
|
||||
_init_client()
|
||||
print("[NakamaManager] Server updated to: ", nakama_host, ":", nakama_port)
|
||||
print("[NakamaManager] Server updated to: ", nakama_scheme, "://", nakama_host, ":", nakama_port)
|
||||
|
||||
func _process(_delta):
|
||||
# If using the standard socket adapter, it needs polling in some versions
|
||||
|
||||
Reference in New Issue
Block a user