Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local slices = 9
- local enterPathing = {"south", "goto", 2, 0, 0, "drop-off", "right", "forward", "up", "forward", "eatme"}
- local exitPathing = {"fuel", "forward"}
- gps.CHANNEL_GPS = 5033
- local stationReturn = {
- x = 2,
- y = 0,
- z = -2
- }
- local modem = peripheral.wrap("left")
- local firstSquare = true
- modem.open(5037)
- lineProgress = 0
- width = 1
- middleSquare = {x = 0, y = 0}
- newSquare = {x = 0, y = -1}
- -- gets the turtle going!
- function startTurtle(coords, parentLocation)
- sendData = {
- destination = {
- x = coords.x,
- y = coords.y,
- z = coords.z,
- direction = coords.direction
- },
- returnPoint = {
- x = stationReturn.x + parentLocation[1],
- y = stationReturn.y + parentLocation[2],
- z = stationReturn.z + parentLocation[3]
- },
- exitPath = exitPathing,
- enterPath = enterPathing,
- parentLocation = parentLocation
- }
- placing = true
- s = 1
- while placing do
- turtle.select(s)
- turtle.place()
- local babyTurtle = peripheral.wrap("front")
- if babyTurtle then
- babyTurtle.turnOn()
- placing = false
- break
- end
- if s == 16 then
- s = 1
- else
- s = s+1
- end
- end
- creating = true
- while creating do
- print("back to top")
- message = {os.pullEvent("modem_message")}
- data = message[5]
- if data == "created" then
- print("created!!!")
- modem.transmit(message[4], message[3], sendData)
- sleep(2)
- return true
- end
- end
- end
- -- passes all the in-game coordinates into the "startTurtle" function
- function createSquare(x, y, squareSide, parentLocation)
- print(x .." " ..y)
- for slice = 1, slices do
- worldCoords = {x = ((parentLocation[1]) + (x * 15)), y = (((slice - 1) * 3) + 3), z = ((parentLocation[3]) + (y * 15)), direction = squareSide}
- print(textutils.serialize(worldCoords))
- startTurtle(worldCoords, parentLocation)
- end
- sleep(10)
- if(firstSquare) then
- sleep(600)
- end
- return true
- end
- multishell.launch({}, "mine2")
- location = {gps.locate()}
- for part = 1, #location do
- location[part] = math.floor(location[part]+0.5)
- end
- createSquare(0, 0, 1, location)
- while true do
- print("debug")
- lineNumber = 1
- for line = 1, 4, 1 do
- if lineNumber == 1 then
- lineProgress = 0
- startOfLine = {x = newSquare.x - 1, y = newSquare.y + 2}
- for square=0, width, 1 do
- newSquare = {x = startOfLine.x + square, y = startOfLine.y}
- createSquare(newSquare.x, newSquare.y, lineNumber, location)
- lineProgress = lineProgress + 1
- end
- lineNumber = 2
- elseif lineNumber == 2 then
- lineProgress = 0
- startOfLine = {x = newSquare.x + 1, y = newSquare.y}
- for square=0, width, 1 do
- newSquare = {x = startOfLine.x, y = startOfLine.y - square}
- createSquare(newSquare.x, newSquare.y, lineNumber, location)
- lineProgress = lineProgress + 1
- end
- lineNumber = 3
- elseif lineNumber == 3 then
- lineProgress = 0
- startOfLine = {x = newSquare.x, y = newSquare.y - 1}
- for square=0, width, 1 do
- newSquare = {x = startOfLine.x - square, y = startOfLine.y}
- createSquare(newSquare.x, newSquare.y, lineNumber, location)
- lineProgress = lineProgress + 1
- end
- lineNumber = 4
- elseif lineNumber == 4 then
- lineProgress = 0
- startOfLine = {x = newSquare.x - 1, y = newSquare.y}
- for square=0, width, 1 do
- newSquare = {x = startOfLine.x, y = startOfLine.y + square}
- createSquare(newSquare.x, newSquare.y, lineNumber, location)
- lineProgress = lineProgress + 1
- end
- lineProgress = 1
- width = width+2
- sleep(10)
- end
- end
- end
Add Comment
Please, Sign In to add comment