44 lines
1.7 KiB
GDScript
44 lines
1.7 KiB
GDScript
extends Node
|
|
## Client-side proxy for the server's real PlayerNode (scripts/
|
|
## player_spawner.gd), attached at runtime to a Node named "Player_<peer_id>"
|
|
## under the /root/Server proxy by NetworkClient._on_connected().
|
|
##
|
|
## rpc_request_input is the only one of these actually CALLED from this
|
|
## side -- the real implementations all live on the server. But two things
|
|
## force every @rpc method on the real PlayerNode to be mirrored here too,
|
|
## not just the one this class uses:
|
|
## 1. Godot's rpc_id() looks up the RPC transfer config (mode/reliability)
|
|
## from the LOCAL script before it will even send a call, so the method
|
|
## being called has to be declared locally with a matching annotation.
|
|
## 2. Godot's multiplayer layer also 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 starts failing, not just the one
|
|
## that's actually missing. So even rpc_request_interact/attack/
|
|
## set_position/set_rotation, which this class never calls, have to be
|
|
## declared here with matching annotations or rpc_request_input itself
|
|
## breaks too.
|
|
|
|
@rpc("any_peer", "call_remote", "reliable")
|
|
func rpc_request_input(_input_state: Dictionary, _seq: int) -> void:
|
|
pass # Never invoked locally -- see the note above.
|
|
|
|
|
|
@rpc("any_peer", "call_remote", "reliable")
|
|
func rpc_request_interact(_target_id: int) -> void:
|
|
pass
|
|
|
|
|
|
@rpc("any_peer", "call_remote", "reliable")
|
|
func rpc_request_attack(_target_id: int, _aim_dir: Vector3) -> void:
|
|
pass
|
|
|
|
|
|
@rpc("authority", "call_remote", "reliable")
|
|
func rpc_set_position(_pos: Vector3) -> void:
|
|
pass
|
|
|
|
|
|
@rpc("authority", "call_remote", "reliable")
|
|
func rpc_set_rotation(_rot: Vector3) -> void:
|
|
pass
|