extends PanelContainer

const Slot = preload("res://slot.tscn")

@onready var member_grid = $MarginContainer/MemberGrid

func _ready() -> void:
	var inv_data = preload("res://Inventory.tres")
	populate_member_grid(inv_data.slot_datas)

func populate_member_grid(slot_datas: Array[Slot_Data]) -> void:
	for child in member_grid.get_children():
		child.queue_free()

	for slot_data in slot_datas:
		var slot = Slot.instantiate()
		member_grid.add_child(slot)
		
		#Populates slot
		if slot_data:
			slot.set_slot_data(slot_data)
