spaces->tab, equipper improvements, supertreefarm rewrite, follow improvements, sensor cleanup, milo multiple items allowed in recipes, remote canvas access
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--[[
|
||||
Pickup items from a flat area and drop into a hopper.
|
||||
Must be a 1 high mob
|
||||
Pickup items from a flat area and drop into a hopper.
|
||||
Must be a 1 high mob
|
||||
]]
|
||||
|
||||
local neural = require('neural.interface')
|
||||
@@ -11,66 +11,66 @@ local Util = require('util')
|
||||
local os = _G.os
|
||||
|
||||
neural.assertModules({
|
||||
'plethora:sensor',
|
||||
'plethora:scanner',
|
||||
'plethora:kinetic',
|
||||
'plethora:introspection',
|
||||
'plethora:sensor',
|
||||
'plethora:scanner',
|
||||
'plethora:kinetic',
|
||||
'plethora:introspection',
|
||||
})
|
||||
|
||||
local function dropOff()
|
||||
print('dropping')
|
||||
print('dropping')
|
||||
|
||||
local b = Util.find(neural.scan(), 'name', 'minecraft:hopper')
|
||||
if b then
|
||||
neural.walkTo({ x = b.x, y = 0, z = b.z }, 2)
|
||||
local b = Util.find(neural.scan(), 'name', 'minecraft:hopper')
|
||||
if b then
|
||||
neural.walkTo({ x = b.x, y = 0, z = b.z }, 2)
|
||||
|
||||
b = Util.find(neural.scan(), 'name', 'minecraft:hopper')
|
||||
if b and math.abs(b.x) < 1 and math.abs(b.z) < 1 then
|
||||
print('dropped')
|
||||
neural.getEquipment().drop(1)
|
||||
neural.getEquipment().drop(2)
|
||||
os.sleep(1)
|
||||
end
|
||||
end
|
||||
b = Util.find(neural.scan(), 'name', 'minecraft:hopper')
|
||||
if b and math.abs(b.x) < 1 and math.abs(b.z) < 1 then
|
||||
print('dropped')
|
||||
neural.getEquipment().drop(1)
|
||||
neural.getEquipment().drop(2)
|
||||
os.sleep(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function pickup(id)
|
||||
local b = neural.getMetaByID(id)
|
||||
if b then
|
||||
neural.walkTo(b, 2)
|
||||
local b = neural.getMetaByID(id)
|
||||
if b then
|
||||
neural.walkTo(b, 2)
|
||||
|
||||
local amount = neural.getEquipment().suck()
|
||||
print('sucked: ' .. amount)
|
||||
if amount > 0 then
|
||||
Sound.play('entity.item.pickup')
|
||||
return true
|
||||
end
|
||||
end
|
||||
local amount = neural.getEquipment().suck()
|
||||
print('sucked: ' .. amount)
|
||||
if amount > 0 then
|
||||
Sound.play('entity.item.pickup')
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
while true do
|
||||
local sensed = Util.reduce(neural.sense(), function(acc, s)
|
||||
if Util.round(s.y) == 0 and s.name == 'Item' then
|
||||
acc[s.id] = s
|
||||
end
|
||||
return acc
|
||||
end, { })
|
||||
local sensed = Util.reduce(neural.sense(), function(acc, s)
|
||||
if Util.round(s.y) == 0 and s.name == 'Item' then
|
||||
acc[s.id] = s
|
||||
end
|
||||
return acc
|
||||
end, { })
|
||||
|
||||
local pt = { x = 0, y = 0, z = 0 }
|
||||
while true do
|
||||
local b = Point.closest(pt, sensed)
|
||||
if not b then
|
||||
os.sleep(5)
|
||||
break
|
||||
end
|
||||
sensed[b.id] = nil
|
||||
local pt = { x = 0, y = 0, z = 0 }
|
||||
while true do
|
||||
local b = Point.closest(pt, sensed)
|
||||
if not b then
|
||||
os.sleep(5)
|
||||
break
|
||||
end
|
||||
sensed[b.id] = nil
|
||||
|
||||
if pickup(b.id) then
|
||||
pt = b
|
||||
else
|
||||
dropOff()
|
||||
break
|
||||
end
|
||||
end
|
||||
if pickup(b.id) then
|
||||
pt = b
|
||||
else
|
||||
dropOff()
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user