Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Turle Script
- -- Floor Builder - floor will extend forward and to the left in the current facing direction
- -- Apltraum3000 13.06.2014
- -- Parameter
- maxLength = 6
- maxWidth = 6
- materialSlot = 2 -- first slot used for fill material. all following will be used as well
- -- internal vars
- curPosL = 1
- curPosW = 1
- curDirection = 1
- noHindrance = true
- function checkL()
- if( curDirection == 1) then
- return curPosL<maxLength
- else
- return curPosL>1
- end
- end
- -- go and place blocks underneath
- turtle.select(materialSlot)
- while (curPosW<maxWidth and noHindrance and turtle.getItemCount(materialSlot)>0) do
- -- move
- while ( checkL() and turtle.getItemCount(materialSlot)>0 and turtle.forward() ) do
- turtle.placeDown()
- if ( turtle.getItemCount(materialSlot) == 0 ) then
- if (materialSlot < 16) then
- materialSlot = materialSlot + 1
- turtle.select(materialSlot)
- end
- end
- curPosL = curPosL + curDirection
- end
- -- turn
- if curDirection == 1 then
- turtle.turnLeft()
- noHindrance = turtle.forward()
- turtle.turnLeft()
- else
- turtle.turnRight()
- noHindrance = turtle.forward()
- turtle.turnRight()
- end
- if noHindrance then
- curPosW = curPosW + 1
- end
- curDirection = (-1)*curDirection
- end
- -- return width
- if curDirection == 1 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- for i=curPosW,1,-1 do
- turtle.forward()
- end
- -- return length
- turtle.turnRight()
- for i=curPosL,1,-1 do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement