Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- slot 1 = smelt item slot
- slot 2 = fuel
- slot 3 = output
- ]]
- local chests = {}
- local outputChest = "quark:quark_chest_648"
- local bufferChest = "minecraft:chest_1283"
- local furnaces = {}
- local cache = {}
- local fi = 1
- local find, count = ...
- local mon = peripheral.find( "monitor" )
- if mon then mon.setTextScale( 0.5 ) term.redirect( mon ) end
- local function deepCopy( from, to )
- if type( from ) == "table" then
- for k, v in pairs( from ) do
- if type( v ) == "table" then
- to[ k ] = {}
- deepCopy( v, to[ k ] )
- else
- to[ k ] = v
- end
- end
- end
- end
- local getChests = function()
- local a = peripheral.getNames()
- chests = {}
- for i = 1,#a do
- if a:find( "chest" ) then
- if a ~= outputChest and a ~= bufferChest then
- chests[ #chests + 1 ] = a[ i ]
- end
- end
- end
- end
- local getFurnaces = function()
- local a = peripheral.getNames()
- furnaces = {}
- for i = 1,#a do
- if a[ i ]:find( "furnace" ) then
- furnaces[ #furnaces + 1 ] = a[ i ]
- end
- end
- end
- local notify = function( gb, ... )
- local args = { ... }
- for i = 1,#args do
- if gb then
- print( args[ i ] )
- else
- printError( args[ i ] )
- end
- end
- end
- local checkFurnace = function( furnace )
- local furn = peripheral.wrap( furnace )
- if type( furn ) == "table" then
- local inv = furn.list()
- return true, inv
- else
- notify( false, "Failed to find furnace " .. tostring( furnace ) )
- return false
- end
- end
- local updateCache = function()
- local buf = peripheral.wrap( bufferChest )
- local inv = buf.list()
- cache = {}
- deepCopy( inv, cache )
- end
- updateCache()
- print( textutils.serialize( cache ) )
- print( "---" )
- getFurnaces()
- for i = 1,#furnaces do
- print( textutils.serialize( {checkFurnace( furnaces[ i ] )} ) )
- print( "---" )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement