class_name HealthComponent
extends Node

export var max_health: int = 0
onready var health :int = max_health


signal health_depleted()

func take_damage(damage_amount :int):
	if damage_amount < 0:
		print("ERROR: Only positive numbers in health component functions.")
	health -= damage_amount
	
	if health <= 0:
		emit_signal("health_depleted")
		health = 0
		
func heal(heal_amount :int):
	if heal_amount < 0:
		print("ERROR: Only positive numbers in health component functions.")
		return
	health += heal_amount
	
	if health > max_health:
		health = max_health
