Enigma56/ProjectLegend

Stacking Consumables

Closed this issue · 1 comments

Problem: Consumables do not stack when they are present inside of the inventory. Primary cause, the stackable items inherit from "Consumable" which needs to have an Id field in order to be called. This causes every single consumable to have the same idea, causing issues when searching for a particular item.

Methods to Solve: Grab the first item in the inventory that matches the ID of the item and then increment that item by 1. The dropped item has an ID that should be searched for inside of the player inventory, the first matching index will be the one that is incremented. How Create a function that is able to return the proper item OR can differentiate.

Resolved by iterating over the player inventory and retrieving each item type and comparing it against the dropped item. This will be the way to determine if items can be stacked or added.