class_name TrapIcon extends Control

const trap_icons : Dictionary = {
	Trap.Type.BOMB : 		preload("res://visuals/images/icons/bomb.png"),
	Trap.Type.GAS : 		preload("res://visuals/images/icons/gas.png"),
	Trap.Type.PITFALL : 	preload("res://visuals/images/icons/pitfall.png"),
	Trap.Type.FORCE_PANEL : preload("res://visuals/images/icons/force_panel.png"),
	Trap.Type.SWITCH : 		preload("res://visuals/images/icons/switch.png"),
	Trap.Type.MINE : 		preload("res://visuals/images/icons/mine.png"),
}

@onready var icon_image : TextureRect = %Icon
@onready var qty_label : Label = %Label

func setup(type : Trap.Type, qty : int) -> void:
	icon_image.texture = trap_icons[type]
	set_quantity(qty)

func set_quantity(qty : int) -> void:
	qty_label.text = str(qty)
	if qty < 1:
		icon_image.modulate = Color.DIM_GRAY
	else:
		icon_image.modulate = Color.WHITE
