Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local step = 0
- local targs = { ... }
- steps = tonumber(targs[1])
- steps = steps or 1
- local left = 0
- local back = 0
- local right = 0
- local z = false
- local long = 0
- local torchesneeded = 0
- local fuelneeded = 0
- local torchslotX = 3
- local torchslot = 2
- local fuelslot = 1
- local torchtorch = torchslot
- local torchesgot = 0
- local fuelneeded = 0
- local blocks = 0
- local togo = 0
- local distance = 0
- fuellevel = turtle.getFuelLevel()
- torchesgot = turtle.getItemCount(torchslot)+turtle.getItemCount(torchslotX)
- -- Math
- fuelneeded = steps*5
- fuelneeded = fuelneeded+steps
- if steps > 3 then
- torchesneeded = steps
- else
- torchesneeded = 0
- end
- togo = steps*45
- distance = steps*45
- -- screen
- print("Fuel in slot 1")
- print("-------------------------------")
- print("Fuel needed = ", fuelneeded)
- print("Fuel got = ", fuellevel)
- print("-------------------------------")
- print("Torches in slot 2 + 3")
- print("-------------------------------")
- print("Torches needed = ", torchesneeded)
- print("Torches got = ", torchesgot)
- print("-------------------------------")
- print("Blocks to mine = ", togo)
- print("To start press ENTER")
- read(input)
- -- Resources
- if fuellevel < fuelneeded then
- print(" !! insert fuel in slot ", fuelslot)
- repeat
- sleep(0.5)
- turtle.select(fuelslot)
- turtle.refuel()
- fuellevel = turtle.getFuelLevel()
- until fuellevel > fuelneeded
- end
- if torchesgot < torchesneeded then
- print(" !! insert torches in slot ", torchslot)
- repeat
- sleep(0.5)
- turtle.select(torchslot)
- torchesgot = turtle.getItemCount(torchslot)+turtle.getItemCount(torchslotX)
- until torchesgot >= torchesneeded
- end
- z = true
- -- Mining
- term.clear()
- print("**********************")
- print("Distance to mine:", distance)
- print("**********************")
- print("Torches left:" , turtle.getItemCount(torchslot)+turtle.getItemCount(torchslotX))
- print("**********************")
- print("Fuel level:" , turtle.getFuelLevel())
- print("**********************")
- print("Blocks mined:", blocks)
- print("**********************")
- print("Blocks to go:", togo - blocks)
- print("**********************")
- turtle.digUp()
- turtle.up()
- turtle.select(fuelslot)
- while z == true do
- repeat
- repeat
- turtle.dig()
- sleep(0.3)
- until turtle.forward() == true
- turtle.digUp()
- turtle.digDown()
- step = step + 1
- blocks = blocks + 3
- long = long + 1
- until step == 3
- step = 0
- turtle.turnLeft()
- repeat
- repeat
- turtle.dig()
- sleep(0.3)
- until turtle.forward() == true
- turtle.digUp()
- turtle.digDown()
- left = left + 1
- blocks = blocks + 3
- until left == 6
- left = 0
- turtle.turnRight()
- turtle.turnRight()
- repeat
- repeat
- turtle.dig()
- sleep(0.3)
- until turtle.forward() == true
- turtle.digUp()
- turtle.digDown()
- back = back + 1
- until back == 6
- back = 0
- repeat
- repeat
- turtle.dig()
- sleep(0.3)
- until turtle.forward() == true
- turtle.digUp()
- turtle.digDown()
- right = right + 1
- blocks = blocks + 3
- until right == 6
- right = 0
- turtle.turnLeft()
- turtle.turnLeft()
- repeat
- repeat
- turtle.dig()
- sleep(0.3)
- until turtle.forward() == true
- turtle.digUp()
- turtle.digDown()
- back = back + 1
- until back == 6
- back = 0
- turtle.turnRight()
- long = long + 1
- if turtle.getFuelLevel() < 80 then
- turtle.select(fuelslot)
- turtle.refuel()
- end
- -- Check Torches
- if turtle.getItemCount( torchslot ) < 2 then
- term.clear()
- print("Going to use torchslot 2")
- torchtorch = torchslotX
- sleep(0.3)
- end
- if turtle.getItemCount( torchslotX ) < 2 then
- term.clear()
- print("going to use torchslot 1")
- torchtorch = torchslot
- sleep(0.3)
- end
- if turtle.getItemCount(torchslot) + turtle.getItemCount(torchslotX) < 2 then
- term.clear()
- print("Need more torches")
- z = false
- repeat
- print("Need more torches...")
- sleep(0,2)
- print("Need more torches")
- sleep(0,2)
- print("Need more torches...")
- sleep(0,2)
- print("Need more torches")
- until turtle.getItemCount(torchslot) + turtle.getItemCount(torchslotX) > 2
- z = true
- end
- -- Place torches
- turtle.select(torchtorch)
- turtle.placeDown()
- --Termenator Clear + Update
- term.clear()
- print("**********************")
- print("Distance to mine:", distance)
- print("**********************")
- print("Torches left:" , turtle.getItemCount(torchslot)+turtle.getItemCount(torchslotX))
- print("**********************")
- print("Fuel level:" , turtle.getFuelLevel())
- print("**********************")
- print("Blocks mined:", blocks)
- print("**********************")
- print("Blocks to go:", togo - blocks)
- print("**********************")
- end
- if(long == steps*3) then
- z = false
- turtle.turnLeft()
- turtle.turnLeft()
- repeat
- turtle.forward()
- long = long - 1
- until long == 0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement