extends VBoxContainer

const list_entry_scene = preload("res://cart_list_entry.tscn")

func _ready() -> void:
	Global.cart_updated.connect(_on_cart_updated)
	_on_cart_updated()

func _on_cart_updated():
	for c in get_children():
		remove_child(c)
		c.queue_free()
	
	var list_entry
	for entry in Global.cart:
		list_entry = list_entry_scene.instantiate()
		list_entry.entry = entry
		add_child(list_entry)
