Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print('Start the digging\n')
- print("Please give x lenght")
- term.setTextColor(colors.pink)
- local inputx = read()
- term.setTextColor(colors.white)
- print("Please give z lenght")
- term.setTextColor(colors.pink)
- local inputz = read()
- term.setTextColor(colors.white)
- print("Please give y height")
- term.setTextColor(colors.pink)
- local inputy = read()
- term.setTextColor(colors.white)
- print("Thank you, mining will begin")
- local function variablereset()
- x = tonumber(inputx)
- z = tonumber(inputz)
- s = True
- end
- y = tonumber(inputy)
- local function minex(x)
- r = 0
- while r < x do
- turtle.dig()
- turtle.forward()
- r = r + 1
- end
- end
- local function minez(z)
- r = 0
- while r < z do
- turtle.dig()
- turtle.forward()
- r = r + 1
- end
- end
- local function refuel_all()
- f = 1
- while f <= 16 do
- turtle.select(f)
- turtle.refuel()
- f = f + 1
- end
- end
- local function unload()
- turtle.turnLeft()
- turtle.turnLeft()
- r = 0
- while not turtle.detectDown() do
- turtle.down()
- print("turtle going down?")
- r = r + 1
- end
- u = 1
- while u <= 16 do
- turtle.select(u)
- turtle.drop()
- u = u + 1
- end
- if r > 0 then
- turtle.up(r)
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function horizontallayer(x, z)
- -- removed x = x
- a = 2
- n = 1
- cz = 2
- minex(x) --arrive en cx = x et en cz = 1
- turtle.turnLeft()
- minez(z - 1) --arrive en cx = x et en cz = z
- turtle.turnLeft()
- minex(x - 1) --arrive en cx = 1 et en cz = z
- turtle.turnLeft()
- minez(z - 2) --arrive en cx = 1 et en cz = 2
- turtle.turnLeft()
- while x - a > 0 and s == True do --changed y to z
- minex(x - a) --cx = x-1, cz = 2
- cx = x - n
- turtle.turnLeft()
- --face ouest
- print("facing West")
- print(cx)
- f = "West"
- if z - 1 - a > 0 then
- minez(z - 1 - a) --cx = x - 1, cz = z -1
- cz = z - n
- turtle.turnLeft()
- --face sud
- print("facing south")
- print(cz)
- f = "South"
- else s = false
- end
- if x - 1 - a > 0 and s == True then
- minex(x - 1 - a) --cx = 2, cz = z - 1
- cx = 1 + n
- turtle.turnLeft()
- --face east
- print("facing east")
- print(cx)
- f = "East"
- else s = false
- end
- if z - 2 - a > 0 then
- minez(z - 2 - a) --cx = 2, cz = 3
- cz = 2 + n
- turtle.turnLeft()
- --face north
- print("facing North")
- print(cz)
- f = "North"
- else s = false
- end
- n = n + 1
- a = a + 2
- end
- return cx, cz, f -- pas sûr syntaxe
- end
- local function gobacktostart()
- if f == "North" then
- turtle.turnRight()
- print("facing north?")
- elseif f == "East" then
- print("Already facing East")
- elseif f == "South" then
- turtle.turnLeft()
- print("facing south?")
- r = 0
- while r < z - 2 - a do -- achtung !!
- turtle.forward()
- r = r + 1
- end
- elseif f == "West" then
- turtle.turnLeft()
- turtle.turnLeft()
- print("facing west")
- end
- q = 0
- while q < cz - 1 do
- turtle.forward()
- q = q + 1
- end
- turtle.turnRight()
- q = 0
- while q < cx do
- turtle.forward()
- q = q + 1
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- h = 1
- while h <= y do
- variablereset()
- horizontallayer(x, z)
- print("now going back to start")
- gobacktostart()
- refuel_all()
- unload()
- h = h + 1
- if h <= y then
- turtle.digUp()
- turtle.up()
- else
- print('Jobs Done')
- end
- end
- while not turtle.detectDown() do
- turtle.down()
- end
Advertisement
Add Comment
Please, Sign In to add comment