Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function mine(x)
- local counter = 0
- repeat
- turtle.dig()
- moveForward(1)
- turtle.digUp()
- counter = counter + 1
- until counter == x
- end
- local function turnAround()
- turtle.turnRight()
- turtle.turnRight()
- end
- function moveForward(x)
- for i = 1, x, 1 do
- if turtle.forward() then
- -- nichts passiert
- else
- if turtle.detect() then
- while(turtle.detect()) do
- turtle.dig()
- end
- moveForward(1)
- else
- os.shutdown()
- end
- end
- end
- end
- local function placeTorch()
- turtle.up()
- turtle.select(2)
- turtle.back()
- turtle.place()
- turtle.down()
- end
- local function stripMine(x)
- for i = 1, x, 1 do
- mine(3)
- turtle.turnRight()
- mine(8)
- placeTorch()
- turnAround()
- moveForward(7)
- mine(8)
- placeTorch()
- turnAround()
- moveForward(7)
- turtle.turnLeft()
- end
- end
- local function calculateFuel(number_of_corridors)
- local fields_to_move = number_of_corridors * 40
- return math.ceil(fields_to_move / 80)
- end
- local function calculateTorches(number_of_corridors)
- return number_of_corridors * 2
- end
- local function printWithConfirmation(string)
- print(string)
- local input = read()
- if input ~= "y" and input ~= "yes" then
- os.shutdown()
- end
- end
- print("Ultimate Miner by KingKevin23")
- print("How many corridors should be mined?")
- local number_of_corridors = tonumber(read())
- printWithConfirmation("Please provide " .. calculateFuel(number_of_corridors) .. " coal items in slot 1.")
- printWithConfirmation("Please provide " .. calculateTorches(number_of_corridors) .. " torches in slot 2.")
- turtle.select(1)
- turtle.refuel()
- stripMine(number_of_corridors)
Add Comment
Please, Sign In to add comment