Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
670 stars 72 forks source link

Inventory system / grid based: Using item while moving another one can override/delete it. #203

Closed Phazorknight closed 1 month ago

Phazorknight commented 1 month ago

Cogito and Godot Engine Version: Cogito beta 202405.15 https://github.com/Phazorknight/Cogito/commit/9872705955f053c8e68b802074ac42a550f9eedd Godot 4.2.1 stable

Description: A clear and concise description of what the bug is.

Reproduction steps:

  1. Load Laboratory demo scene.
  2. Pick up pistol and laser rifle.
  3. Open inventory.
  4. Start moving the laser rifle.
  5. While placing the laser rifle (grabbed item visible), hover the cursor over the pistol.
  6. When clicking the "use" action, the rifle gets placed over the pistol, but the pistol doesn't get picked up, deleting it from the inventory.

Expected behavior: The use action should not do anything while the player is moving/placing items to avoid unexpected behavior.

Phazorknight commented 1 month ago

Just had a quick thought on this: We can't completely disable the use-action as this would break combinable items. Would probably have to include an item type check before hand.

Phazorknight commented 1 month ago

This should now be fixed in https://github.com/Phazorknight/Cogito/commit/69a3b595f0a9e02598336654352aad26d439a48d

Basically, I refined the conditions on what happens when a grabbed item gets "used" on a slot, depending on what item is within said slot.