Replace process.api with Event

This commit is contained in:
kepler155c@gmail.com
2017-07-28 19:01:59 -04:00
parent f8bcf90a6b
commit be51935662
21 changed files with 326 additions and 343 deletions

View File

@@ -999,32 +999,29 @@ jobMonitor()
jobListGrid:draw()
jobListGrid:sync()
local function craftingThread()
Event.onInterval(5, function()
while true do
os.sleep(5)
if not craftingPaused then
local items = chestProvider:listItems()
if Util.size(items) == 0 then
jobListGrid.parent:clear()
jobListGrid.parent:centeredWrite(math.ceil(jobListGrid.parent.height/2), 'No items in system')
jobListGrid:sync()
if not craftingPaused then
local items = chestProvider:listItems()
if Util.size(items) == 0 then
jobListGrid.parent:clear()
jobListGrid.parent:centeredWrite(math.ceil(jobListGrid.parent.height/2), 'No items in system')
jobListGrid:sync()
else
local craftList = watchResources(items)
jobListGrid:setValues(craftList)
--jobListGrid:draw()
--jobListGrid:sync()
craftItems(craftList, items)
jobListGrid:update()
jobListGrid:draw()
jobListGrid:sync()
craftList = getAutocraftItems(items) -- autocrafted items don't show on job monitor
craftItems(craftList, items)
end
else
local craftList = watchResources(items)
jobListGrid:setValues(craftList)
--jobListGrid:draw()
--jobListGrid:sync()
craftItems(craftList, items)
jobListGrid:update()
jobListGrid:draw()
jobListGrid:sync()
craftList = getAutocraftItems(items) -- autocrafted items don't show on job monitor
craftItems(craftList, items)
end
end
end
end)
UI:pullEvents(craftingThread)
UI:pullEvents()
jobListGrid.parent:reset()