Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- DECLARATIONS ->
- function print_inv()
- for i=1 , 16 do
- local data = turtle.getItemDetail(i)
- turtle.select(i)
- if turtle.getItemDetail(i) ~= nil then
- print("Slot " .. i .." : " .. data.count .. " " .. data.name)
- else
- print("Slot " .. i .." : Empty !")
- end
- end
- turtle.select(1)
- end
- --[[
- function organise()
- for i=1 , 16 do
- j = i
- local data = turtle.getItemDetail(i)
- turtle.select(i + 1)
- if turtle.getItemDetail(i) == nil then
- turtle.transferTo(j)
- end
- end
- turtle.select(1)
- end
- ]]
- function ft_fwd(nb)
- i = 0
- while i<nb do
- local success, data = turtle.inspect()
- if success then
- turtle.dig()
- turtle.forward()
- else
- turtle.forward()
- end
- i = i+1
- end
- end
- function ft_impr ()
- ft_fwd(1)
- turtle.turnRight()
- ft_fwd(2)
- end
- function ft_pair ()
- ft_fwd(2)
- turtle.turnLeft()
- ft_fwd(1)
- end
- function clean()
- for i=1 , 16 do
- local data = turtle.getItemDetail(i)
- if turtle.getItemDetail(i) ~= nil then
- if i == 1 then
- turtle.select(i)
- turtle.dropDown(data.count - 1)
- elseif ((data.name == "minecraft:cobblestone") or (data.name == "minecraft:dirt")) then
- turtle.select(i)
- turtle.dropDown()
- end
- end
- end
- turtle.select(1)
- end
- function mine()
- turtle.digDown()
- local success, data = turtle.inspectDown()
- if ((success ~= true) or (data.name == "minecraft:flowing_lava") or (data.name == "minecraft:flowing_water")) then
- turtle.down()
- mine()
- turtle.up()
- end
- for i=1, 4
- do
- turtle.turnRight()
- local success, data = turtle.inspect()
- if success then
- print(data.name)
- if ((data.name ~= "minecraft:stone") and (data.name ~= "minecraft:grass")
- and (data.name ~= "minecraft:dirt") and (data.name ~= "TConstruct:GravelOre")
- and (data.name ~= "minecraft:sand"))
- then turtle.dig()
- end
- else
- print("minecraft:air")
- end
- end
- end
- -- MAIN ->
- turtle.select(1)
- print ("Attention !!! Ne prend pas en compte le surplus !!!")
- print ("Please define X")
- xmax = tonumber(read())
- print ("Please define Y")
- ymax = tonumber(read())
- print ("Press F3 and write the value of Y")
- height = tonumber(read())
- cl = true
- choice = " "
- while ((choice ~= "y") and (choice ~= "n")) do
- print ("Do you want eject the scrap (y/n)?")
- choice = read()
- if choice == "n" then
- cl = false
- elseif choice == "y" then
- cl = true
- else
- print("y or n expected !")
- end
- end
- fuel = turtle.getFuelLevel()
- fneed = 3 * height * xmax * ymax
- print ("Estimated fuel required : " ..fneed)
- os.sleep(2)
- while fuel < fneed do
- print ("Put Fuel in slot 1\nStill Requiring : " ..(fneed - fuel))
- os.sleep(4)
- turtle.refuel()
- fuel = turtle.getFuelLevel()
- turtle.select(1)
- end
- x = 1
- y = 1
- while ((x <= xmax) and (y <= ymax)) do
- mine()
- clean()
- turtle.placeDown()
- if ((x == xmax) and (y%2 == 0)) then
- if xmax%2 == 1 then turtle.turnRight() end
- ft_impr()
- x = 1
- y = y + 1
- elseif ((x == xmax) and (y%2 == 1)) then
- if xmax%2 == 0 then turtle.turnLeft() end
- ft_pair()
- turtle.turnLeft()
- x = 1
- y = y + 1
- elseif x%2 == 1 then
- ft_impr()
- x = x + 1
- elseif x%2 == 0 then
- ft_pair()
- x = x + 1
- else print("EXTERMINATE !!!")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement