Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local a = {}
- local args = {...}
- local floors = tonumber(args[1])
- local windowSize = tonumber(args[2])
- local windowNumber = tonumber(args[3])
- local windowHeight = tonumber(args[4])+1
- local layer = 0
- local layerCount = 0
- local floorCount = 0
- local inventorySlot = 1
- local backForth = 0
- local placeDist = 0
- local xPos = 0
- local yPos = 0
- local zPos = 0
- local rotation = 0
- local xTemp = 0
- local yTemp = 0
- local zTemp = 0
- local rotTemp = 0
- local xDiff = 0
- local yDiff = 0
- local zDiff = 0
- local rotDiff = 0
- function a.goToPlace(x,y,z,rot)
- xDiff = xPos-x
- yDiff = yPos-y
- zDiff = zPos-z
- rotDiff = rotation - rot
- while(rotDiff ~= 0)
- do
- if(rotDiff>0)
- then
- turtle.turnLeft()
- rotDiff = rotDiff -90
- rotation = rotation - 90
- end
- if(rotDiff<0)
- then
- turtle.turnRight()
- rotDiff = rotDiff + 90
- rotation = rotation+90
- end
- end
- if xDiff ~=0 then
- turtle.turnRight()
- while xDiff ~= 0 do
- if xDiff<0 then
- turtle.back()
- xDiff = xDiff+1
- xPos = xPos+1
- end
- if xDiff > 0 then
- turtle.forward()
- xDiff = xDiff-1
- xPos = xPos-1
- end
- end
- turtle.turnLeft()
- end
- while(zDiff~=0)
- do
- if(zDiff>0)
- then
- turtle.back()
- zDiff = zDiff - 1
- zPos = zPos -1
- end
- if(zDiff<0)
- then
- turtle.forward()
- zDiff = zDiff+1
- zPos = zPos+1
- end
- end
- while(yDiff~=0)
- do
- if(yDiff>0)
- then
- turtle.down()
- yDiff = yDiff -1
- yPos = yPos -1
- end
- if(yDiff<0)
- then
- turtle.up()
- yDiff = yDiff+1
- yPos = yPos+1
- end
- end
- end
- function a.wallPlacement()
- if(turtle.getItemCount(inventorySlot)<1)
- then
- if(inventorySlot==16)
- then
- inventorySlot = 1
- turtle.select(inventorySlot)
- xTemp = xPos
- yTemp = yPos
- zTemp = zPos
- rotTemp = rotation
- a.goToPlace(0,0,-1,0)
- print("Please give me material")
- while(turtle.getItemCount(inventorySlot)<1)
- do
- sleep(10)
- end
- print("Thank you!")
- a.goToPlace(0,yTemp,-1,0)
- a.goToPlace(xTemp,yTemp,zTemp,rotTemp)
- else
- inventorySlot = inventorySlot+1
- turtle.select(inventorySlot)
- end
- end
- if(layer==0)
- then
- turtle.placeDown()
- end
- if layer>0 and layer<windowHeight+2
- then
- if(xPos==((windowSize+1)*windowNumber+1))or(zPos==((windowSize+1)*windowNumber))or(xPos==0)or(zPos==0)
- then
- if layer>1 and layer<windowHeight+1
- then
- if(xPos%(windowSize+1)==0) and (zPos%(windowSize+1)==0)
- then
- print("WindowPlace")
- turtle.placeDown()
- end
- end
- if layer == 1 or layer == (windowHeight+1)
- then
- turtle.placeDown()
- end
- end
- end
- if(layer==windowHeight+2)
- then
- layer = 0
- end
- end
- function a.checkFuel()
- if(turtle.getFuelLevel()<(xPos+yPos+zPos+20))
- then
- inventorySlot = 1
- turtle.select(inventorySlot)
- xTemp = xPos
- yTemp = yPos
- zTemp = zPos
- rotTemp = rotation
- a.goToPlace(0,0,-1,0)
- print("Please give me fuel")
- while(turtle.getFuelLevel()<20)
- do
- turtle.refuel()
- end
- print("Thank you!")
- a.goToPlace(0,yTemp,-1,0)
- a.goToPlace(xTemp,yTemp,zTemp,rotTemp)
- end
- end
- turtle.forward()
- turtle.forward()
- while(layerCount<floors*(windowHeight+3))
- do
- for x = 0, (windowSize+1)*windowNumber do
- for z = 0,(windowSize+1)*windowNumber do
- a.wallPlacement()
- if(backForth%2==0)then a.goToPlace(x,yPos,z,0) end
- if(backForth%2==1)then a.goToPlace(x,yPos,(((windowSize+1)*windowNumber)-z),0) end
- a.checkFuel()
- end
- backForth = backForth + 1
- end
- backForth = 0
- print("UP WE GO")
- a.goToPlace(0,yPos+1,0,0)
- layer = layer +1
- layerCount = layerCount + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement