app tweaks
This commit is contained in:
@@ -1134,7 +1134,6 @@ while bRunning do
|
|||||||
action = keyMapping.char
|
action = keyMapping.char
|
||||||
param = ie.ch
|
param = ie.ch
|
||||||
else
|
else
|
||||||
_debug(ie.code)
|
|
||||||
action = keyMapping[ie.code]
|
action = keyMapping[ie.code]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ Needs work
|
|||||||
run = "multiMiner.lua",
|
run = "multiMiner.lua",
|
||||||
},
|
},
|
||||||
[ "hexedit" ] = {
|
[ "hexedit" ] = {
|
||||||
title = "hexEdit",
|
title = "HexEdit",
|
||||||
category = "Apps",
|
category = "Apps",
|
||||||
requires = "advancedComputer",
|
requires = "advancedComputer",
|
||||||
icon = " dffddff55f\
|
icon = " dffddff55f\
|
||||||
|
|||||||
@@ -171,11 +171,6 @@ local function run(member, point)
|
|||||||
turtle.set({
|
turtle.set({
|
||||||
movementStrategy = 'goto',
|
movementStrategy = 'goto',
|
||||||
digPolicy = 'blacklist',
|
digPolicy = 'blacklist',
|
||||||
blacklist = {
|
|
||||||
'turtle',
|
|
||||||
'chest',
|
|
||||||
'shulker',
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -252,11 +247,17 @@ local function run(member, point)
|
|||||||
while not turtle.go(Point.above(spt)) do
|
while not turtle.go(Point.above(spt)) do
|
||||||
os.sleep(.5)
|
os.sleep(.5)
|
||||||
end
|
end
|
||||||
turtle.set({ digPolicy = 'dig' })
|
if turtle.selectSlotWithQuantity(0) then
|
||||||
turtle.go(spt)
|
turtle.set({ digPolicy = 'dig' })
|
||||||
|
end
|
||||||
|
while not turtle.go(spt) do
|
||||||
|
os.sleep(.5)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
turtle.gotoY(spt.y)
|
turtle.gotoY(spt.y)
|
||||||
turtle.go(spt)
|
while not turtle.go(spt) do
|
||||||
|
os.sleep(.5)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
70
ignore/Vision.lua
Normal file
70
ignore/Vision.lua
Normal file
@@ -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 <id>')
|
||||||
|
|
||||||
|
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()
|
||||||
@@ -14,14 +14,16 @@ function LimitTask:cycle(context)
|
|||||||
if res.limit then
|
if res.limit then
|
||||||
local items, count = Milo:getMatches(itemDB:splitKey(key), res)
|
local items, count = Milo:getMatches(itemDB:splitKey(key), res)
|
||||||
if count > res.limit then
|
if count > res.limit then
|
||||||
local amount = count - res.limit
|
local total = count - res.limit
|
||||||
for _, item in pairs(items) do
|
for _, item in pairs(items) do
|
||||||
amount = amount - context.storage:export(
|
local amount = context.storage:export(
|
||||||
trashcan,
|
trashcan,
|
||||||
nil,
|
nil,
|
||||||
math.min(amount, item.count),
|
math.min(total, item.count),
|
||||||
item)
|
item)
|
||||||
if amount <= 0 then
|
total = total - amount
|
||||||
|
-- amount == 0 means that trashcan is full
|
||||||
|
if amount <= 0 or total <= 0 then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,20 +19,32 @@ local turtle = _G.turtle
|
|||||||
fs.mount('sys/apps/system/turtle.lua', 'linkfs', 'packages/turtle/system/turtle.lua')
|
fs.mount('sys/apps/system/turtle.lua', 'linkfs', 'packages/turtle/system/turtle.lua')
|
||||||
|
|
||||||
-- provide a turtle function for scanning
|
-- provide a turtle function for scanning
|
||||||
function turtle.scan(blocks)
|
function turtle.scan(whitelist, blacklist)
|
||||||
local pt = turtle.point
|
local pt = turtle.point
|
||||||
|
|
||||||
local scanner = device['plethora:scanner'] or error('Scanner not equipped')
|
local scanner = device['plethora:scanner'] or error('Scanner not equipped')
|
||||||
|
|
||||||
if not blocks then
|
if not whitelist and not blacklist then
|
||||||
return Util.each(scanner:scan(), function(b)
|
return Util.each(scanner.scan(), function(b)
|
||||||
b.x = pt.x + b.x
|
b.x = pt.x + b.x
|
||||||
b.y = pt.y + b.y
|
b.y = pt.y + b.y
|
||||||
b.z = pt.z + b.z
|
b.z = pt.z + b.z
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Util.filter(scanner:scan(), function(b)
|
if whitelist then
|
||||||
if blocks[b.name] 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.x = pt.x + b.x
|
||||||
b.y = pt.y + b.y
|
b.y = pt.y + b.y
|
||||||
b.z = pt.z + b.z
|
b.z = pt.z + b.z
|
||||||
|
|||||||
Reference in New Issue
Block a user