Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local time1 = os.clock()
- for i = 1, 15 do
- turtle.forward()
- end
- local time2 = os.clock()
- local tTime = time2 - time1
- print("for -> " .. (tTime / 15) .. "s per block")
- local time1 = os.clock()
- for i = 1, 15 do
- turtle.detect()
- turtle.forward()
- end
- local time2 = os.clock()
- local tTime = time2 - time1
- print("det+for -> " .. (tTime / 15) .. "s per block")
- --====================================================--
- -- miner constants
- FACE_N = 0
- FACE_E = 1
- FACE_S = 2
- FACE_W = 3
- miner = {} -- the turtle
- miner['direction'] = 0
- miner['x'] = 0
- miner['y'] = 0
- miner['z'] = 0
- miner['start_x'], miner['start_z'], miner['start_y'] = miner['x'], miner['z'], miner['y']
- miner['start_direction'] = miner['direction']
- function miner.updateHz(n)
- n = n or 1
- if miner['direction'] == FACE_N then miner['z'] = miner['z'] - n
- elseif miner['direction'] == FACE_S then miner['z'] = miner['z'] + n
- elseif miner['direction'] == FACE_W then miner['x'] = miner['x'] - n
- elseif miner['direction'] == FACE_E then miner['x'] = miner['x'] + n
- end
- end
- function miner.forward(n)
- n = n or 1
- for i=1,n do
- if (not turtle.forward()) then return false end
- miner.updateHz(1)
- end
- return true
- end
- local time1 = os.clock()
- for i=1,15 do
- if turtle.getFuelLevel() < 1 then
- print(123)
- end
- if (not miner.forward()) then
- -- this needs to be looped in case of airdrops (sand, gravel etc)
- -- also to wait for despawn?
- while turtle.detect() do
- turtle.dig()
- os.sleep(0.1)
- end
- while not miner.forward() do
- turtle.attack()
- end
- end
- end
- local time2 = os.clock()
- local tTime = time2 - time1
- print("det+dig+for -> " .. (tTime / 15) .. "s per block")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement