value is kept small for testing purposes, you'd probably want to use sth. between 50 and 200 //push the first state to the stackwhile(right > index)
stack[right-- % s
if (inventoryItems[i].item.isStackable) if (inventoryItems[i].stackSize= inventoryItems[i].item.stackSize) inventoryItems[i].stackSize} else if (inventoryItems[i].