class_name Interactable extends Area3D

@export var prompt: String = "Взаимодействовать"
@export var enabled: bool = false

signal interacted(player: Node)


func _ready() -> void:
	monitoring = false
	_apply_collision()


func set_interactable(v: bool) -> void:
	enabled = v
	_apply_collision()


func _apply_collision() -> void:
	if enabled:
		collision_layer = 1
	else:
		collision_layer = 0


func get_prompt() -> String:
	return prompt


func interact(player: Node) -> void:
	if not enabled:
		return
	interacted.emit(player)
