class_name SpawnPoint extends Node3D @export var player_index : int = 0 @export var fixed_player : bool = false var near_players: Array = [] func _ready(): var area3d = $'Area3D' area3d.connect("body_entered", on_player_enter) area3d.connect("body_exited", on_player_exited) func _process(_delta): for player: Player in near_players: if player.state == Player.PlayerState.Dead: near_players.erase(player) func on_player_enter(node: Node3D): var player: Player = node as Player if node == null: return if near_players.find(player) == -1: near_players.append(player) func on_player_exited(node: Node3D): var player: Player = node as Player if node == null: return near_players.erase(player) func is_occupied(): return near_players.size() > 0