Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local count=0
- local slot =1
- local function ensureSlot()
- if count==0 then
- slot=slot+1;
- count=turtle.getItemCount(slot)
- if count==0 then exit() end
- turtle.select(slot)
- end
- end
- count=turtle.getItemCount(slot)
- local function buildWall(x,y,z)
- local zr=0;
- zr=z %3
- z=math.floor(z/3)
- if (zr~=0) then z=z+1 end
- local buildUp=true;
- local buildForward=true;
- for k=1,z do
- if(k<z) then buildUp=true;buildForward=true;
- elseif zr==1 then buildUp=false;buildForward=false;
- elseif zr==2 then buildUp=false;buildForward=true;
- else buildUp=true ;buildForward=true;
- end
- turtle.up()
- for j=1,2 do
- for i=1,x-2 do
- turtle.placeDown()
- count=count-1;ensureSlot()
- if buildUp then
- turtle.placeUp()
- count=count-1;ensureSlot()
- end
- turtle.back()
- if buildForward then
- turtle.place()
- count=count-1;ensureSlot()
- end
- end
- turtle.placeDown()
- count=count-1;ensureSlot()
- if buildUp then
- turtle.placeUp()
- count=count-1;ensureSlot()
- end
- turtle.turnLeft()
- turtle.back()
- if buildForward then
- turtle.place()
- count=count-1;ensureSlot()
- end
- for i=1,y-2 do
- turtle.placeDown()
- count=count-1;ensureSlot()
- if buildUp then
- turtle.placeUp()
- count=count-1;ensureSlot()
- end
- turtle.back()
- if buildForward then
- turtle.place()
- count=count-1;ensureSlot()
- end
- end
- turtle.placeDown()
- count=count-1;ensureSlot()
- if buildForward and j==2 then
- turtle.up()
- turtle.placeDown()
- count=count-1;ensureSlot()
- end
- if buildUp then
- if j==1 then
- turtle.placeUp()
- count=count-1;ensureSlot()
- else
- turtle.up()
- turtle.placeDown()
- count=count-1;ensureSlot()
- end
- end
- turtle.turnLeft()
- turtle.back()
- if buildForward and j==1 then
- turtle.place()
- count=count-1;ensureSlot()
- end
- end
- end
- turtle.forward()
- end
- local function buildPlate(x,y)
- turtle.up()
- for j=1,y do
- for i=1,x-1 do
- turtle.placeDown()
- count=count-1;ensureSlot()
- turtle.back()
- end
- turtle.placeDown()
- count=count-1;ensureSlot()
- if(j<y) then
- if(j%2== 1) then turtle.turnLeft() else turtle.turnRight() end
- turtle.back()
- if(j%2== 1) then turtle.turnLeft() else turtle.turnRight() end
- end
- --turtle.back()
- end
- end
- print("make sure the turtle is refueld ")
- print("load building material in all slots")
- print(" place turtle at bottom right corner (builds in place)")
- print("first wall?")
- local x1=tonumber(read())
- print("second wall?")
- local y1=tonumber(read())
- print("height?")
- local z1=tonumber(read())
- local sel=0
- turtle.select(1)
- repeat
- print("0= walls 1 = add floor ,2 = add roof 3= add both" )
- sel=tonumber(read())
- until(sel>=0 and sel<=3)
- turtle.turnRight();turtle.turnRight();
- if((sel==1 or sel==3) and z1>0) then
- buildPlate(x1,y1);
- z1=z1-1;
- if(y1%2==1) then
- turtle.turnRight();turtle.turnRight();
- else
- turtle.turnLeft();
- end
- end
- turtle.back()
- if ((sel==2 or sel==3 )and z1>1) then
- buildWall(x1,y1,z1-1)
- buildPlate(x1,y1)
- else
- if(z1>0) then buildWall(x1,y1,z1) end
- end
- --if(zr~=0) then z=z-1; end
- --z=z*3+zr
- --for i=1,z do turtle.down() end
Advertisement
Add Comment
Please, Sign In to add comment