extends Node3D
## Point entity marker that spawns the player actor at its position when the
## map finishes loading. The marker removes itself after spawning.

@export var actor_scene: PackedScene = preload("res://elements/actor/actor.tscn")


func _ready() -> void:
	# Wait one frame so func_godot has finished setting our global_transform
	# from the map file before we read it.
	await get_tree().process_frame

	var actor: Node3D = actor_scene.instantiate()
	get_tree().current_scene.add_child(actor)

	actor.global_transform = global_transform
	actor.position = Grid.snap(actor.position)

	queue_free()
