Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- print("Mining: "..tArgs[1].." spaces")
- function StartFuel()
- turtle.select(1)
- turtle.refuel(1)
- turtle.select(2)
- turtle.refuel(1)
- turtle.select(3)
- turtle.refuel(1)
- turtle.select(4)
- turtle.refuel(1)
- turtle.select(5)
- turtle.refuel(1)
- turtle.select(6)
- turtle.refuel(1)
- turtle.select(7)
- turtle.refuel(1)
- turtle.select(8)
- turtle.refuel(1)
- turtle.select(9)
- turtle.refuel(1)
- turtle.select(10)
- turtle.refuel(1)
- turtle.select(11)
- turtle.refuel(1)
- turtle.select(12)
- turtle.refuel(1)
- turtle.select(13)
- turtle.refuel(1)
- turtle.select(14)
- turtle.refuel(1)
- turtle.select(15)
- turtle.refuel(1)
- turtle.select(16)
- turtle.refuel(1)
- print("I consumed some coal to keep my fuel level up")
- end
- function CheckItems()
- local item = 0
- ea = turtle.getItemCount(1)
- eb = turtle.getItemCount(2)
- ec = turtle.getItemCount(3)
- ed = turtle.getItemCount(4)
- ee = turtle.getItemCount(5)
- ef = turtle.getItemCount(6)
- eg = turtle.getItemCount(7)
- eh = turtle.getItemCount(8)
- ei = turtle.getItemCount(9)
- ej = turtle.getItemCount(10)
- ek = turtle.getItemCount(11)
- el = turtle.getItemCount(12)
- em = turtle.getItemCount(13)
- en = turtle.getItemCount(14)
- eo = turtle.getItemCount(15)
- ep = turtle.getItemCount(16)
- item = item+ea
- item = item+eb
- item = item+ec
- item = item+ed
- item = item+ee
- item = item+ef
- item = item+eg
- item = item+eh
- item = item+ei
- item = item+ej
- item = item+ek
- item = item+el
- item = item+em
- item = item+en
- item = item+eo
- item = item+ep
- print("You have a total of this many items, in the turtle:")
- print(item)
- end
- function CheckBlockUp()
- while turtle.detectUp() == true do
- turtle.digUp()
- sleep(0.4)
- end
- end
- function CheckFuel()
- if turtle.getFuelLevel() == 30 then
- turtle.select(1)
- turtle.refuel(1)
- turtle.select(2)
- turtle.refuel(1)
- turtle.select(3)
- turtle.refuel(1)
- turtle.select(4)
- turtle.refuel(1)
- turtle.select(5)
- turtle.refuel(1)
- turtle.select(6)
- turtle.refuel(1)
- turtle.select(7)
- turtle.refuel(1)
- turtle.select(8)
- turtle.refuel(1)
- turtle.select(9)
- turtle.refuel(1)
- turtle.select(10)
- turtle.refuel(1)
- turtle.select(11)
- turtle.refuel(1)
- turtle.select(12)
- turtle.refuel(1)
- turtle.select(13)
- turtle.refuel(1)
- turtle.select(14)
- turtle.refuel(1)
- turtle.select(15)
- turtle.refuel(1)
- turtle.select(16)
- turtle.refuel(1)
- print("I consumed some coal to keep my fuel level up")
- end
- if turtle.getFuelLevel() == 5 then
- turtle.select(1)
- turtle.refuel(1)
- turtle.select(2)
- turtle.refuel(1)
- turtle.select(3)
- turtle.refuel(1)
- turtle.select(4)
- turtle.refuel(1)
- turtle.select(5)
- turtle.refuel(1)
- turtle.select(6)
- turtle.refuel(1)
- turtle.select(7)
- turtle.refuel(1)
- turtle.select(8)
- turtle.refuel(1)
- turtle.select(9)
- turtle.refuel(1)
- turtle.select(10)
- turtle.refuel(1)
- turtle.select(11)
- turtle.refuel(1)
- turtle.select(12)
- turtle.refuel(1)
- turtle.select(13)
- turtle.refuel(1)
- turtle.select(14)
- turtle.refuel(1)
- turtle.select(15)
- turtle.refuel(1)
- turtle.select(16)
- turtle.refuel(1)
- print("I consumed some coal to keep my fuel level up")
- end
- if turtle.getFuelLevel() == 0 then
- print("Shutting down...Reason: No fuel")
- sleep(20)
- shell.run("shutdown")
- end
- end
- function StopTorch()
- if turtle.getItemCount(16) == 2 then
- print("Shutting down...Reason: Not enough torches")
- sleep(20)
- shell.run("shutdown")
- end
- end
- function attackMob()
- sleep(0.1)
- turtle.attack()
- end
- function forward2()
- CheckFuel()
- checkBlock()
- CheckBlockUp()
- turtle.digUp()
- checkBlock()
- attackMob()
- turtle.dig()
- turtle.forward()
- attackMob()
- end
- function checkBlock()
- while turtle.detect() == true do
- turtle.dig()
- sleep(0.4)
- end
- end
- function forward1()
- CheckBlockUp()
- checkBlock()
- checkBlock()
- CheckBlockUp()
- checkBlock()
- CheckBlockUp()
- attackMob()
- checkBlock()
- CheckBlockUp()
- CheckFuel()
- turtle.forward()
- attackMob()
- CheckFuel()
- turtle.down()
- CheckBlockUp()
- checkBlock()
- end
- function forward()
- StopTorch()
- CheckFuel()
- checkBlock()
- CheckBlockUp()
- turtle.digUp()
- checkBlock()
- attackMob()
- turtle.dig()
- CheckBlockUp()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- attackMob()
- end
- function mine()
- forward1()
- forward()
- forward()
- CheckFuel()
- StopTorch()
- checkBlock()
- attackMob()
- CheckBlockUp()
- turtle.digUp()
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- CheckFuel()
- turtle.up()
- turtle.turnRight()
- checkBlock()
- turtle.dig()
- checkBlock()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- turtle.dig()
- checkBlock()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- turtle.dig()
- checkBlock()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- turtle.dig()
- checkBlock()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- turtle.dig()
- checkBlock()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- turtle.turnLeft()
- turtle.turnLeft()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- CheckBlockUp()
- attackMob()
- CheckBlockUp()
- CheckFuel()
- turtle.forward()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- attackMob()
- checkBlock()
- turtle.dig()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- turtle.dig()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- turtle.dig()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- turtle.dig()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- checkBlock()
- turtle.dig()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- CheckFuel()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- checkBlock()
- attackMob()
- CheckFuel()
- turtle.forward()
- CheckBlockUp()
- attackMob()
- checkBlock()
- turtle.dig()
- turtle.digDown()
- CheckBlockUp()
- turtle.digUp()
- attackMob()
- checkBlock()
- turtle.turnLeft()
- StopTorch()
- CheckFuel()
- turtle.select(16)
- turtle.digDown()
- turtle.placeDown()
- CheckFuel()
- turtle.down()
- end
- shell.run("clear")
- print("The Creator of this program is -Andersfc-")
- sleep(2)
- shell.run("clear")
- CheckItems()
- f = turtle.getFuelLevel()
- print("Your fuel level is:")
- print(f)
- z = turtle.getItemCount(16)
- print("You have this many items in slot #16:")
- print(z)
- print("Loading text...")
- sleep(10)
- shell.run("clear")
- print("Put torches in slot #16 to optionally place torches, or put an item/entity in the slot, so it wont place anything at all, put cobblestone or any desired block in slot #15 to make sure it places torches no matter what!")
- print("I use 27 fuel units, to move a cycle of a stripmine")
- print("Loading program...")
- sleep(20)
- print("Starting the stripmine...")
- StartFuel()
- --Main Program:
- --term.write("How many blocks to dig?")
- --blocks = read()
- for i = 1, tArgs[1] do
- mine()
- end
Advertisement
Add Comment
Please, Sign In to add comment