|
|
@ -23,9 +23,13 @@ func _init() -> void: |
|
|
|
InventoryManager.select_quick_slot.connect(select_quick_slot) |
|
|
|
|
|
|
|
func _ready() -> void: |
|
|
|
clear_slots() |
|
|
|
remove_slots() |
|
|
|
generate_quick_slots() |
|
|
|
update_highlighted_slot() |
|
|
|
|
|
|
|
# This doesn't quite work on ready as, for some reason, it will select |
|
|
|
# Slot0 (one of the slots BEFORE remove_slots()) instead of the first slot |
|
|
|
# create in generate_quick_slots() |
|
|
|
select_quick_slot(0) |
|
|
|
|
|
|
|
func _unhandled_input(event: InputEvent) -> void: |
|
|
|
if event.is_action_pressed("quickslot1"): |
|
|
@ -56,7 +60,7 @@ func _unhandled_input(event: InputEvent) -> void: |
|
|
|
|
|
|
|
func clear_slots() -> void: |
|
|
|
for slot: QuickSlotsSlot in slots_container.get_children(): |
|
|
|
slot.queue_free() |
|
|
|
slot.clear() |
|
|
|
|
|
|
|
func generate_quick_slots() -> void: |
|
|
|
for slot_index: int in range(InventoryManager.quick_slot_count): |
|
|
@ -64,6 +68,10 @@ func generate_quick_slots() -> void: |
|
|
|
slots_container.add_child(slot) |
|
|
|
slot.init(slot_index) |
|
|
|
|
|
|
|
func remove_slots() -> void: |
|
|
|
for slot: QuickSlotsSlot in slots_container.get_children(): |
|
|
|
slot.queue_free() |
|
|
|
|
|
|
|
func select_next_item() -> void: |
|
|
|
select_quick_slot(_selected_item + 1) |
|
|
|
|
|
|
|