Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- s = sensor.wrap("top")
- function playerRange(range)
- local result = nil
- x = s.getTargets()
- for k, v in pairs(x) do
- if v.Name == "Player" then
- local x = math.floor(math.abs(v.Position.X))
- local z = math.floor(math.abs(v.Position.Z))
- local y = math.floor(math.abs(v.Position.Y))
- if (x <= range) or (y <= range) or (z <= range) then
- local result = true
- else local result = false
- end
- end
- end
- return result
- end
- mobs = 0
- while true do
- while playerRange(5) do
- if turtle.attack() then
- mobs = mobs + 1
- term.setCursorPos(1,1) term.clear()
- print("Skeletons Killed: ".. mobs)
- end
- os.sleep(.1)
- end
- os.sleep(1)
- term.clear() term.setCursorPos(1,1)
- print("Flip lever to toggle grinding.")
- end
Advertisement
Add Comment
Please, Sign In to add comment