Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Code Builder Block--
- local mode = 0
- local long = 0
- local larg = 0
- local haut = 0
- local way = 0
- local x = 0
- local function forward()
- repeat
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.placeDown()
- if turtle.forward() then
- TF = TF - 1
- end
- if turtle.getItemCount(1)<10 then
- turtle.select(2)
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.placeDown()
- turtle.select(1)
- turtle.suckDown(53)
- turtle.select(2)
- turtle.digDown()
- turtle.select(1)
- end
- until TF == 1
- TS = TS - 1
- end
- local function turn()
- if sens == 0 then
- turtle.turnLeft()
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.placeDown()
- turtle.dig()
- turtle.forward()
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.turnLeft()
- sens = 1
- else
- turtle.turnRight()
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.placeDown()
- turtle.dig()
- turtle.forward()
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.turnRight()
- sens = 0
- end
- end
- local function recall()
- if way == 0 and sens == 1 then
- turtle.turnLeft()
- repeat
- turtle.forward()
- TSB = TSB - 1
- until TSB == 0
- turtle.turnRight()
- repeat
- turtle.forward()
- TB = TB - 1
- until TB == 1
- turtle.turnLeft()
- turtle.turnLeft()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- end
- if way == 0 and sens == 0 then
- turtle.turnRight()
- repeat
- turtle.forward()
- TSB = TSB - 1
- until TSB == 0
- turtle.turnLeft()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- end
- if way == 1 and sens == 0 then
- turtle.turnRight()
- repeat
- turtle.forward()
- TSB = TSB - 1
- until TSB == 0
- turtle.turnLeft()
- repeat
- turtle.forward()
- TB = TB - 1
- until TB == 1
- turtle.turnRight()
- turtle.turnRight()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- end
- if way == 1 and sens == 1 then
- turtle.turnLeft()
- repeat
- turtle.forward()
- TSB = TSB - 1
- until TSB == 0
- turtle.turnRight()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- end
- end
- local function resetF()
- if TS ~= 0 then
- TF = long
- end
- end
- local function resetS()
- TS = larg
- end
- local function reset()
- TF = long
- TB = long
- TS = larg
- TSB = larg
- sens = way
- end
- local function sol()
- repeat
- repeat
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.placeDown()
- if turtle.forward() then
- TF = TF - 1
- end
- if turtle.getItemCount(1)<10 then
- turtle.select(2)
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.placeDown()
- turtle.select(1)
- turtle.suckDown(53)
- turtle.select(2)
- turtle.digDown()
- turtle.select(1)
- end
- until TF == 1
- turn()
- TS = TS - 1
- resetF()
- until TF == 1 and TS == 0
- end
- local function forwardM()
- repeat
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.placeDown()
- if turtle.forward() then
- TS = TS - 1
- end
- until TS == 0
- end
- local function start()
- if mode == 0 then
- repeat
- repeat
- forward()
- turn()
- resetF()
- until TF == 1 and TS == 0
- recall()
- haut = haut - 1
- reset()
- until haut == 0
- os.shutdown()
- end
- if mode == 1 then
- sol()
- recall()
- reset()
- haut = haut - 1
- repeat
- resetS()
- resetF()
- forward()
- if way == 0 then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- forwardM()
- if way == 0 then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- haut = haut - 1
- x = x + 1
- if x == 2 then
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- x = 0
- end
- print(x)
- until haut == 1 --A tester--
- --Place pour le plafond--
- os.shutdown()
- end
- if mode == 2 then
- end
- end
- --Start--
- print("Entrez le mode de build :")
- print("0 = Cube plein // 1 = Cube vide // 2 = Murs")
- input = io.read()
- mode = tonumber(input)
- print("Entrez la longueur :")
- input2 = io.read()
- long = tonumber(input2)
- print("Entrez la largeur :")
- input3 = io.read()
- larg = tonumber(input3)
- print("Entrez la hauteur :")
- input5 = io.read()
- haut = tonumber(input5)
- print("Poser dans quelle direction ?")
- print("0 = Gauche // 1 = Droite")
- input4 = io.read()
- way = tonumber(input4)
- TF = long
- TB = long
- TS = larg
- TSB = larg
- sens = way
- turtle.select(1)
- if turtle.detectUp then
- turtle.digUp()
- end
- turtle.up()
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement