Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p=peripheral.wrap("right")
- if p then
- print (true)
- end
- print ("How many steps?")
- local steps=tonumber(read())
- print ("How many blocks wide?")
- width=tonumber(read())
- print ("How tall should it be?")
- local strY=read()
- local y=tonumber(strY)
- nSlot=0
- if y<=2 then
- y=nil
- else
- y=y-1
- end
- print ("Do I change the floor?")
- if read() =="y" then
- print ("What slot are the flooring tiles in?")
- nSlot=tonumber(read())
- bFloor=true
- end
- print ("Do I change the roof?")
- if read() =="y" then
- print ("What slot are the roof tiles in?")
- rSlot=tonumber(read())
- bRoof=true
- end
- print ("Should I build walls? y/n")
- if read()=="y" then
- bWalls=true
- print("What slot are the wall tiles in?")
- wSlot=tonumber(read())
- else
- bWalls=false
- end
- local amt=turtle.getItemCount(nSlot)
- lat=0
- ------------Compare Wall Block-------
- function wComp()
- if turtle.compare()~=true then
- turtle.dig()
- turtle.place()
- end
- end
- ------------digWall------------
- function digWall()
- if (lat==0 or lat==width-1) and bWalls==true then
- turtle.select(wSlot)
- if lat~=0 and lat%2==0 then
- turtle.turnRight()
- wComp()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- wComp()
- turtle.turnRight()
- end
- end
- end
- -------Turtle Forward With Dig-----
- function digNmove(y,rSlot)
- print ("height: ", y)
- digWall()
- if y then
- for i=1, y do
- while turtle.detectUp()==true do
- turtle.digUp()
- end
- shell.run("go" , "up", 1)
- digWall()
- if i==y and bRoof==true then
- turtle.select(rSlot)
- turtle.digUp()
- turtle.placeUp()
- end
- end
- shell.run("go", "down", y)
- end
- while turtle.detect() do
- turtle.dig()
- end
- shell.run("go", "forward", 1)
- end
- ----Go Steps----
- function goSteps(nSlot)
- p.condenseItems()
- local i=1
- while i<=steps do
- if turtle.detectDown()== true and bFloor==true then
- turtle.digDown()
- local amt=turtle.getItemCount(nSlot)
- if amt<1 then
- print ("Out of materials in ", nSlot, ".\n Refill, and press any key!")
- read()
- end
- turtle.select(nSlot)
- turtle.placeDown()
- end
- if i<steps then
- digNmove(y,rSlot)
- end
- i=i+1
- end
- end
- -----------Get TurnDir--------
- function turnDir(lat)
- print ("turning for lat", lat)
- --if lat==0 then
- local _mod=lat%2
- --[[else
- local _mod=math.modf(lat)
- end--]]
- print ("Mod: ",_mod)
- if _mod==0 then
- turtle.turnRight()
- print ("right")
- else
- turtle.turnLeft()
- print("left")
- end
- end
- ----------------PROCESS----------
- while lat<width do
- goSteps(nSlot)
- turnDir(lat)
- digNmove(y, rSlot)
- turnDir(lat)
- lat=lat+1
- sleep(0.2)
- end
- print("finished")
- bFloor=nil
- bRoof=nil
- bWalls=nil
- wSlot=nil
- width=nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement