1.7.10 compatibility
This commit is contained in:
@@ -447,11 +447,12 @@ local function findMachines()
|
|||||||
|
|
||||||
dock()
|
dock()
|
||||||
|
|
||||||
local function getName(side)
|
local function getName(dir)
|
||||||
|
local side = turtle.getAction(dir).side
|
||||||
local methods = Peripheral.isPresent(side) and Util.transpose(Peripheral.getMethods(side))
|
local methods = Peripheral.isPresent(side) and Util.transpose(Peripheral.getMethods(side))
|
||||||
if methods then
|
if methods then
|
||||||
if methods.getMetadata then
|
if methods.getMetadata then
|
||||||
local name = Peripheral.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
|
||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
@@ -459,30 +460,24 @@ local function findMachines()
|
|||||||
return Peripheral.call(side, 'getInventoryName')
|
return Peripheral.call(side, 'getInventoryName')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local _, machine = turtle.getAction(dir).inspect()
|
||||||
|
if not machine or type(machine) ~= 'table' then
|
||||||
|
return 'Unknown'
|
||||||
|
end
|
||||||
|
return machine.name or 'Unknown'
|
||||||
end
|
end
|
||||||
|
|
||||||
local index = 0
|
local index = 0
|
||||||
|
|
||||||
local function getMachine(dir)
|
local function getMachine(dir)
|
||||||
local side = turtle.getAction(dir).side
|
local name = getName(dir)
|
||||||
local machine = Peripheral.getBySide(side)
|
table.insert(machines, {
|
||||||
if not machine then
|
name = name,
|
||||||
local _
|
rawName = name,
|
||||||
_, machine = turtle.getAction(dir).inspect()
|
index = index,
|
||||||
if not machine or type(machine) ~= 'table' then
|
dir = dir,
|
||||||
machine = { name = 'Unknown' }
|
order = #machines + 1
|
||||||
end
|
})
|
||||||
end
|
|
||||||
if machine and type(machine) == 'table' then
|
|
||||||
local name = getName(side) or machine.name
|
|
||||||
table.insert(machines, {
|
|
||||||
name = name,
|
|
||||||
rawName = name,
|
|
||||||
index = index,
|
|
||||||
dir = dir,
|
|
||||||
order = #machines + 1
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
|
|||||||
Reference in New Issue
Block a user