From 763f6bb27ad5c53101cfae485f1cdc4058f064d7 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Sat, 27 Oct 2018 23:47:28 -0400 Subject: [PATCH] milo wip --- milo/MiloRemote.lua | 2 +- milo/apis/storage.lua | 12 +++++++++--- milo/plugins/redstoneTask.lua | 20 ++++++++++++-------- milo/plugins/storageView.lua | 1 + 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/milo/MiloRemote.lua b/milo/MiloRemote.lua index 6ca2236..b6f689c 100644 --- a/milo/MiloRemote.lua +++ b/milo/MiloRemote.lua @@ -267,7 +267,7 @@ if options.slot.value then end) end -if options.slot.value or options.eslot.value then +if options.shield.value then debug('Transfer items initialized') Event.onInterval(2, function() local neural = device.neuralInterface diff --git a/milo/apis/storage.lua b/milo/apis/storage.lua index c72a827..2d0852c 100644 --- a/milo/apis/storage.lua +++ b/milo/apis/storage.lua @@ -33,14 +33,20 @@ debug('%s: %s', e, tostring(dev)) end function NetworkedAdapter:showStorage() - debug('Storage:') + local t = { } for k,v in pairs(self.remoteDefaults) do local online = v.adapter and v.adapter.online if not online then - debug(' %s: %s', online and ' online' or 'offline', k) + table.insert(t, k) end end - debug('') + if #t > 0 then + debug('Storage:') + for _, k in pairs(t) do + debug(' %s: %s', online and ' online' or 'offline', k) + end + debug('') + end end function NetworkedAdapter:setOnline(online) diff --git a/milo/plugins/redstoneTask.lua b/milo/plugins/redstoneTask.lua index 4cc0a09..465902d 100644 --- a/milo/plugins/redstoneTask.lua +++ b/milo/plugins/redstoneTask.lua @@ -12,14 +12,18 @@ function RedstoneTask:cycle(context) for _,v in pairs(context.config.remoteDefaults) do if v.redstone then local ri = device[v.redstone.integrator] - local function conditionsSatisfied() - return not not next(ri.list()) - end - if conditionsSatisfied() then - ri.setOutput(v.redstone.side, true) - Event.onTimeout(.25, function() - ri.setOutput(v.redstone.side, false) - end) + if not ri or not v.adapter or not v.adapter.online then + debug(v.redstone) + else + local function conditionsSatisfied() + return not not next(v.adapter.list()) + end + if conditionsSatisfied() then + ri.setOutput(v.redstone.side, true) + Event.onTimeout(.25, function() + ri.setOutput(v.redstone.side, false) + end) + end end end end diff --git a/milo/plugins/storageView.lua b/milo/plugins/storageView.lua index e13622b..82f51a8 100644 --- a/milo/plugins/storageView.lua +++ b/milo/plugins/storageView.lua @@ -72,6 +72,7 @@ function storageView:eventHandler(event) field = event.element, message = 'The chest must contain the item to lock' }) self.form[3].value = false + self.form[3]:draw() end end else