diff --git a/milo/MiloRemote.lua b/milo/MiloRemote.lua index 6a3e3b1..4a36429 100644 --- a/milo/MiloRemote.lua +++ b/milo/MiloRemote.lua @@ -21,8 +21,8 @@ local config = Config.load('miloRemote', { displayMode = 0 }) local socket local depositMode = { - [ true ] = { text = '\25', textColor = colors.black, help = 'Deposit enabled' }, - [ false ] = { text = '\215', textColor = colors.red, help = 'Deposit disabled' }, + [ true ] = { text = '\25', textColor = colors.black, help = 'Deposit enabled' }, + [ false ] = { text = '\215', textColor = colors.red, help = 'Deposit disabled' }, } local displayModes = { @@ -34,12 +34,6 @@ local page = UI.Page { menuBar = UI.MenuBar { y = 1, height = 1, buttons = { - { - name = 'depositToggle', - text = '\215', - x = -15, - event = 'toggle_deposit' - }, { text = 'Refresh', x = -12, @@ -78,7 +72,7 @@ local page = UI.Page { statusBar = UI.Window { y = -1, filter = UI.TextEntry { - x = 1, ex = -9, + x = 1, ex = -12, limit = 50, shadowText = 'filter', backgroundColor = colors.cyan, @@ -88,7 +82,7 @@ local page = UI.Page { }, }, amount = UI.TextEntry { - x = -8, ex = -4, + x = -11, ex = -7, limit = 3, shadowText = '1', shadowTextColor = colors.gray, @@ -99,6 +93,11 @@ local page = UI.Page { }, help = 'Request amount', }, + depositToggle = UI.Button { + x = -6, + event = 'toggle_deposit', + text = '\215', + }, display = UI.Button { x = -3, event = 'toggle_display', @@ -351,8 +350,8 @@ function page:eventHandler(event) elseif event.type == 'toggle_deposit' then config.deposit = not config.deposit - Util.merge(self.menuBar.depositToggle, depositMode[config.deposit]) - self.menuBar:draw() + Util.merge(self.statusBar.depositToggle, depositMode[config.deposit]) + self.statusBar:draw() self:setStatus(depositMode[config.deposit].help) Config.update('miloRemote', config) @@ -445,7 +444,7 @@ end function page:enable() self:setFocus(self.statusBar.filter) - Util.merge(self.menuBar.depositToggle, depositMode[config.deposit]) + Util.merge(self.statusBar.depositToggle, depositMode[config.deposit]) UI.Page.enable(self) if not config.server then self.setup:show() diff --git a/milo/apps/water.lua b/milo/apps/water.lua index 15fd48a..79f985d 100644 --- a/milo/apps/water.lua +++ b/milo/apps/water.lua @@ -1,6 +1,18 @@ -local os = _G.os +_G.requireInjector(_ENV) + +local Util = require('util') + +local fs = _G.fs +local os = _G.os local turtle = _G.turtle +local STARTUP_FILE = 'usr/autorun/miloWater.lua' +if not fs.exists(STARTUP_FILE) then + Util.writeFile(STARTUP_FILE, + [[os.sleep(2) +shell.openForegroundTab('packages/milo/apps/water')]]) +end + while true do turtle.placeDown('minecraft:bucket:0') turtle.placeDown('minecraft:glass_bottle:0') diff --git a/milo/plugins/machineLearn.lua b/milo/plugins/machineLearn.lua index 38fccb0..b94914f 100644 --- a/milo/plugins/machineLearn.lua +++ b/milo/plugins/machineLearn.lua @@ -5,6 +5,7 @@ local Util = require('util') local colors = _G.colors local device = _G.device +local turtle = _G.turtle local context = Milo:getContext() local machine @@ -114,13 +115,14 @@ function pages.confirmation:validate() end Milo:saveMachineRecipe(recipe, result, machine.name) + turtle.emptyInventory() local displayName = itemDB:getName(result) - UI:setPage('listing', { filter = displayName, message = 'Learned: ' .. displayName, }) + return true end