Compare commits

..

No commits in common. "cd73609a2eddf9eb4924522facd84f403b0cd0f4" and "91583b1ca2ea52f3d21060e6a6326e03e8d3644f" have entirely different histories.

2 changed files with 10 additions and 13 deletions

View File

@ -11,5 +11,4 @@ if fs.exists(CC_UTILS_DIR) then
end end
shell.run("clone https://gitea.tofvesson.se/GabrielTofvesson/cc-utilities.git") shell.run("clone https://gitea.tofvesson.se/GabrielTofvesson/cc-utilities.git")
shell.run("bg") shell.run("bg cc-utilities/itemcontroller")
shell.run("cc-utilities/itemcontroller")

View File

@ -199,27 +199,25 @@ function ItemStack:transferTo(target, count)
return count == 0, 0 return count == 0, 0
end end
local result = { pcall(self:getInventory().pushItems, peripheral.getName(target:getInventory()), self:getSlot(), cap, target:getSlot()) } local result, xfer = pcall(self:getInventory().pushItems, peripheral.getName(target:getInventory()), self:getSlot(), cap, target:getSlot())
if not result[1] then if not result then
return false, result[2] return false, xfer
end end
if result[2] == nil then if xfer == nil then
Logger:error( Logger:error(
"Error transferring item", self:getInventory().pushItems, Logger.plain("\n"), "Error transferring item", self:getInventory().pushItems, Logger.plain("\n"),
peripheral.getName(target:getInventory()), Logger.plain("\n"), peripheral.getName(target:getInventory()), Logger.plain("\n"),
cap, Logger.plain("\n"), self:getSlot(), cap, Logger.plain("\n"),
self, Logger.plain("\n"), target
target, Logger.plain("\n"),
result
) )
end end
target:_modify(result[2], self) target:_modify(xfer, self)
self:_modify(-result[2], self) self:_modify(-xfer, self)
return result[2] == count, result[2] return xfer == count, xfer
end end
local function objEquals(o1, o2) local function objEquals(o1, o2)