milo crafting updates

This commit is contained in:
kepler155c@gmail.com
2019-06-27 16:29:37 -04:00
parent bbd36ec96a
commit 03643bcd34
6 changed files with 81 additions and 27 deletions

View File

@@ -15,13 +15,17 @@ function craftTask:craft(recipe, item)
return
end
-- TODO: refactor into craft.lua
Craft.processPending(item, context.storage)
-- create a mini-list of items that are required for this recipe
item.ingredients = Craft.getResourceList(
recipe, Milo:listItems(), item.requested - item.crafted, item.pending)
for k,v in pairs(item.ingredients) do
if item.pending[k] then
v.status = 'processing'
v.statusCode = Craft.STATUS_INFO
end
end
for k, v in pairs(item.ingredients) do
v.crafted = v.used
v.count = v.used
@@ -39,6 +43,12 @@ function craftTask:craft(recipe, item)
end
function craftTask:cycle()
for _,item in pairs(context.craftingQueue) do
Craft.processPending(item, context.storage)
end
context.storage.activity = { }
for _,key in pairs(Util.keys(context.craftingQueue)) do
local item = context.craftingQueue[key]
if item.requested - item.crafted > 0 then

View File

@@ -156,8 +156,12 @@ local function createPage(node)
end
if row.requested then
row.remaining = math.max(0, row.requested - row.crafted)
--_syslog('%d %d %d %d', row.remaining, row.requested, row.total, row.crafted)
row.status = (row.status or '') ..
string.format(' %d of %d', row.crafted + row.total, row.total + row.requested)
else
row.displayName = ' ' .. row.displayName
row.status = (row.status or '') .. string.format(' %d of %d', row.count, row.total)
end
--row.progress = string.format('%d/%d', row.crafted, row.count)
return row

View File

@@ -91,14 +91,16 @@ local function createPage(node)
value = 'Storage Status',
},
onlineText = UI.Text {
x = 18, ex = -2, y = 2,
x = 18, y = 2,
width = 8,
},
tpsLabel = UI.Text {
x = 2, y = 3,
value = 'Tasks/sec',
},
tpsText = UI.Text {
x = 18, ex = -2, y = 3,
x = 18, y = 3,
width = 8,
},
tasksLabel = UI.Text {
x = -18, y = 3,
@@ -188,6 +190,7 @@ local function createPage(node)
local stateTab = page.tabs[4]
local activityTab = page.tabs[5]
local taskTab = page.tabs[6]
_G._p2 = overviewTab
local function getStorageStats()
local stats = { }