extends BaseItemChest

@onready var chest_01_sprite: AnimatedSprite2D = $"Sprite"

@export var is_locked := false
@export var locked_message_dialogue_trigger: DialogueTrigger
@export var already_opened_message_dialogue_trigger: DialogueTrigger

# Public Methods
func Open() -> void:
	if is_locked:
		if locked_message_dialogue_trigger:
			locked_message_dialogue_trigger.Trigger()
		return
	
	super.Open()
	
	OpeningAnimationStarted.emit()
	chest_01_sprite.play("opening")
	
	var item_name: String = Enums.Items.keys()[item_id]
	print(item_name)


func OpenAlreadyOpened() -> void:
	if already_opened_message_dialogue_trigger:
		already_opened_message_dialogue_trigger.Trigger()


func SetOpenedFromLoad() -> void:
	super.SetOpenedFromLoad()
	chest_01_sprite.play("opened")


# Private Methods
func _ready() -> void:
	if is_open:
		chest_01_sprite.play("opened")
