inventory refactor + inv ui interactable
This commit is contained in:
@@ -127,12 +127,14 @@ func try_move(move_to : Vector2):
|
||||
|
||||
func pick_item(item : Item) -> Item:
|
||||
play_sfx("pick")
|
||||
if inventory.length() >= inventory.size:
|
||||
var available_slot_ind = inventory.get_best_available_slot_ind()
|
||||
if available_slot_ind == inventory.current_item_ind:
|
||||
var current_item : Item = inventory.get_item()
|
||||
inventory.set_item(item, inventory.current_item_ind)
|
||||
inventory.set_item(item, available_slot_ind)
|
||||
return current_item
|
||||
else :
|
||||
inventory.add_item(item)
|
||||
if inventory.set_item(item, available_slot_ind):
|
||||
inventory.set_current_item(available_slot_ind);
|
||||
return null
|
||||
|
||||
func drop_item():
|
||||
@@ -176,7 +178,7 @@ func upgrade_max_energy(amount = 1):
|
||||
player_updated.emit(self)
|
||||
|
||||
func upgrade_inventory_size(amount = 1):
|
||||
inventory.size += amount
|
||||
inventory.items.resize(inventory.items.size() + amount)
|
||||
upgraded.emit()
|
||||
player_updated.emit(self)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user