Fix quickstack
This commit is contained in:
@@ -322,10 +322,19 @@ local function stackToCursor()
|
|||||||
-- And it is much easier to let the game decide when we can not move
|
-- And it is much easier to let the game decide when we can not move
|
||||||
-- Any more items (via return value of TryPutItem)
|
-- Any more items (via return value of TryPutItem)
|
||||||
-- And we then know that we can safely stop
|
-- And we then know that we can safely stop
|
||||||
|
-- UPDATE: OK well that was a stupid idea, it returns an error for other shit as well
|
||||||
|
-- What other shit? Wish I knew
|
||||||
|
-- So we'll use HowManyCanBePut instead...
|
||||||
local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, nil)
|
local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, nil)
|
||||||
if not moved then
|
if not moved then
|
||||||
MyModGlobal.debugPrint(string.format("Failed to move item %s to slot %d", ititem.Name, slot
|
MyModGlobal.debugPrint(string.format("Failed to move item %s to slot %d", ititem.Name, slot
|
||||||
.slotIndex - 1))
|
.slotIndex - 1))
|
||||||
|
-- return false, true
|
||||||
|
end
|
||||||
|
local maxFits = slot.inventory.HowManyCanBePut(ititem.Prefab, slot.slotIndex - 1)
|
||||||
|
if maxFits <= 0 then
|
||||||
|
MyModGlobal.debugPrint(string.format("Item %s has no more fits in slot %d", ititem.Name, slot
|
||||||
|
.slotIndex - 1))
|
||||||
return false, true
|
return false, true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -358,10 +367,19 @@ local function stackAllToCursor()
|
|||||||
-- And it is much easier to let the game decide when we can not move
|
-- And it is much easier to let the game decide when we can not move
|
||||||
-- Any more items (via return value of TryPutItem)
|
-- Any more items (via return value of TryPutItem)
|
||||||
-- And we then know that we can safely stop
|
-- And we then know that we can safely stop
|
||||||
|
-- UPDATE: OK well that was a stupid idea, it returns an error for other shit as well
|
||||||
|
-- What other shit? Wish I knew
|
||||||
|
-- So we'll use HowManyCanBePut instead...
|
||||||
local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, nil)
|
local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, nil)
|
||||||
if not moved then
|
if not moved then
|
||||||
MyModGlobal.debugPrint(string.format("Failed to move item %s to slot %d", ititem.Name, slot
|
MyModGlobal.debugPrint(string.format("Failed to move item %s to slot %d", ititem.Name, slot
|
||||||
.slotIndex - 1))
|
.slotIndex - 1))
|
||||||
|
-- return false, true
|
||||||
|
end
|
||||||
|
local maxFits = slot.inventory.HowManyCanBePut(ititem.Prefab, slot.slotIndex - 1)
|
||||||
|
if maxFits <= 0 then
|
||||||
|
MyModGlobal.debugPrint(string.format("Item %s has no more fits in slot %d", ititem.Name, slot
|
||||||
|
.slotIndex - 1))
|
||||||
return false, true
|
return false, true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user