extends Node
class_name NPC

@export var maxHealth: int = 0
var health: int = maxHealth

signal died

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	spawn()

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	pass

func spawn() -> void:
	pass

func take_damage(dmg: int) -> void:
	self.health -= dmg;
	if self.health < 0:
		self.die()

func die() -> void:
	died.emit()
	queue_free()
	# TODO: should associate this class with a loot table (or equivalent), and can then implement logic for dying in parent class here.
	
func move(destination: Vector3) -> void:
	push_error("Function move() not implemented.")
	
