24 lines
766 B
GDScript
24 lines
766 B
GDScript
extends Control
|
|
|
|
@onready var item_list : ItemList = $ItemList
|
|
var item_list_no_dupes = []
|
|
|
|
# Add items from each pool to journal.
|
|
func _ready() -> void:
|
|
for item_scene in ItemSpawn.item_pool.common:
|
|
add_item_to_journal(item_scene)
|
|
for item_scene in ItemSpawn.item_pool.rare:
|
|
add_item_to_journal(item_scene)
|
|
for item_scene in ItemSpawn.item_pool.unique:
|
|
add_item_to_journal(item_scene)
|
|
|
|
func _process(_delta: float) -> void:
|
|
if Input.is_action_just_pressed("journal"):
|
|
visible = not visible
|
|
|
|
# Adds an item to the journal if it was not yet added
|
|
func add_item_to_journal(item_scene):
|
|
if not item_list_no_dupes.has(item_scene):
|
|
item_list_no_dupes.append(item_scene)
|
|
var item = item_scene.instantiate()
|
|
item_list.add_item(item.item_name, item.icon)
|