Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = { ... }
- if #args ~= 3 then
- term.setCursorPos(1,1)
- term.clear()
- print("hole Hoehe|Breite|Tiefe")
- error()
- end
- x = args[1]+0
- xDone = 1
- y = args[2]+0
- yDone = 1
- z = args[3]+0
- zDone = 1
- energy = x*y*z
- done = 0
- item = 1
- direction = 0
- if (x < 2) or (y < 2) or (z < 2) then
- print("Werte kleiner als 2 werden nicht aktzeptiert!")
- error()
- end
- end
- function checkFuelToWork()
- while item <= 16 do
- turtle.select(item)
- turtle.refuel()
- item = item+1
- end
- turtle.select(1)
- curFuel = turtle.getFuelLevel()
- coal = energy/80
- if energy > curFuel then
- term.clear()
- term.setCursorPos(1,1)
- print("Es wird "..energy.." Energie benoetigt.")
- print("Bitte mindestens "..coal.." Kohle nachlegen!")
- error()
- end
- end
- function mainLoop()
- while zDone <= z do
- while yDone <= y do
- while xDone < x do
- digFor()
- xDone = xDone+1
- runGUI()
- end
- turnIt()
- yDone = yDone+1
- xDone = 1
- end
- goDown()
- zDone = zDone+1
- yDone = 1
- end
- end
- function digFor()
- turtle.dig()
- while not turtle.forward() do
- turtle.attack()
- sleep(0.5)
- end
- end
- function goDown()
- if x ~= xDone then
- turtle.digDown()
- while not turtle.down() do
- turtle.attackDown()
- end
- else
- comeBack()
- end
- end
- function turnIt()
- if (y == 1) or (yDone == y) then
- turtle.turnRight()
- turtle.turnRight()
- else
- if direction == 0 then
- turtle.turnRight()
- digFor()
- turtle.turnRight()
- direction = 1
- else
- turtle.turnLeft()
- digFor()
- turtle.turnLeft()
- direction = 0
- end
- end
- end
- function runGUI()
- term.clear()
- term.setCursorPos(1,1)
- done = done + 1
- percentage = done/energy*100
- print(percentage.."% abgeschlossen...")
- end
- function comeBack()
- xUp=1
- while xUp < x do
- turtle.up()
- xUp = xUp + 1
- end
- end
- checkFuelToWork()
- mainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement