milo tweaks
This commit is contained in:
@@ -21,8 +21,8 @@ local config = Config.load('miloRemote', { displayMode = 0 })
|
|||||||
|
|
||||||
local socket
|
local socket
|
||||||
local depositMode = {
|
local depositMode = {
|
||||||
[ true ] = { text = '\25', textColor = colors.black, help = 'Deposit enabled' },
|
[ true ] = { text = '\25', textColor = colors.black, help = 'Deposit enabled' },
|
||||||
[ false ] = { text = '\215', textColor = colors.red, help = 'Deposit disabled' },
|
[ false ] = { text = '\215', textColor = colors.red, help = 'Deposit disabled' },
|
||||||
}
|
}
|
||||||
|
|
||||||
local displayModes = {
|
local displayModes = {
|
||||||
@@ -34,12 +34,6 @@ local page = UI.Page {
|
|||||||
menuBar = UI.MenuBar {
|
menuBar = UI.MenuBar {
|
||||||
y = 1, height = 1,
|
y = 1, height = 1,
|
||||||
buttons = {
|
buttons = {
|
||||||
{
|
|
||||||
name = 'depositToggle',
|
|
||||||
text = '\215',
|
|
||||||
x = -15,
|
|
||||||
event = 'toggle_deposit'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
text = 'Refresh',
|
text = 'Refresh',
|
||||||
x = -12,
|
x = -12,
|
||||||
@@ -78,7 +72,7 @@ local page = UI.Page {
|
|||||||
statusBar = UI.Window {
|
statusBar = UI.Window {
|
||||||
y = -1,
|
y = -1,
|
||||||
filter = UI.TextEntry {
|
filter = UI.TextEntry {
|
||||||
x = 1, ex = -9,
|
x = 1, ex = -12,
|
||||||
limit = 50,
|
limit = 50,
|
||||||
shadowText = 'filter',
|
shadowText = 'filter',
|
||||||
backgroundColor = colors.cyan,
|
backgroundColor = colors.cyan,
|
||||||
@@ -88,7 +82,7 @@ local page = UI.Page {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
amount = UI.TextEntry {
|
amount = UI.TextEntry {
|
||||||
x = -8, ex = -4,
|
x = -11, ex = -7,
|
||||||
limit = 3,
|
limit = 3,
|
||||||
shadowText = '1',
|
shadowText = '1',
|
||||||
shadowTextColor = colors.gray,
|
shadowTextColor = colors.gray,
|
||||||
@@ -99,6 +93,11 @@ local page = UI.Page {
|
|||||||
},
|
},
|
||||||
help = 'Request amount',
|
help = 'Request amount',
|
||||||
},
|
},
|
||||||
|
depositToggle = UI.Button {
|
||||||
|
x = -6,
|
||||||
|
event = 'toggle_deposit',
|
||||||
|
text = '\215',
|
||||||
|
},
|
||||||
display = UI.Button {
|
display = UI.Button {
|
||||||
x = -3,
|
x = -3,
|
||||||
event = 'toggle_display',
|
event = 'toggle_display',
|
||||||
@@ -351,8 +350,8 @@ function page:eventHandler(event)
|
|||||||
|
|
||||||
elseif event.type == 'toggle_deposit' then
|
elseif event.type == 'toggle_deposit' then
|
||||||
config.deposit = not config.deposit
|
config.deposit = not config.deposit
|
||||||
Util.merge(self.menuBar.depositToggle, depositMode[config.deposit])
|
Util.merge(self.statusBar.depositToggle, depositMode[config.deposit])
|
||||||
self.menuBar:draw()
|
self.statusBar:draw()
|
||||||
self:setStatus(depositMode[config.deposit].help)
|
self:setStatus(depositMode[config.deposit].help)
|
||||||
Config.update('miloRemote', config)
|
Config.update('miloRemote', config)
|
||||||
|
|
||||||
@@ -445,7 +444,7 @@ end
|
|||||||
|
|
||||||
function page:enable()
|
function page:enable()
|
||||||
self:setFocus(self.statusBar.filter)
|
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)
|
UI.Page.enable(self)
|
||||||
if not config.server then
|
if not config.server then
|
||||||
self.setup:show()
|
self.setup:show()
|
||||||
|
|||||||
@@ -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 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
|
while true do
|
||||||
turtle.placeDown('minecraft:bucket:0')
|
turtle.placeDown('minecraft:bucket:0')
|
||||||
turtle.placeDown('minecraft:glass_bottle:0')
|
turtle.placeDown('minecraft:glass_bottle:0')
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ local Util = require('util')
|
|||||||
|
|
||||||
local colors = _G.colors
|
local colors = _G.colors
|
||||||
local device = _G.device
|
local device = _G.device
|
||||||
|
local turtle = _G.turtle
|
||||||
|
|
||||||
local context = Milo:getContext()
|
local context = Milo:getContext()
|
||||||
local machine
|
local machine
|
||||||
@@ -114,13 +115,14 @@ function pages.confirmation:validate()
|
|||||||
end
|
end
|
||||||
|
|
||||||
Milo:saveMachineRecipe(recipe, result, machine.name)
|
Milo:saveMachineRecipe(recipe, result, machine.name)
|
||||||
|
turtle.emptyInventory()
|
||||||
|
|
||||||
local displayName = itemDB:getName(result)
|
local displayName = itemDB:getName(result)
|
||||||
|
|
||||||
UI:setPage('listing', {
|
UI:setPage('listing', {
|
||||||
filter = displayName,
|
filter = displayName,
|
||||||
message = 'Learned: ' .. displayName,
|
message = 'Learned: ' .. displayName,
|
||||||
})
|
})
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user