@tool
extends TextureProgressBar

@export var damage_delay := 1.0
@export var damage_tween_time := 0.4

@onready var damage_bar: TextureProgressBar = %DamageBar
@onready var damage_update_timer: Timer = $DamageUpdateTimer


func _on_value_changed(_value: float) -> void:
	damage_update_timer.start(damage_delay)


func _on_damage_update_timer_timeout() -> void:
	var tween := get_tree().create_tween()
	(
		tween
		. tween_property(damage_bar, "value", value, damage_tween_time)
		. set_trans(Tween.TRANS_CUBIC)
		. set_ease(Tween.EASE_OUT)
	)
