farmer: allow chest to be above as well as below
This commit is contained in:
@@ -84,7 +84,7 @@ local function scan()
|
|||||||
return b.y == 0
|
return b.y == 0
|
||||||
end
|
end
|
||||||
if b.action == 'drop' then
|
if b.action == 'drop' then
|
||||||
return doDropOff and b.y == -1
|
return doDropOff and (b.y == -1 or b.y == 1)
|
||||||
end
|
end
|
||||||
if b.action == 'bash-smash' then
|
if b.action == 'bash-smash' then
|
||||||
if b.y == -1 then
|
if b.y == -1 then
|
||||||
@@ -135,17 +135,20 @@ local function harvest(blocks)
|
|||||||
turtle.digForwardAt(b)
|
turtle.digForwardAt(b)
|
||||||
|
|
||||||
elseif b.action == 'drop' and not dropped then
|
elseif b.action == 'drop' and not dropped then
|
||||||
if turtle.go(Point.above(b)) then
|
if turtle.go(b.y == 1 and Point.below(b) or Point.above(b)) then
|
||||||
|
local dropFn = b.y == 1 and turtle.dropUp or turtle.dropDown
|
||||||
|
local dropDir = b.y == 1 and 'down' or 'up'
|
||||||
|
|
||||||
turtle.eachFilledSlot(function(slot)
|
turtle.eachFilledSlot(function(slot)
|
||||||
if not retain[slot.name] and not retain[slot.key] then
|
if not retain[slot.name] and not retain[slot.key] then
|
||||||
turtle.select(slot.index)
|
turtle.select(slot.index)
|
||||||
turtle.dropDown()
|
dropFn()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
local summed = turtle.getSummedInventory()
|
local summed = turtle.getSummedInventory()
|
||||||
for k,v in pairs(summed) do
|
for k,v in pairs(summed) do
|
||||||
if v.count > 16 then
|
if v.count > 16 then
|
||||||
turtle.dropDown(k, v.count - 16)
|
dropFn(k, v.count - 16)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -157,7 +160,7 @@ local function harvest(blocks)
|
|||||||
if inv and inv.list then
|
if inv and inv.list then
|
||||||
for k, v in pairs(inv.list()) do
|
for k, v in pairs(inv.list()) do
|
||||||
if FUEL[table.concat({ v.name, v.damage }, ':')] then
|
if FUEL[table.concat({ v.name, v.damage }, ':')] then
|
||||||
local count = inv.pushItems('up', k, v.count)
|
local count = inv.pushItems(dropDir, k, v.count)
|
||||||
if count > 0 then
|
if count > 0 then
|
||||||
turtle.refuel(v.name, v.count)
|
turtle.refuel(v.name, v.count)
|
||||||
print('Fuel: ' .. turtle.getFuelLevel())
|
print('Fuel: ' .. turtle.getFuelLevel())
|
||||||
|
|||||||
Reference in New Issue
Block a user