mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 17:23:44 +00:00
feat: connect clients from validated assignments
This commit is contained in:
@@ -48,6 +48,10 @@ class PlayerInfo:
|
||||
|
||||
var roster: Dictionary = {} # peer_id (int) -> PlayerInfo. Never contains peer 1 (the server; §1.1 decision 2 — dedicated servers are never a player).
|
||||
var local_player_name := "Player"
|
||||
# Set by the assignment connection path. Direct-IP/community-server joins keep
|
||||
# this empty for backwards compatibility; allocated matches carry the opaque
|
||||
# signed authorisation in hello rather than putting it in the endpoint URL.
|
||||
var join_authorisation := ""
|
||||
|
||||
# Test hook (tests/match_net_smoke.gd): set false before connecting to
|
||||
# suppress the automatic real hello, so a test can send a deliberately
|
||||
@@ -65,7 +69,7 @@ func _ready() -> void:
|
||||
func _on_connected_to_server() -> void:
|
||||
roster.clear()
|
||||
if _auto_hello:
|
||||
_hello.rpc_id(1, NetCodec.PROTOCOL_VERSION, SimConstants.TICK_HZ, local_player_name)
|
||||
_hello.rpc_id(1, NetCodec.PROTOCOL_VERSION, SimConstants.TICK_HZ, local_player_name, join_authorisation)
|
||||
|
||||
|
||||
func _on_disconnected_from_server() -> void:
|
||||
@@ -145,7 +149,7 @@ func _pick_balanced_team() -> int:
|
||||
|
||||
|
||||
@rpc("any_peer", "call_remote", "reliable")
|
||||
func _hello(protocol_version: int, tick_hz: int, player_name: String) -> void:
|
||||
func _hello(protocol_version: int, tick_hz: int, player_name: String, supplied_join_authorisation: String = "") -> void:
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
var peer_id := multiplayer.get_remote_sender_id()
|
||||
|
||||
Reference in New Issue
Block a user