diff --git a/common/edit.lua b/common/edit.lua index f711fa9..4484f9a 100644 --- a/common/edit.lua +++ b/common/edit.lua @@ -1134,7 +1134,6 @@ while bRunning do action = keyMapping.char param = ie.ch else -_debug(ie.code) action = keyMapping[ie.code] end end diff --git a/common/etc/apps.db b/common/etc/apps.db index 642b565..812295b 100644 --- a/common/etc/apps.db +++ b/common/etc/apps.db @@ -115,7 +115,7 @@ Needs work run = "multiMiner.lua", }, [ "hexedit" ] = { - title = "hexEdit", + title = "HexEdit", category = "Apps", requires = "advancedComputer", icon = "  dfŸfdŒdf›f5Œ5f›\ diff --git a/common/multiMiner.lua b/common/multiMiner.lua index b8ef63c..9330cc3 100644 --- a/common/multiMiner.lua +++ b/common/multiMiner.lua @@ -171,11 +171,6 @@ local function run(member, point) turtle.set({ movementStrategy = 'goto', digPolicy = 'blacklist', - blacklist = { - 'turtle', - 'chest', - 'shulker', - }, }) end @@ -252,11 +247,17 @@ local function run(member, point) while not turtle.go(Point.above(spt)) do os.sleep(.5) end - turtle.set({ digPolicy = 'dig' }) - turtle.go(spt) + if turtle.selectSlotWithQuantity(0) then + turtle.set({ digPolicy = 'dig' }) + end + while not turtle.go(spt) do + os.sleep(.5) + end else turtle.gotoY(spt.y) - turtle.go(spt) + while not turtle.go(spt) do + os.sleep(.5) + end end end) diff --git a/ignore/Vision.lua b/ignore/Vision.lua new file mode 100644 index 0000000..7c28b2f --- /dev/null +++ b/ignore/Vision.lua @@ -0,0 +1,70 @@ +local Event = require('event') +local Point = require('point') +local Proxy = require('proxy') +local Util = require('util') + +local device = _G.device +local network = _G.network + +local glasses = device['plethora:glasses'] or error('Overlay glasses are required') + +local id = tonumber(({...})[1]) or + error('Syntax: Vision ') + +local blacklist = { + [ 'minecraft:air'] = true, +} +local turtle, socket = Proxy.create(id, 'device/plethora:scanner') +if not turtle then + error('nope') +end +local current +local projecting = { } +local canvas = glasses.canvas3d().create() + +local function displayBlocks(scanned) +print('redrawing') + local blocks = { } + for _, b in pairs(scanned) do + -- track block's world position + b.id = table.concat({ b.x, b.y, b.z }, ':') + blocks[b.id] = b + end + + for _, b in pairs(blocks) do + if not projecting[b.id] then + projecting[b.id] = b + pcall(function() + b.box = canvas.addItem({ b.x / 40, b.y / 40 - .25, b.z / 40 }, b.name, b.damage, .025) + end) + -- b.box.setDepthTested(false) + end + end + + for _, b in pairs(projecting) do + if b.box and not blocks[b.id] then + b.box.remove() + projecting[b.id] = nil + end + end +end + +Event.onInterval(1, function() + local t = network[id] + + --if t and t.point and (not current or not Point.same(t.point, current)) then + -- current = t.point + local scanned = turtle.scan(blacklist) + if scanned then + displayBlocks(Util.filter(turtle.scan(), function(b) + if not blacklist[b.name] then + return true + end + end)) + end + --end +end) + +Event.pullEvents() +canvas:clear() +socket:close() diff --git a/milo/plugins/limitTask.lua b/milo/plugins/limitTask.lua index 5001602..4279ffc 100644 --- a/milo/plugins/limitTask.lua +++ b/milo/plugins/limitTask.lua @@ -14,14 +14,16 @@ function LimitTask:cycle(context) if res.limit then local items, count = Milo:getMatches(itemDB:splitKey(key), res) if count > res.limit then - local amount = count - res.limit + local total = count - res.limit for _, item in pairs(items) do - amount = amount - context.storage:export( + local amount = context.storage:export( trashcan, nil, - math.min(amount, item.count), + math.min(total, item.count), item) - if amount <= 0 then + total = total - amount + -- amount == 0 means that trashcan is full + if amount <= 0 or total <= 0 then break end end diff --git a/turtle/autorun/startup.lua b/turtle/autorun/startup.lua index e09f5cd..99c7c90 100644 --- a/turtle/autorun/startup.lua +++ b/turtle/autorun/startup.lua @@ -19,20 +19,32 @@ local turtle = _G.turtle fs.mount('sys/apps/system/turtle.lua', 'linkfs', 'packages/turtle/system/turtle.lua') -- provide a turtle function for scanning -function turtle.scan(blocks) +function turtle.scan(whitelist, blacklist) local pt = turtle.point + local scanner = device['plethora:scanner'] or error('Scanner not equipped') - if not blocks then - return Util.each(scanner:scan(), function(b) + if not whitelist and not blacklist then + return Util.each(scanner.scan(), function(b) b.x = pt.x + b.x b.y = pt.y + b.y b.z = pt.z + b.z end) end - return Util.filter(scanner:scan(), function(b) - if blocks[b.name] then + if whitelist then + return Util.filter(scanner.scan(), function(b) + if whitelist[b.name] then + b.x = pt.x + b.x + b.y = pt.y + b.y + b.z = pt.z + b.z + return true + end + end) + end + + return Util.filter(scanner.scan(), function(b) + if not blacklist[b.name] then b.x = pt.x + b.x b.y = pt.y + b.y b.z = pt.z + b.z