From 4686804f3c64983b3f28126bd57bb8949f76264a Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Mon, 7 Jan 2019 03:41:35 -0500 Subject: [PATCH] app tweaks --- farms/attack.lua | 2 +- milo/MiloRemote.lua | 11 +++++++++-- milo/plugins/craftTask.lua | 21 +++++++++++++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/farms/attack.lua b/farms/attack.lua index e283f2e..69ef002 100644 --- a/farms/attack.lua +++ b/farms/attack.lua @@ -76,7 +76,7 @@ local function dropOff() local inv = turtle.getSummedInventory() for _, slot in pairs(inv) do if slot.count >= 16 then - if turtle.getFuelLevel() < 1000 then + if turtle.getFuelLevel() < 5000 then turtle.refuel(slot.name, 16) end end diff --git a/milo/MiloRemote.lua b/milo/MiloRemote.lua index 11d0105..d38424a 100644 --- a/milo/MiloRemote.lua +++ b/milo/MiloRemote.lua @@ -41,9 +41,8 @@ local page = UI.Page { }, { name = 'config', - text = '\206', + text = '\187', x = -3, - }, }, infoBar = UI.StatusBar { @@ -72,6 +71,8 @@ local page = UI.Page { backgroundFocusColor = colors.cyan, accelerators = { [ 'enter' ] = 'eject', + [ 'up' ] = 'grid_up', + [ 'down' ] = 'grid_down', }, }, amount = UI.TextEntry { @@ -414,6 +415,12 @@ shell.openForegroundTab('packages/milo/MiloRemote')]]) self:refresh('scan') self.grid:draw() + elseif event.type == 'grid_up' then + self.grid:emit({ type = 'scroll_up' }) + + elseif event.type == 'grid_down' then + self.grid:emit({ type = 'scroll_down' }) + elseif event.type == 'refresh' then self:setFocus(self.statusBar.filter) self:refresh('list') diff --git a/milo/plugins/craftTask.lua b/milo/plugins/craftTask.lua index 62054b1..89e0d6d 100644 --- a/milo/plugins/craftTask.lua +++ b/milo/plugins/craftTask.lua @@ -57,16 +57,29 @@ end end function craftTask:cycle() + local playSound = true + for _,key in pairs(Util.keys(context.craftingQueue)) do local item = context.craftingQueue[key] if item.requested - item.crafted > 0 then local recipe = Craft.findRecipe(key) if recipe then - Sound.play('entity.experience_orb.pickup') - self:craft(recipe, item) - if item.callback and item.crafted >= item.requested then - item.callback(item) -- invoke callback + + if playSound then + Sound.play('entity.experience_orb.pickup') + playSound = false end + + self:craft(recipe, item) + + if item.crafted >= item.requested then + item.status = 'crafted' + item.statusCode = Craft.STATUS_SUCCESS + if item.callback then + item.callback(item) -- invoke callback + end + end + elseif not context.controllerAdapter then item.status = '(no recipe)' item.statusCode = Craft.STATUS_ERROR