Fix individual decor inventory identity (#128)
This commit is contained in:
parent
cab313d69d
commit
5aa723de54
6 changed files with 276 additions and 113 deletions
|
|
@ -104,7 +104,62 @@ func _run() -> void:
|
|||
assert(layout.restore_from_save_data(decor_layout_save))
|
||||
assert(layout.get_inventory_count() == 2)
|
||||
assert(layout.get_storage_count() == 1)
|
||||
assert(bag.remove_item(&"basic_cube", 3))
|
||||
var restored_inventory_decor := layout.get_entries(
|
||||
PlayerInventoryLayout.InventoryContainer.INVENTORY
|
||||
)
|
||||
var hotbar_decor_key: String = str(
|
||||
restored_inventory_decor[0].get("key", "")
|
||||
)
|
||||
assert(hotbar.assign_item(0, &"basic_cube", hotbar_decor_key))
|
||||
assert(hotbar.get_item_entry_key(0) == hotbar_decor_key)
|
||||
var second_hotbar_decor_key: String = str(
|
||||
layout.get_entries(
|
||||
PlayerInventoryLayout.InventoryContainer.INVENTORY
|
||||
)[0].get("key", "")
|
||||
)
|
||||
assert(second_hotbar_decor_key != hotbar_decor_key)
|
||||
assert(hotbar.assign_item(1, &"basic_cube", second_hotbar_decor_key))
|
||||
assert(hotbar.get_item_id(0) == &"basic_cube")
|
||||
assert(hotbar.get_item_id(1) == &"basic_cube")
|
||||
assert(hotbar.get_item_entry_key(1) == second_hotbar_decor_key)
|
||||
assert(
|
||||
str(layout.get_entry_by_key(moved_decor_key).get("key", ""))
|
||||
== moved_decor_key
|
||||
)
|
||||
assert(
|
||||
int(layout.get_entry_by_key(moved_decor_key).get("container", -1))
|
||||
== PlayerInventoryLayout.InventoryContainer.STORAGE
|
||||
)
|
||||
assert(hotbar.move_slot_to_container(
|
||||
0,
|
||||
PlayerInventoryLayout.InventoryContainer.INVENTORY,
|
||||
5,
|
||||
))
|
||||
assert(hotbar.get_item_id(0).is_empty())
|
||||
assert(hotbar.get_item_entry_key(1) == second_hotbar_decor_key)
|
||||
assert(
|
||||
str(
|
||||
layout.get_entry_at(
|
||||
PlayerInventoryLayout.InventoryContainer.INVENTORY, 5
|
||||
).get("key", "")
|
||||
)
|
||||
== hotbar_decor_key
|
||||
)
|
||||
assert(
|
||||
int(layout.get_entry_by_key(moved_decor_key).get("container", -1))
|
||||
== PlayerInventoryLayout.InventoryContainer.STORAGE
|
||||
)
|
||||
assert(hotbar.assign_item(0, &"basic_cube", hotbar_decor_key))
|
||||
assert(layout.consume_individual_item_entry(hotbar_decor_key))
|
||||
assert(bag.get_quantity(&"basic_cube") == 2)
|
||||
assert(layout.get_entry_by_key(hotbar_decor_key).is_empty())
|
||||
assert(hotbar.get_item_id(0).is_empty())
|
||||
assert(hotbar.get_item_entry_key(1) == second_hotbar_decor_key)
|
||||
assert(
|
||||
int(layout.get_entry_by_key(moved_decor_key).get("container", -1))
|
||||
== PlayerInventoryLayout.InventoryContainer.STORAGE
|
||||
)
|
||||
assert(bag.remove_item(&"basic_cube", 2))
|
||||
assert(layout.get_inventory_count() == 0)
|
||||
assert(layout.get_storage_count() == 0)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue