30 lines
1.0 KiB
GDScript
30 lines
1.0 KiB
GDScript
extends Node3D
|
|
|
|
## NS-16: composes ground pick + server authority; see `ground_pick.gd` /
|
|
## `position_authority_client.gd`. NS-18: interaction POST + radius glow preview (see child nodes).
|
|
|
|
@onready var _camera: Camera3D = $World/Camera3D
|
|
@onready var _player: CharacterBody3D = $Player
|
|
@onready var _ground_pick: Node3D = $GroundPick
|
|
@onready var _authority: Node = $PositionAuthorityClient
|
|
@onready var _radius_preview: Node3D = $World/InteractionMarkers
|
|
|
|
|
|
func _ready() -> void:
|
|
_ground_pick.set("fallback_camera", _camera)
|
|
_ground_pick.connect("target_chosen", Callable(self, "_on_target_chosen"))
|
|
_authority.connect(
|
|
"authoritative_position_received", Callable(self, "_on_authoritative_position")
|
|
)
|
|
_authority.call("sync_from_server")
|
|
if _radius_preview.has_method("setup_player"):
|
|
_radius_preview.call("setup_player", _player)
|
|
|
|
|
|
func _on_target_chosen(world: Vector3) -> void:
|
|
_authority.call("submit_move_target", world)
|
|
|
|
|
|
func _on_authoritative_position(world: Vector3) -> void:
|
|
_player.snap_to_server(world)
|