package manager + tweaks to milo

This commit is contained in:
kepler155c
2018-11-06 16:21:31 -05:00
parent d113b1da1a
commit 01452ced72
9 changed files with 117 additions and 63 deletions

View File

@@ -2,8 +2,10 @@
required = {
'opus-develop-1.8',
},
title = 'Inventory manager for Opus OS',
title = 'Milo: Advanced inventory management',
repository = 'kepler155c/opus-apps/develop-1.8/milo',
description = [[ ... ]],
description = [[Provides AE style crafting in computercraft.
Includes Importing, exporting, autocrafting, replenish and limits, and much more.
Includes over 200 standard Minecraft recipes.]],
licence = 'MIT',
}

View File

@@ -69,7 +69,7 @@ local context = {
_G._p = context --debug
Event.on('storage_offline', function()
Milo:showError('A storage chest has gone offline, ctrl-l to continue')
Milo:showError('A storage chest has gone offline - See configuration screen')
end)
Milo:init(context)
@@ -99,8 +99,7 @@ end
Milo:clearGrid()
local page = UI:getPage('listing')
UI:setPage(page)
UI:setPage(UI:getPage('listing'))
Event.on('milo_cycle', function()
if not context.turtleBusy then

54
milo/apps/furni.lua Normal file
View File

@@ -0,0 +1,54 @@
--[[
Use 4 furnaces at once to smelt items.
Set up a turtle with a hopper on top and surrounded by furnaces.
Set the hopper as a machine used for crafting.
Export coal to slot 2 of each furnace and import from slot 3.
--]]
_G.requireInjector(_ENV)
local Event = require('event')
local Util = require('util')
local device = _G.device
local os = _G.os
local turtle = _G.turtle
local intro =
device['plethora:introspection']
local inv = intro.getInventory()
Event.on('turtle_inventory', function()
while true do
local list = inv.list()
local sleepTime = 10
if Util.empty(list) then
break
end
for k,slot in pairs(list) do
for _ = 1, 4 do
local count = 0
local s, m = pcall(function()
count = inv.pushItems('front', k, 8, 1)
end)
if not s then
_G.printError(m)
end
if count > 0 then
sleepTime = 0
end
turtle.turnRight()
slot.count = slot.count - count
if slot.count <= 0 then
break
end
end
end
os.sleep(sleepTime)
end
end)
os.queueEvent('turtle_inventory')
Event.pullEvents()

View File

@@ -58,7 +58,7 @@ local machinesPage = UI.Page {
function machinesPage.grid:getDisplayValues(row)
row = Util.shallowCopy(row)
local t = { row.name:match(':(.+)_(%d+)') }
local t = { row.name:match(':(.+)_(%d+)$') }
if t and #t == 2 then
row.name, row.suffix = table.unpack(t)
row.name = row.name .. '_' .. row.suffix