Compare commits
2 Commits
91583b1ca2
...
cd73609a2e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cd73609a2e | ||
![]() |
30b49215a6 |
@ -11,4 +11,5 @@ 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 cc-utilities/itemcontroller")
|
shell.run("bg")
|
||||||
|
shell.run("cc-utilities/itemcontroller")
|
@ -199,25 +199,27 @@ function ItemStack:transferTo(target, count)
|
|||||||
return count == 0, 0
|
return count == 0, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local result, xfer = pcall(self:getInventory().pushItems, peripheral.getName(target:getInventory()), self:getSlot(), cap, target:getSlot())
|
local result = { pcall(self:getInventory().pushItems, peripheral.getName(target:getInventory()), self:getSlot(), cap, target:getSlot()) }
|
||||||
|
|
||||||
if not result then
|
if not result[1] then
|
||||||
return false, xfer
|
return false, result[2]
|
||||||
end
|
end
|
||||||
|
|
||||||
if xfer == nil then
|
if result[2] == 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"),
|
||||||
self:getSlot(), cap, Logger.plain("\n"),
|
cap, Logger.plain("\n"),
|
||||||
target
|
self, Logger.plain("\n"),
|
||||||
|
target, Logger.plain("\n"),
|
||||||
|
result
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
target:_modify(xfer, self)
|
target:_modify(result[2], self)
|
||||||
self:_modify(-xfer, self)
|
self:_modify(-result[2], self)
|
||||||
|
|
||||||
return xfer == count, xfer
|
return result[2] == count, result[2]
|
||||||
end
|
end
|
||||||
|
|
||||||
local function objEquals(o1, o2)
|
local function objEquals(o1, o2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user