Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function outoffuel()
- if turtle.getFuelLevel()==0 then
- t=turtle.getSelectedSlot()
- i=1
- while i<17 do
- if check_slot(i) then
- rednet.broadcast("Slot ".. i.." has no coal")
- else
- turtle.select(i)
- turtle.refuel(4)
- break
- end
- i=i+1
- end
- turtle.select(t)
- end
- end
- function improvedDig()
- while turtle.inspect() do
- turtle.dig()
- end
- end
- function check_slot(value)
- a=turtle.getItemDetail(value)
- if turtle.getItemCount(value)==0 or a.name~="minecraft:coal" or a.name~="minecraft:coal_block" then
- return true
- else
- return false
- end
- end
- function push()
- improvedDig()
- turtle.forward()
- end
- function forward_mine(value)
- for i=0,value,1 do
- outoffuel()
- push()
- end
- end
- function placeRight()
- turtle.turnRight()
- a=turtle.inspect()
- if not a then
- selector("minecraft:cobblestone")
- turtle.place()
- end
- turtle.turnLeft()
- end
- function selector(string)
- i=1
- while i<17 do
- a,b= turtle.select(i)
- if a==true and b.name==string then
- return true
- else
- i=i+1
- end
- end
- rednet.broadcast("Out of :" .. string)
- exit()
- end
- function placeLeft()
- turtle.turnLeft()
- a=turtle.inspect()
- if not a then
- selector("minecraft:cobblestone")
- turtle.place()
- end
- turtle.turnRight()
- end
- function dig_tunnel(depth)
- forward_mine(1)
- for i=0,depth,1 do
- for k=0,1,1 do
- placeRight()
- turtle.turnLeft()
- forward_mine(2)
- turtle.place()
- turtle.turnRight()
- turtle.digUp()
- turtle.up()
- turtle.placeLeft()
- turtle.right()
- forward_mine(2)
- turtle.place()
- turtle.turnLeft()
- turtle.digUp()
- turtle.up()
- end
- end
- end
- io.write("Pass depth")
- depth=io.read()
- rednet.broadcast("R2 is diggin tunnel 4x3x"..depth)
- dig_tunnel(depth)
- rednet.broadcast("Digging succesfull")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement