milo status panel

This commit is contained in:
kepler155c@gmail.com
2019-02-27 19:35:26 -05:00
parent 177533b760
commit 10787dd2b3
3 changed files with 35 additions and 24 deletions

View File

@@ -107,7 +107,7 @@ local function process(list)
end end
if item and item.count > 0 then if item and item.count > 0 then
if not cooking or cooking.name == item.name then if not cooking then -- or cooking.name == item.name then
local count = cooking and cooking.count or 0 local count = cooking and cooking.count or 0
if count < 64 then if count < 64 then
print('cooking : ' .. furnace.name) print('cooking : ' .. furnace.name)

View File

@@ -97,7 +97,7 @@ local function createPage(node)
}, },
buttons = UI.Window { buttons = UI.Window {
y = -1, y = -1,
backgroundColor = colors.gray, backgroundColor = colors.black,
prevButton = UI.Button { prevButton = UI.Button {
x = 1, width = 5, x = 1, width = 5,
event = 'previous', event = 'previous',

View File

@@ -86,32 +86,38 @@ local function createPage(node)
[1] = UI.Tab { [1] = UI.Tab {
tabTitle = 'Overview', tabTitle = 'Overview',
backgroundColor = colors.black, backgroundColor = colors.black,
storageLabel = UI.Text {
x = 2, ex = -1, y = 2,
},
storage = UI.ProgressBar {
x = 2, ex = -2, y = 3, height = 3,
},
unlockedLabel = UI.Text {
x = 2, ex = -1, y = 7,
},
unlocked = UI.ProgressBar {
x = 2, ex = -2, y = 8, height = 3,
},
onlineLabel = UI.Text { onlineLabel = UI.Text {
x = 2, ex = -1, y = 12, x = 2, y = 2,
value = 'Storage Status', value = 'Storage Status',
}, },
online = UI.ProgressBar { onlineText = UI.Text {
x = 18, ex = -2, y = 2,
},
tpsLabel = UI.Text {
x = 2, y = 3,
value = 'Tasks/sec',
},
tpsText = UI.Text {
x = 18, ex = -2, y = 3,
},
storageLabel = UI.Text {
x = 2, ex = -1, y = 6,
},
storage = UI.ProgressBar {
x = 2, ex = -2, y = 7, height = 3,
},
unlockedLabel = UI.Text {
x = 2, ex = -1, y = 12,
},
unlocked = UI.ProgressBar {
x = 2, ex = -2, y = 13, height = 3, x = 2, ex = -2, y = 13, height = 3,
value = 100,
}, },
craftingLabel = UI.Text { craftingLabel = UI.Text {
x = 2, ex = -1, y = 17, x = 2, ex = -1, y = 18,
value = 'Crafting Status', value = 'Crafting Status',
}, },
crafting = UI.ProgressBar { crafting = UI.ProgressBar {
x = 2, ex = -2, y = 18, height = 3, x = 2, ex = -2, y = 19, height = 3,
value = 100, value = 100,
}, },
}, },
@@ -308,10 +314,10 @@ Unlocked Slots : %d of %d (%d%%)
function overviewTab:draw() function overviewTab:draw()
local _, stats = getStorageStats() local _, stats = getStorageStats()
self.online.progressColor = context.storage:isOnline() and colors.green or colors.red self.onlineText.textColor = context.storage:isOnline() and colors.green or colors.red
self.onlineText.value = context.storage:isOnline() and 'Online' or 'Offline'
self.onlineLabel.value = string.format('Storage Status: (%s chests)', self.tpsText.value = tostring(Util.round(self.tasks / (os.clock() - self.timer), 2))
stats.totalChests)
local total, crafted = 0, 0 local total, crafted = 0, 0
for _,v in pairs(context.craftingQueue) do for _,v in pairs(context.craftingQueue) do
@@ -356,20 +362,25 @@ Unlocked Slots : %d of %d (%d%%)
end end
function overviewTab:enable() function overviewTab:enable()
self.timer = os.clock()
self.tasks = 0
self.handle = Event.onInterval(5, function() self.handle = Event.onInterval(5, function()
self:draw() self:draw()
self:sync() self:sync()
end) end)
self.ehandle = Event.on({ 'milo_resume', 'milo_pause', 'storage_offline', 'storage_online' }, function() self.handle2 = Event.on({ 'milo_resume', 'milo_pause', 'storage_offline', 'storage_online' }, function()
self:draw() self:draw()
self:sync() self:sync()
end) end)
self.handle3 = Event.on('plethora_task', function()
self.tasks = self.tasks + 1
end)
UI.Tab.enable(self) UI.Tab.enable(self)
end end
function overviewTab:disable() function overviewTab:disable()
Event.off(self.handle) Event.off(self.handle)
Event.off(self.ehandle) Event.off(self.handle2)
UI.Tab.disable(self) UI.Tab.disable(self)
end end