Fix slotsperrow
This commit is contained in:
@@ -64,7 +64,15 @@ local function tryUnloadSlot(slot)
|
||||
-- print("Before sorting:")
|
||||
-- dump(nearbySlots)
|
||||
|
||||
local slotsPerRow = slot.inventory.slotsPerRow or 1
|
||||
-- Some inventories don't have slots per row, like the player inventory
|
||||
local slotsPerRow = 900
|
||||
local ok, err = pcall(function()
|
||||
slotsPerRow = slot.inventory.slotsPerRow
|
||||
end)
|
||||
if not ok then
|
||||
MyModGlobal.debugPrint(string.format("Error getting slots per row: %s", err))
|
||||
end
|
||||
|
||||
local getGridPos = function(slotIndex)
|
||||
local x = slotIndex % slotsPerRow
|
||||
local y = math.floor(slotIndex / slotsPerRow)
|
||||
|
Reference in New Issue
Block a user