mobRancher

This commit is contained in:
kepler155c@gmail.com
2019-04-29 21:50:52 -04:00
parent 23c81cd546
commit e3a3ab004c
3 changed files with 142 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
local Point = require('point')
local Sound = require('sound')
local Util = require('util')
local device = _G.device
@@ -27,8 +28,9 @@ local function dropOff()
print(b.x, b.z)
end
if b and math.abs(b.x) < 1 and math.abs(b.z) < 1 then
print('dropped')
print('dropped')
sensor.getEquipment().drop(1)
sensor.getEquipment().drop(2)
os.sleep(1)
end
end
@@ -38,7 +40,7 @@ while true do
local sensed = Util.reduce(sensor.sense(), function(acc, s)
s.y = Util.round(s.y)
if s.y == 0 and s.id ~= id then
if s.y == 0 and s.name == 'Item' then
--s.x = Util.round(s.x)
--s.z = Util.round(s.z)
acc[s.id] = s
@@ -65,10 +67,14 @@ while true do
local amount = sensor.getEquipment().suck(1)
print('sucked: ' .. amount)
if amount == 0 then
print('dropping')
dropOff()
break
amount = sensor.getEquipment().suck(2)
if amount == 0 then
print('dropping')
dropOff()
break
end
end
Sound.play('entity.item.pickup')
end
end