milo wip
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
local Craft = require('turtle.craft')
|
||||
local itemDB = require('itemDB')
|
||||
local Event = require('event')
|
||||
local Milo = require('milo')
|
||||
local UI = require('ui')
|
||||
local Util = require('util')
|
||||
@@ -59,7 +60,7 @@ local listingPage = UI.Page {
|
||||
},
|
||||
statusBar = UI.StatusBar {
|
||||
filter = UI.TextEntry {
|
||||
x = 1, ex = -4,
|
||||
x = 1, ex = -13,
|
||||
limit = 50,
|
||||
shadowText = 'filter',
|
||||
shadowTextColor = colors.gray,
|
||||
@@ -69,6 +70,13 @@ local listingPage = UI.Page {
|
||||
[ 'enter' ] = 'craft',
|
||||
},
|
||||
},
|
||||
storageStatus = UI.Button {
|
||||
x = -12, ex = -4,
|
||||
event = 'toggle_online',
|
||||
backgroundColor = colors.cyan,
|
||||
textColor = colors.lime,
|
||||
text = '',
|
||||
},
|
||||
display = UI.Button {
|
||||
x = -3,
|
||||
event = 'toggle_display',
|
||||
@@ -130,7 +138,7 @@ function listingPage:eventHandler(event)
|
||||
UI:exitPullEvents()
|
||||
|
||||
elseif event.type == 'resume' then
|
||||
Milo:resumeCrafting()
|
||||
context.storage:setOnline(true)
|
||||
|
||||
elseif event.type == 'eject' then
|
||||
local item = self.grid:getSelected()
|
||||
@@ -241,4 +249,13 @@ function listingPage:applyFilter()
|
||||
self.grid:setValues(t)
|
||||
end
|
||||
|
||||
Event.on({ 'storage_offline', 'storage_online' }, function(e, isOnline)
|
||||
listingPage.statusBar.storageStatus.text =
|
||||
isOnline and 'online' or 'offline'
|
||||
listingPage.statusBar.storageStatus.textColor =
|
||||
isOnline and colors.lime or colors.red
|
||||
listingPage.statusBar.storageStatus:draw()
|
||||
listingPage:sync()
|
||||
end)
|
||||
|
||||
UI:addPage('listing', listingPage)
|
||||
|
||||
Reference in New Issue
Block a user