app tweaks

This commit is contained in:
kepler155c@gmail.com
2019-07-09 14:06:15 -04:00
parent 8067f3bd99
commit 0144c61b7f
4 changed files with 20 additions and 6 deletions

View File

@@ -309,7 +309,7 @@ function page.statusBar:draw()
local t = self.parent.turtle local t = self.parent.turtle
if t then if t then
self.values.status = t.status self.values.status = t.status
self.values.distance = Util.round(t.distance, 2) self.values.distance = t.distance and Util.round(t.distance, 2)
self.values.fuel = Util.toBytes(t.fuel) self.values.fuel = Util.toBytes(t.fuel)
end end
UI.StatusBar.draw(self) UI.StatusBar.draw(self)

View File

@@ -522,11 +522,13 @@ function Storage:import(source, slot, count, item)
end end
-- find a chest locked with this item -- find a chest locked with this item
local doVoid
for node in self:onlineAdapters() do for node in self:onlineAdapters() do
if node.lock and node.lock[key] then if node.lock and node.lock[key] then
insert(node.adapter, item) insert(node.adapter, item)
if count > 0 and node.void then if count > 0 and node.void then
return total + self:trash(source, slot, count, item) doVoid = true
end end
end end
if count <= 0 then if count <= 0 then
@@ -534,6 +536,10 @@ function Storage:import(source, slot, count, item)
end end
end end
if doVoid then
return total + self:trash(source, slot, count, item)
end
-- is this item in some chest -- is this item in some chest
if self.cache[key] then if self.cache[key] then
for node, adapter in self:onlineAdapters() do for node, adapter in self:onlineAdapters() do

View File

@@ -72,7 +72,7 @@ local detail = UI.Page {
local function getPoint() local function getPoint()
local pt = { gps.locate() } local pt = { gps.locate() }
return { return pt[1] and {
x = pt[1], x = pt[1],
y = pt[2], y = pt[2],
z = pt[3], z = pt[3],
@@ -84,6 +84,10 @@ local function project(entities)
local pos = getPoint() local pos = getPoint()
local pts = { } local pts = { }
if not pos then
return
end
if not offset then if not offset then
offset = pos offset = pos
end end

View File

@@ -20,12 +20,16 @@ neural.assertModules({
local function dropOff() local function dropOff()
print('dropping') print('dropping')
local b = Util.find(neural.scan(), 'name', 'minecraft:hopper') local hoppers = Util.filter(neural.scan(), function(h)
return h.name == 'minecraft:hopper' and h.y == -1
end)
local _, b = next(hoppers)
if b then if b then
neural.walkTo({ x = b.x, y = 0, z = b.z }, 2) neural.walkTo({ x = b.x, y = 0, z = b.z }, 2)
b = Util.find(neural.scan(), 'name', 'minecraft:hopper') b = neural.getBlockMeta(0, -1, 0)
if b and math.abs(b.x) < 1 and math.abs(b.z) < 1 then if b.name == 'minecraft:hopper' then
print('dropped') print('dropped')
neural.getEquipment().drop(1) neural.getEquipment().drop(1)
neural.getEquipment().drop(2) neural.getEquipment().drop(2)