make player add and remove itself from referencer

This commit is contained in:
Teatov 2025-02-12 21:30:13 +10:00
parent 09c0db4813
commit e2a3df213c
2 changed files with 9 additions and 8 deletions

View File

@ -2,11 +2,3 @@ extends Node
var main_camera: Camera3D
var player: Player
func set_player(node: Player) -> void:
player = node
func set_main_camera(node: Camera3D) -> void:
main_camera = node

View File

@ -28,6 +28,15 @@ func _ready() -> void:
_respawn_point = global_position
_camera.make_current()
Referencer.player = self
Referencer.main_camera = _camera
func _exit_tree() -> void:
if not is_multiplayer_authority():
return
Referencer.player = null
Referencer.main_camera = null
func _process(delta: float) -> void: