1.7.10 compatibility

This commit is contained in:
kepler155c
2018-03-21 12:34:47 -04:00
parent 9986857ef1
commit 8b2620d4aa
2 changed files with 11 additions and 4 deletions

View File

@@ -74,7 +74,7 @@ end
function MEAdapter:refresh()
self.items = nil
local hasItems
local hasItems, failed
local s, m = pcall(function()
self.items = self.getAvailableItems('all')
@@ -86,7 +86,12 @@ function MEAdapter:refresh()
-- but all items will have a 0 quantity
-- ensure that the list is valid
if not hasItems then
hasItems = v.qty > 0
hasItems = v.count > 0
end
if not v.fingerprint then
failed = true
break
end
if not itemDB:get(v) then
@@ -100,7 +105,7 @@ function MEAdapter:refresh()
debug(m)
end
if s and hasItems and not Util.empty(self.items) then
if s and not failed and hasItems and self.items and not Util.empty(self.items) then
return self.items
end
self.items = nil

View File

@@ -206,11 +206,13 @@ local function listItems()
if items then
break
end
os.sleep(.25)
jobList:showError('Error - retrying in 3 seconds')
os.sleep(3)
end
if not items then
-- error('could not check inventory')
term.clear()
jobList:showError('Error - rebooting in 5 seconds')
print('Communication failure')
print('rebooting in 5 secs')
os.sleep(5)