Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- >> Useful functions
- -- >> Written by astonish01
- --Slots for refuel function:
- --15 and 16 FUEL
- -------------------------------------------
- -- > Turning
- -- none -> none
- function turnLeft()
- turtle.turnLeft()
- end
- -- none -> none
- function turnRight()
- turtle.turnRight()
- end
- -- none -> none
- function turnAround()
- turnLeft()
- turnLeft()
- end
- -------------------------------------------
- -- > Movement functions
- -- int -> none
- function moveFront(n)
- if n == 0 then
- return
- else
- for i=1, n do
- turtle.forward()
- end
- end
- end
- -- int -> none
- function moveBack(n)
- if n == 0 then
- return
- else
- for i=1, n do
- turtle.back()
- end
- end
- end
- -- int -> none
- function moveUp(n)
- if n == 0 then
- return
- else
- for i=1, n do
- turtle.up()
- end
- end
- end
- -- int -> none
- function moveBown(n)
- if n == 0 then
- return
- else
- for i=1, n do
- turtle.down()
- end
- end
- end
- -- int -> none
- function moveRight(n)
- if n == 0 then
- return
- else
- for i=1, n do
- turnRight()
- moveFront()
- turnLeft()
- end
- end
- end
- -- int -> none
- function moveLeft(n)
- if n == 0 then
- return
- else
- for i=1, n do
- turnLeft()
- moveFront()
- turnRight()
- end
- end
- end
- -------------------------------------------
- -- > Block placing/breaking/using/attacking
- -- Placing
- -- none -> none
- function placeFront()
- turtle.place()
- end
- -- none -> none
- function placeBack()
- turnAround()
- turtle.place()
- turnAround()
- end
- -- none -> none
- function placeRight()
- turnRight()
- turtle.place()
- turnLeft()
- end
- -- none -> none
- function placeLeft()
- turnLeft()
- turtle.place()
- turnRight()
- end
- -- none -> none
- function placeUp()
- turtle.placeUp()
- end
- -- none -> none
- function placeDown()
- turtle.placeDown()
- end
- -- Digging
- -- none -> none
- function digFront()
- turtle.dig()
- end
- -- none -> none
- function digBack()
- turnAround()
- turtle.dig()
- turnAround()
- end
- -- none -> none
- function digRight()
- turnRight()
- turtle.dig()
- turnLeft()
- end
- -- none -> none
- function digLeft()
- turnLeft()
- turtle.dig()
- turnRight()
- end
- -- none -> none
- function digUp()
- turtle.digUp()
- end
- -- none -> none
- function digDown()
- turtle.digDown()
- end
- -- Attacking
- -- none -> none
- function attackFront()
- turtle.attack()
- end
- -- none -> none
- function attackBack()
- turnAround()
- turtle.attack()
- turnAround()
- end
- -- none -> none
- function attackRight()
- turnRight()
- turtle.attack()
- turnLeft()
- end
- -- none -> none
- function attackLeft()
- turnLeft()
- turtle.attack()
- turnRight()
- end
- -- none -> none
- function attackUp()
- turtle.attackUp()
- end
- -- none -> none
- function attackDown()
- turtle.attackDown()
- end
- -------------------------------------------
- -- > Refueling
- -- none -> none
- function checkRefuel()
- local slot = 15
- if turtle.getFuelLevel() < 160 then
- if turtle.getItemCount(15) >= 1 then
- slot = 15
- elseif turtle.getItemCount(16) >= 1 then
- slot = 16
- end
- turtle.select(slot)
- turtle.refuel(2)
- turtle.select(1)
- end
- end
- -------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment