class_name StructureMeter
extends VBoxContainer

const MIN_STRUCTURE: int = 0
const MAX_STRUCTURE: int = 4

var structure_count: int:
	set = _set_structure_count,
	get = _get_structure_count

@onready var _structure_nodes: Array[Control] = [
	$StructureIcon4, $StructureIcon3, $StructureIcon2, $StructureIcon1
]


func _set_structure_count(value: int) -> void:
	for node_idx: int in _structure_nodes.size():
		_structure_nodes[node_idx].visible = node_idx < value


func _get_structure_count() -> int:
	return _structure_nodes.filter(func(n: Control) -> bool: return n.visible).size()
