extends Node ## Client-side proxy node, attached at runtime to a Node named "Server" at ## the SceneTree root by NetworkClient.connect_to_server(). Exists purely so ## Godot's RPC path-matching finds a receiver for _receive_snapshot -- see ## network_client.gd's class docstring for the full explanation of why this ## has to exist at this exact path. Not a real server in any sense. ## ## Godot's multiplayer layer verifies an "RPC node checksum" -- both peers ## must declare the *same set* of @rpc methods at a matching path, or every ## RPC at that path (not just the mismatched one) starts failing with ## "rpc node checksum failed". So every @rpc method scripts/server.gd ## declares on its own root "Server" node has to be mirrored here too, even ## the ones this proxy never actually needs to receive. var owner_client: Node = null ## Must match scripts/server.gd's own @rpc annotation on _receive_snapshot ## exactly -- Godot enforces the receiving method's declared mode/transfer ## config, a mismatch here would silently drop the call. @rpc("any_peer", "call_remote", "reliable") func _receive_snapshot(snapshot_data: Dictionary) -> void: if owner_client and is_instance_valid(owner_client): owner_client._handle_snapshot(snapshot_data) ## Mirrors scripts/server.gd's _kick -- never actually invoked on this side ## (the server calls it on a Player_ node's own rpc_id target, not this ## root proxy), declared only so the RPC checksum for this path matches. @rpc("any_peer", "call_remote", "reliable") func _kick(_reason: String) -> void: pass ## Mirrors scripts/server.gd's _disconnect -- same reasoning as _kick above. @rpc("call_remote", "reliable") func _disconnect(_reason: String) -> void: pass