better detection for adapters
This commit is contained in:
@@ -23,12 +23,26 @@ function ChestAdapter:init(args)
|
|||||||
Util.merge(self, defaults)
|
Util.merge(self, defaults)
|
||||||
Util.merge(self, args)
|
Util.merge(self, args)
|
||||||
|
|
||||||
local chest = Peripheral.getBySide(self.wrapSide)
|
local chest
|
||||||
|
if not self.autoDetect then
|
||||||
|
chest = Peripheral.getBySide(self.wrapSide)
|
||||||
|
if chest and not chest.list then
|
||||||
|
chest = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
if not chest then
|
if not chest then
|
||||||
chest = Peripheral.getByMethod('list')
|
chest = Peripheral.getByMethod('list')
|
||||||
end
|
end
|
||||||
|
|
||||||
if chest then
|
if chest then
|
||||||
Util.merge(self, chest)
|
Util.merge(self, chest)
|
||||||
|
|
||||||
|
local sides = {
|
||||||
|
top = 'down',
|
||||||
|
bottom = 'up',
|
||||||
|
}
|
||||||
|
|
||||||
|
self.direction = sides[self.side] or self.direction
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -58,12 +58,11 @@ function MEAdapter:init(args)
|
|||||||
jobList = { },
|
jobList = { },
|
||||||
direction = 'up',
|
direction = 'up',
|
||||||
wrapSide = 'bottom',
|
wrapSide = 'bottom',
|
||||||
auto = false,
|
|
||||||
}
|
}
|
||||||
Util.merge(self, defaults)
|
Util.merge(self, defaults)
|
||||||
Util.merge(self, args)
|
Util.merge(self, args)
|
||||||
|
|
||||||
if self.auto then
|
if self.autoDetect then
|
||||||
local mep = Peripheral.getByMethod('getAvailableItems')
|
local mep = Peripheral.getByMethod('getAvailableItems')
|
||||||
if mep then
|
if mep then
|
||||||
Util.merge(self, mep)
|
Util.merge(self, mep)
|
||||||
|
|||||||
@@ -1064,7 +1064,6 @@ local __actions = {
|
|||||||
clipboard.setData(text)
|
clipboard.setData(text)
|
||||||
clipboard.useInternal(true)
|
clipboard.useInternal(true)
|
||||||
else
|
else
|
||||||
debug(text)
|
|
||||||
os.queueEvent('clipboard_copy', text)
|
os.queueEvent('clipboard_copy', text)
|
||||||
end
|
end
|
||||||
setStatus('%d chars copied', size)
|
setStatus('%d chars copied', size)
|
||||||
|
|||||||
@@ -12,12 +12,11 @@ local multishell = _ENV.multishell
|
|||||||
|
|
||||||
local storage = RefinedAdapter()
|
local storage = RefinedAdapter()
|
||||||
if not storage:isValid() then
|
if not storage:isValid() then
|
||||||
storage = MEAdapter({ auto = true })
|
storage = MEAdapter({ autoDetect = true })
|
||||||
if not storage:isValid() then
|
end
|
||||||
storage = ChestAdapter()
|
if not storage:isValid() then
|
||||||
end
|
storage = ChestAdapter({ autoDetect = true })
|
||||||
end
|
end
|
||||||
|
|
||||||
if not storage:isValid() then
|
if not storage:isValid() then
|
||||||
error('Not connected to a storage device')
|
error('Not connected to a storage device')
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user