Skip to content

Releases: Rubonnek/inventory-manager

v2.0.0

28 Feb 01:30
aea8f9a

Choose a tag to compare

New features

  • InventoryManager is now able to track item instance data per slot.

See demo 6 for an usage example with more details.

Data Migration Notes

This release updates the serialized data format for InventoryManager and ItemRegistry.

  • InventoryManager: the SIZE key moved from 12, and a new INSTANCE_DATA_TRACKER key was added at 1.
  • ItemRegistry: per-item METADATA key moved from 57 due to new instance data fields.

If you load data gathered with get_data() from an older version, you will need to run a small migration step to migrate the data keys above before calling set_data().

Here's a small GDScript snippet you can use to migrate your InventoryManager and ItemRegistry data. Make sure to run this migration only once against your data:

# Call these before ItemRegistry.set_data(...) and InventoryManager.set_data(...)
# when loading data saved with get_data() from the old version.

func migrate_inventory_manager_data(p_data: Dictionary) -> Dictionary:
	# Old format:
	# 0 = ITEM_ENTRIES (item slots)
	# 1 = SIZE
	#
	# New format:
	# 0 = ITEM_SLOTS
	# 1 = INSTANCE_DATA_TRACKER
	# 2 = SIZE

	if p_data.has(1) and not p_data.has(2) and typeof(p_data[1]) == TYPE_INT:
		p_data[2] = p_data[1] # move SIZE
		p_data[1] = {}        # add empty INSTANCE_DATA_TRACKER
	return p_data


func migrate_item_registry_data(p_registry_data: Dictionary) -> Dictionary:
	# Old item entry key 5 = METADATA
	# New item entry key 7 = METADATA
	var entries: Dictionary = p_registry_data.get(0, {}) # _registry_key.ITEM_ENTRIES = 0

	for item_id in entries:
		var entry: Dictionary = entries[item_id]
		if entry.has(5) and not entry.has(7):
			entry[7] = entry[5] # move METADATA
			entry.erase(5)
	return p_registry_data


# Example usage:
func load_and_migrate(saved_inventory_data: Dictionary, saved_registry_data: Dictionary, inv: InventoryManager, registry: ItemRegistry) -> void:
	var migrated_registry := migrate_item_registry_data(saved_registry_data)
	registry.set_data(migrated_registry)

	var migrated_inventory := migrate_inventory_manager_data(saved_inventory_data)
	inv.set_data(migrated_inventory)

What's Changed

  • aea8f9a - Bump plugin version
  • d35b145 - Update InventoryManager documentation
  • 6d2fffe - Add item instance data demo
  • 4c81ac0 - Disable unnecessary warning in InventoryManager
  • e52b165 - Update get_item_total documentation
  • 4f9993a - Fix erroneous has_item* documentation and logic
  • 8fd98fb - Backport changes to 4.2.1
  • b3fe1e3 - Implement slot-specific item instance data tracking
  • acdb01c - Update FUNDING
  • deff71c - Format gdscript code with gdscript-formatter

v1.3.0

31 Dec 00:13
e87cc9e

Choose a tag to compare

  • e87cc9e - Bump plugin version
  • c5c3c84 - Update __get_slot_item_id documentation
  • 03defb4 - Fix stack count limit logic in transfer()
  • 514224b - Fix current stack count not being considered when adding items to any slot
  • bdb2c5d - Update README

v1.2.2

27 Dec 15:42
eaa0843

Choose a tag to compare

  • eaa0843 - Bump plugin version
  • 04ff42b - Update README
  • 1cca3b5 - Update the debugger background colors to avoid blending in with the new default Godot theme
  • b394759 - Update InventoryManagerViewer node name
  • 4cec3c9 - Properly deregister inventory manager instance and warn when done multiple times

v1.2.1

02 Sep 18:02
252105b

Choose a tag to compare

  • 708516c - Fix inventory synchronization with the debugger
  • e997681 - Update item id slot tracker upon slot content swap

v1.2.0

29 Jun 19:44
8d7506c

Choose a tag to compare

  • a27cfc8 - Rename ItemRegistry.erase in favor of ItemRegistry.remove_item
  • 186d7a7 - Update documentation
  • 382ab20 - Update README
  • 2b2e897 - Implement ItemRegistry.append for appending items from other registries
  • eb87846 - Fix ItemRegistry.get_data returning the wrong dictionary

v1.1.0

03 May 22:17
a987c7e

Choose a tag to compare

  • f1bf948 - Add InventoryManager.deregister to clear the instance from the debugger
  • 65cd913 - Update icon
  • c0bac0f - Use full name under plugin author
  • 8ecb57d - Replace inventory manager viewer UID

v1.0.1

19 Mar 19:27
81a8e19

Choose a tag to compare

  • e2cc015 - Update documentation
  • 44adf2f - Update formatting and documentation
  • 685ed25 - Update formatting
  • f2c9e1c - Simplify excess item amount check
  • 9a8305e - Update documentation
  • b5e7017 - Clarify is_slot_valid documentation
  • 4aefce9 - Simplify InventoryManager.has_item_amount
  • ea68b2c - Optimize InventoryManager.has_item performance.
  • 25c9442 - Fix duplicated scene UIDs

v1.0.0

16 Mar 02:09
a19efc1

Choose a tag to compare

Initial Release