โ† All examples

godot components

Slot inventory with stacks and a weight limit

Store items in a fixed number of slots with per-item stack limits and an optional total weight limit. Add returns what did not fit; remove, move, merge, swap, split and save to JSON-friendly data with validation.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • inspect_gdscript.py
  • run_tests.gd
  • slot_inventory.gd
  • test_package.py
  • tests/test_slot_inventory.gd
  • verification/native.json

How it works

Class
BaltorSlotInventory, extends RefCounted
Methods
get_slot_count() -> int; resize(new_count: int) -> bool; max_stack_of(item_id: StringName) -> int; weight_of(item_id: StringName) -> float; total_weight() -> float; get_slot(index: int) -> Dictionary; is_slot_empty(index: int) -> bool; first_empty_slot() -> int; and 10 more
Signals
slot_changed, item_added, item_removed
Placement
res://baltor/godot_components/slot_inventory/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • godot_parse_check_only
  • godot_gdscript_tests
  • godot_tests_reject_gutted_component
  • godot_editor_import
  • godot_contract_reflection
  • godot_readme_usage_compiles

Limits to consider

Item definitions are plain dictionaries keyed by id, with a stack limit and unit weight only; no item instances with unique data (durability, enchantments). Slots are a flat list without shapes (see a grid inventory for that). Weight comparisons use a 1e-6 tolerance. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.