Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- turnTurn = "right"
- hasBlocks = true
- function turnOpposite()
- if turnTurn == "right" then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- end
- function autoRefuel()
- if turtle.getFuelLevel() < 40 then
- for a = 1, 16, 1 do
- turtle.select(a)
- if turtle.refuel(2) == true then
- break
- end
- end
- end
- turtle.select(1)
- end
- local function checkForBlocks()
- hasBlocks = false
- for a = 1, 16, 1 do
- if turtle.getItemSpace(a) ~= 0 then
- itemDetail = turtle.getItemDetail(a)
- if itemDetail[1] ~= 263 then
- hasBlocks = true
- end
- end
- end
- if hasBlocks == false then
- print("Ran out of blocks. Insert blocks and press a key.")
- sleep(0)
- local event, keystroke = os.pullEvent("char")
- end
- end
- function checkIfHasBlocks()
- checkForBlocks()
- while hasBlocks == false do
- checkForBlocks()
- end
- end
- function makeFloor()
- for a = 1, width, 1 do
- for b = 1, length, 1 do
- checkIfHasBlocks()
- turtle.placeDown()
- if b ~= length then
- turtle.forward()
- end
- end
- if a ~= width then
- if turnTurn == "right" then
- turnTurn = "left"
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- else
- turnTurn = "right"
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- else
- turnOpposite()
- end
- end
- turtle.up()
- end
- function makeWall()
- for a = 1, 2, 1 do
- for b = 1, length, 1 do
- checkIfHasBlocks()
- turtle.placeDown()
- if b ~= length then
- turtle.forward()
- end
- end
- turnOpposite()
- for b = 1, width, 1 do
- checkIfHasBlocks()
- turtle.placeDown()
- if b ~= width then
- turtle.forward()
- end
- end
- turnOpposite()
- end
- turtle.up()
- end
- function makeHouse()
- if botfloor then
- makeFloor()
- end
- for a = 1, floors, 1 do
- for b = 1, height, 1 do
- makeWall()
- end
- makeFloor()
- end
- end
- print("Place turtle to far left of house.")
- print("Enter forward length:")
- length = tonumber(read())
- print("Enter right width:")
- width = tonumber(read())
- print("Enter height of each floor:")
- height = tonumber(read())
- print("Enter amount of floors:")
- floors = tonumber(read())
- print("Make bottom floor? (y/n)")
- botfloor = read()
- if botfloor == "y" then
- botfloor = true
- else
- botfloor = false
- end
- print("Constructing...")
- makeHouse()
- print("Complete.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement