1.7.10 compatibility

This commit is contained in:
kepler155c
2018-02-25 07:05:19 -05:00
parent 2bf2e41ee6
commit 959058b5fb
4 changed files with 2905 additions and 39 deletions

View File

@@ -207,27 +207,30 @@ local function getItems()
end
local function isMachineEmpty(machine, item)
local side = turtle.getAction(machine.dir).side
local methods = Util.transpose(Peripheral.getMethods(side))
local list = { true }
if methods.getAllStacks then -- 1.7x
list = Peripheral.call(side, 'getAllStacks', false)
elseif methods.list then
list = Peripheral.call(side, 'list')
elseif methods.getProgress then
if Peripheral.call(side, 'getProgress') == 0 then
return true
end
else
item.statusCode = STATUS_ERROR
item.status = 'Unable to check empty status'
return
end
pcall(function() -- fails randomly in 1.7x
local side = turtle.getAction(machine.dir).side
local methods = Util.transpose(Peripheral.getMethods(side))
if tonumber(machine.ignoreSlot) then
list[tonumber(machine.ignoreSlot)] = nil
end
if methods.getAllStacks then -- 1.7x
list = Peripheral.call(side, 'getAllStacks', false)
elseif methods.list then
list = Peripheral.call(side, 'list')
elseif methods.getProgress then
if Peripheral.call(side, 'getProgress') == 0 then
return true
end
else
item.statusCode = STATUS_ERROR
item.status = 'Unable to check empty status'
return
end
if tonumber(machine.ignoreSlot) then
list[tonumber(machine.ignoreSlot)] = nil
end
end)
if Util.empty(list) then
return true