1.7.10 compatibility

This commit is contained in:
kepler155c
2018-02-24 03:25:01 -05:00
parent af6435682b
commit 0524f35e57
2 changed files with 17 additions and 10 deletions

View File

@@ -449,8 +449,8 @@ local function findMachines()
local function getName(dir) local function getName(dir)
local side = turtle.getAction(dir).side local side = turtle.getAction(dir).side
local methods = Peripheral.isPresent(side) and Util.transpose(Peripheral.getMethods(side)) if Peripheral.isPresent(side) then
if methods then local methods = Util.transpose(Peripheral.getMethods(side))
if methods.getMetadata then if methods.getMetadata then
local name = Peripheral.call(side, 'getMetadata').displayName local name = Peripheral.call(side, 'getMetadata').displayName
if name and not string.find(name, '.', 1, true) then if name and not string.find(name, '.', 1, true) then
@@ -459,6 +459,7 @@ local function findMachines()
elseif methods.getInventoryName then -- 1.7x elseif methods.getInventoryName then -- 1.7x
return Peripheral.call(side, 'getInventoryName') return Peripheral.call(side, 'getInventoryName')
end end
return Peripheral.getType(side)
end end
local _, machine = turtle.getAction(dir).inspect() local _, machine = turtle.getAction(dir).inspect()
if not machine or type(machine) ~= 'table' then if not machine or type(machine) ~= 'table' then
@@ -1076,7 +1077,14 @@ function listingPage:applyFilter()
self.grid:setValues(t) self.grid:setValues(t)
end end
findMachines() local s, m = pcall(findMachines)
if not s and m then
printError(m)
read()
return
end
loadResources() loadResources()
dock() dock()
clearGrid() clearGrid()

View File

@@ -16,7 +16,7 @@ local InventoryAdapter = require('inventoryAdapter')
local colors = _G.colors local colors = _G.colors
local device = _G.device local device = _G.device
local multishell = _ENV.multishell local multishell = _ENV.multishell
local peripheral = _G.peripheral local os = _G.os
local term = _G.term local term = _G.term
local turtle = _G.turtle local turtle = _G.turtle
@@ -52,15 +52,14 @@ if device.workbench then
[ 'right' ] = 'left', [ 'right' ] = 'left',
} }
local duckAntennaSide = oppositeSide[device.workbench.side] local duckAntennaSide = oppositeSide[device.workbench.side]
duckAntenna = peripheral.wrap(duckAntennaSide) if Peripheral.getType(duckAntennaSide) == os.getComputerLabel() then
if not duckAntenna or not duckAntenna.getAllStacks then duckAntenna = Peripheral.wrap(duckAntennaSide)
duckAntenna = nil if duckAntenna and not duckAntenna.getAllStacks then
duckAntenna = nil
end
end end
end end
--TODO : find out duck antenna type
duckAntenna = nil
local STATUS_INFO = 'info' local STATUS_INFO = 'info'
local STATUS_WARNING = 'warning' local STATUS_WARNING = 'warning'
local STATUS_ERROR = 'error' local STATUS_ERROR = 'error'