Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("setNorth.lua")
- function setVariables(newDiffX, newDiffY, newDiffZ, newNegX, newNegY, newNegZ)
- diffX = newDiffX
- diffY = newDiffY
- diffZ = newDiffZ
- negX = newNegX
- negY = newNegY
- negZ = newNegZ
- end
- function calculateTwoDVariables(targetX, targetZ, deltaX, deltaZ)
- diffX = targetX - deltaX
- diffZ = targetZ - deltaZ
- negX = diffX / math.abs(diffX)
- negZ = diffZ / math.abs(diffZ)
- end
- function toTravelHeight()
- turtle.equipLeft()
- local alphaX, alphaY, alphaZ = gps.locate()
- turtle.equipLeft()
- if alphaY < 250 then
- for increment = alphaY, 250 do
- turtle.digUp()
- turtle.up()
- end
- elseif alphaY > 250 then
- for increment = 1, alphaY - 250 do
- turtle.digDown()
- turtle.down()
- end
- end
- end
- function xMovement(diffX, negX)
- if negX < 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- for increment = 1, math.abs(diffX) do
- turtle.dig()
- turtle.forward()
- end
- if negX < 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- function zMovement(diffZ, negZ)
- if negZ > 0 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- for increment = 1, math.abs(diffZ) do
- turtle.dig()
- turtle.forward()
- end
- end
- function yMovement(diffY, negY)
- for increment = 1, math.abs(diffY) do
- if negY < 0 then
- turtle.digUp()
- turtle.up()
- else
- turtle.digDown()
- turtle.down()
- end
- end
- end
- function xMineMovement(diffX, negX)
- if negX < 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- for increment = 1, math.abs(diffX) do
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- end
- if negX < 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- function zMineMovement(diffZ, negZ)
- if negZ > 0 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- for increment = 1, math.abs(diffZ) do
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- end
- end
- function toCordsSkybox(newDiffX, newDiffY, newDiffZ, newNegX, newNegY, newNegZ)
- setVariables(newDiffX, newDiffY, newDiffZ, newNegX, newNegY, newNegZ)
- toTravelHeight()
- setNorth.lookNorth()
- xMovement(diffX, negX)
- zMovement(diffZ, negZ)
- setNorth.lookNorth()
- yMovement(diffY, negY)
- end
- function toCordsMine(newDiffX, newDiffY, newDiffZ, newNegX, newNegY, newNegZ)
- setVariables(newDiffX, newDiffY, newDiffZ, newNegX, newNegY, newNegZ)
- setNorth.lookNorth()
- xMineMovement(diffX, negX)
- zMineMovement(diffZ, negZ)
- setNorth.lookNorth()
- yMovement(diffY, negY)
- end
- function twoDMove(targetX, targetZ, deltaX, deltaZ)
- calculateTwoDVariables(targetX, targetZ, deltaX, deltaZ)
- setNorth.lookNorth()
- xMovement(diffX, negX)
- zMovement(diffZ, negZ)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement