Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --DISCLAIMER!!!!
- --THIS IS BETA CODE! IF THERE IS A GLITCH ON THE CODE, PLEASE MESSAGE ME AT YOUTUBE.COM/HASHTAGAMING
- --When running the code running it like so "mineFuel <length of tunnel "any number"> <direction "left" or "right">
- slot = 2
- coal = 1
- chest = 2
- blocks = 3
- turtle.select(2)
- local args = {...}
- local dist = tonumber(args[1])
- local direct = tostring(args[2])
- local function setSlot(s)
- slot = s
- turtle.select(s)
- end
- local function checkFuel()
- curSlot = slot
- if turtle.getFuelLevel() < 10 then
- setSlot(1)
- turtle.refuel()
- setSlot(curSlot)
- end
- end
- local function digForward()
- checkFuel()
- while not turtle.forward() do
- turtle.dig()
- turtle.digUp()
- end
- end
- local function turnAround(dir)
- if dir == "left" then
- turtle.turnLeft()
- digForward()
- turtle.turnLeft()
- end
- if dir == "right" then
- turtle.turnRight()
- digForward()
- turtle.turnRight()
- end
- end
- while turtle.getItemCount(chest) > 0 do
- for i=1,dist do
- digForward()
- end
- turnAround(direct)
- for i=1,dist do
- digForward()
- end
- turtle.dig()
- turtle.select(chest)
- turtle.place()
- for slot=3,16,1 do
- turtle.select(slot)
- while turtle.getItemCount(slot) > 0 do
- turtle.drop()
- end
- end
- if direct == "left" then
- turtle.turnRight()
- end
- if direct == "right" then
- turtle.turnLeft()
- end
- for i=1,3,1 do
- digForward()
- end
- if direct == "left" then
- turtle.turnRight()
- end
- if direct == "right" then
- turtle.turnLeft()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement