Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
- Copyright (C) 2019 Yui <notyui@yui.pet>
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. You just DO WHAT THE FUCK YOU WANT TO.
- ]]--
- local LEFT = 1
- local RIGHT = 0
- -- CONFIG START --
- local end_pos = {
- x = 17,
- y = 60,
- z = 17
- }
- local direction = LEFT
- --- CONFIG END ---
- local pos = {
- x = 0,
- y = 0,
- z = 0
- }
- function move_forward(steps)
- for i = 1, steps do
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- end
- end
- function turn_left()
- turtle.turnLeft()
- move_forward(1)
- turtle.turnLeft()
- end
- function turn_right()
- turtle.turnRight()
- move_forward(1)
- turtle.turnRight()
- end
- function dig_layer()
- while pos.z ~= end_pos.z do
- move_forward(end_pos.x - 1)
- pos.z = pos.z + 1
- direction = not direction
- if pos.z ~= end_pos.z then
- if direction then
- turn_left()
- else
- turn_right()
- end
- end
- end
- end
- function move_down(steps)
- for i = 1, steps do
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- end
- end
- function main()
- while pos.y ~= end_pos.y do
- dig_layer()
- pos = {x = 0, y = pos.y + 1, z = 0}
- direction = not direction
- if pos.y ~= end_pos.y then
- turtle.turnLeft()
- turtle.turnLeft()
- move_down(1)
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement