diff --git a/milo/MiloRemote.lua b/milo/MiloRemote.lua index 75fd5f3..6ca2236 100644 --- a/milo/MiloRemote.lua +++ b/milo/MiloRemote.lua @@ -10,11 +10,15 @@ local colors = _G.colors local device = _G.device local socket +local SHIELD_SLOT = 2 + local options = { user = { arg = 'u', type = 'string', desc = 'User name associated with bound manipulator' }, slot = { arg = 's', type = 'number', desc = 'Optional inventory slot to use to transfer to milo' }, + shield = { arg = 'e', type = 'flag', + desc = 'Use shield slot to use to transfer to milo' }, server = { arg = 'm', type = 'number', desc = 'ID of Milo server' }, help = { arg = 'h', type = 'flag', value = false, @@ -33,7 +37,7 @@ if not options.user.value or not options.server.value then error('Invalid arguments') end -if options.slot.value and +if (options.slot.value or options.shield.value) and not (device.neuralInterface and device.neuralInterface.getInventory) then error('Introspection module is required for transferring items') end @@ -246,7 +250,7 @@ end if options.slot.value then debug('Transfer items initialized') - Event.onInterval(1, function() + Event.onInterval(2, function() local neural = device.neuralInterface if neural and neural.getInventory then local item = neural.getInventory().getItem(options.slot.value) @@ -263,6 +267,25 @@ if options.slot.value then end) end +if options.slot.value or options.eslot.value then + debug('Transfer items initialized') + Event.onInterval(2, function() + local neural = device.neuralInterface + if neural and neural.getEquipment then + local item = neural.getEquipment().getItem(SHIELD_SLOT) + if item then + debug('depositing') + page:sendRequest({ request = 'deposit', slot = 'shield' }) + -- local item = + -- TODO: update count for this one item + -- page.grid:draw() page:sync() + end + else + debug('missing Introspection module') + end + end) +end + UI:setPage(page) UI:pullEvents() diff --git a/milo/apis/storage.lua b/milo/apis/storage.lua index 39ab696..c72a827 100644 --- a/milo/apis/storage.lua +++ b/milo/apis/storage.lua @@ -36,7 +36,9 @@ function NetworkedAdapter:showStorage() debug('Storage:') for k,v in pairs(self.remoteDefaults) do local online = v.adapter and v.adapter.online - debug(' %s: %s', online and ' online' or 'offline', k) + if not online then + debug(' %s: %s', online and ' online' or 'offline', k) + end end debug('') end diff --git a/milo/core/machines.lua b/milo/core/machines.lua index 4201859..208f110 100644 --- a/milo/core/machines.lua +++ b/milo/core/machines.lua @@ -359,8 +359,7 @@ function machineWizard.wizard:eventHandler(event) self.pages.general.index = 1 self.pages.confirmation.index = 2 - for k, page in pairs(self.pages) do -debug(k) + for _, page in pairs(self.pages) do if not page.index and page:isValidFor(self.parent.machine) then page.index = index index = index + 1 diff --git a/milo/plugins/remote.lua b/milo/plugins/remote.lua index 0869c27..7d2e3f5 100644 --- a/milo/plugins/remote.lua +++ b/milo/plugins/remote.lua @@ -5,6 +5,8 @@ local Socket = require('socket') local device = _G.device local turtle = _G.turtle +local SHIELD_SLOT = 2 + local context = Milo:getContext() local function getManipulatorForUser(user) @@ -40,10 +42,19 @@ debug('remote: ' .. data.request) socket:write(items) elseif data.request == 'deposit' then - local count = manipulator.getInventory().pushItems( - context.localName, - data.slot, - 64) + local count + + if data.slot == 'shield' then + count = manipulator.getEquipment().pushItems( + context.localName, + SHIELD_SLOT, + 64) + else + count = manipulator.getInventory().pushItems( + context.localName, + data.slot, + 64) + end socket:write({ count = count }) Milo:clearGrid()