peter-kish / gloot

A universal inventory system for the Godot game engine.
MIT License
561 stars 20 forks source link

Slot clear() doesn't auto-merge item #210

Open Nordsoft91 opened 4 months ago

Nordsoft91 commented 4 months ago

Steps:

  1. Create InventorySlot, remember_source_inventory = true
  2. Create InventoryStacked
  3. Call InventorySlot.equip with any item
  4. Make sure you have one more item with same prototype_id in inventory
  5. Call InventorySlot.clear()

Expected:

Actual

peter-kish commented 4 months ago

Honestly, I don't think the remember_source_inventory property is very useful and I'm planning to remove it completely as it causing more issues than it solves. In most cases clearing the slot and adding the item to an inventory manually is much simpler to understand and causes no side-effects.

Nordsoft91 commented 4 months ago

Actually, "slot" can derived "Inventory" as well, because it's inventory which can handle only one object. Then, no equip and clear are needed and everything could be done with regular transfer_item/add_item/... methods.

peter-kish commented 4 months ago

Yup, that's exactly what I'm planning to do for v3.0 🙂