Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- -----------------------------
- -- Railroad busterizer
- -- pastebin get puUKhwXm bust
- -- -----------------------------
- function checkFuel()
- if turtle.getFuelLevel() < 10 then
- print('Refuel')
- selectItem('fuel')
- while not turtle.refuel(1) do sleep(5) end
- end
- end
- function clearUp()
- if turtle.detectUp() then
- turtle.select(16)
- while not turtle.digUp() do turtle.attackUp() end
- turtle.drop()
- else
- turtle.attackUp()
- end
- end
- function clearDown()
- if turtle.detectDown() then
- turtle.select(16)
- while not turtle.digDown() do turtle.attackDown() end
- turtle.drop()
- else
- turtle.attackDown()
- end
- end
- function clearFront()
- if turtle.detect() then
- turtle.select(16)
- while not turtle.dig() do turtle.attack() end
- turtle.drop()
- else
- turtle.attack()
- end
- end
- function clearBack()
- turtle.turnRight()
- turtle.turnRight()
- clearFront()
- turtle.turnRight()
- turtle.turnRight()
- end
- function goForward()
- while not turtle.forward() do clearFront() end
- end
- function goBack()
- while not turtle.back() do clearBack() end
- end
- function goUp()
- while not turtle.up() do clearUp() end
- end
- function goDown()
- while not turtle.down() do clearDown() end
- end
- function placeBlock(item)
- selectItem( item )
- while not turtle.placeDown() do clearDown() end
- end
- function placeFrontBlock(item)
- selectItem( item )
- while not turtle.place() do
- clearFront()
- selectItem( item )
- end
- end
- function placeBooster()
- clearDown()
- goDown()
- selectItem( 'floor' )
- turtle.digDown()
- goDown()
- clearDown()
- goDown()
- clearDown()
- placeBlock('floor')
- placeFrontBlock('floor')
- turtle.turnRight()
- placeFrontBlock('floor')
- turtle.turnRight()
- placeFrontBlock('floor')
- turtle.turnRight()
- placeFrontBlock('floor')
- turtle.turnRight()
- goUp()
- placeBlock('red_torch')
- goUp()
- placeBlock('floor')
- goUp()
- placeBlock('booster')
- end
- function selectFrom( slots )
- selected = false
- while not selected do
- for _, slot_num in ipairs(slots) do
- if turtle.getItemCount(slot_num) > 1 then
- turtle.select(slot_num)
- selected = true
- return
- end
- end
- if not selected then
- sleep(5)
- end
- end
- end
- function selectItem( item )
- inventory = {fuel = {1}, floor = {2, 3, 4, 5, 6}, booster = {7, 8}, red_torch = {9, 10}}
- selectFrom(inventory[item])
- end
- local lenth = 0
- term.clear()
- term.setCursorPos(1,1)
- print("1: fuel, 2, 3, 4, 5, 6: floor material")
- print("7, 8: boosters, 9, 10: red torches")
- write("How long the road is? ")
- lenth = read()
- checkFuel()
- steps_to_booster = 7
- for a = 0, lenth do
- steps_to_booster = steps_to_booster - 1
- checkFuel()
- goForward()
- if steps_to_booster == 0 then
- placeBooster()
- steps_to_booster = 7
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement