Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local builder = {}
- function builder.clearDig()
- while turtle.detect() do
- turtle.dig()
- sleep(1.5)
- end
- end
- function builder.clearCurs()
- term.clear()
- term.setCursorPos(1,1)
- end
- function builder.blockCheck()
- turtle.select(1)
- for exa1 = 1, 16, 1 do
- turtle.select(exa1)
- sp = turtle.getItemSpace()
- print(sp)
- if sp > 0 and sp < 64 and compareTo(desSlot) then
- for exa2 = 16, exa1, -1 do
- turtle.select(exa2)
- co = turtle.getItemCount()
- if co < sp then
- if turtle.compareTo(exa1) then
- turtle.transferTo(exa1, co)
- end
- else
- if turtle.compareTo(exa1) then
- turtle.transferTo(exa1, sp)
- end
- end
- end
- end
- end
- local s = 0
- for i = 1, 16, 1 do
- turtle.select(i)
- if turtle.compareTo(1) then
- s = s + turtle.getItemCount()
- end
- end
- if not (s%64 == 0) then
- ss = (math.floor(s/64).. " stacks and "..s-(math.floor(s/64)*64).." blocks.")
- else
- ss = (math.floor(s/64).. " stacks.")
- end
- print("Amount of blocks left for building: \n"..s.." blocks, or "..ss)
- end
- function builder.fuelCheck()
- clearCurs()
- fuell = turtle.getFuelLevel()
- print("Total fuel: "..fuell)
- if (fuell < 120) then
- print("That's not enough! Refueling...")
- for i = 2, 16, 1 do
- turtle.select(i)
- if not turtle.compareTo(1) then
- turtle.refuel()
- end
- end
- print("Refueled; the total fuel now is: "..turtle.getFuelLevel())
- end
- clearCurs()
- sfuell = turtle.getFuelLevel()
- if sfuell < 120 then
- print("There wasn't enough fuel to refuel with, enter 'OK' when you put fuel inside the inventory")
- refuelOK = read()
- print("I lied, I can't read, I'll just assume you entered 'OK'")
- sleep(1)
- end
- turtle.select(1)
- end
- function builder.doubleCheck()
- blockCheck()
- fuelCheck()
- end
- function builder.platform(platformz, platformx, digdown)
- if not (digdown == true) or not (digdown == false) or (platformz == null) or (platformx == null) then
- clearCurs()
- print("You did it wrong, maggot!")
- print("Usage:")
- print("platform(<length>, <width>, <true or false>)")
- shell.exit()
- end
- --[[builds a basic platform of variable size,
- USAGE: platform(length, width, boolean);
- (if you set the boolean to 'true', you will give the order to replace every block underneath)]]
- local x = platformz
- local z = platformx
- for i = 2, z, 1 do
- row(x, digdown)
- turtle.turnRight()
- while turtle.detect() do
- turtle.dig()
- sleep(2)
- end
- turtle.forward()
- turtle.turnLeft()
- end
- row(x)
- end
- function builder.row(rowx, rowdigdown)
- --[[builds a basic row of variable length
- USAGE: platform(length, boolean);
- (if you set the boolean to 'true', you will give the order to replace every block underneath)]]
- local x = rowx
- local pdown = rowdigdown
- for i = 2, x, 1 do
- while turtle.detect() do
- turtle.dig()
- sleep(1.5)
- end
- if (pdown == true) then
- turtle.digDown()
- turtle.placeDown()
- end
- turtle.forward()
- end
- turtle.digDown()
- while turtle.detect() do
- turtle.dig()
- sleep(2)
- end
- turtle.placeDown()
- for i = 2, z, 1 do
- turtle.back()
- end
- end
- function builder.wall(wallx, wallz)
- --[[builds a basic wall of variable size,
- USAGE: wall(length, width)]]
- local z = wallz
- local x = wallx
- for i = 0, 1, 1 do
- for u = 2, x, 1 do
- turtle.forward()
- turtle.placeDown()
- if (y % x/3 == 0) or (y % 6 == 0) then
- doubleCheck()
- end
- end
- turtle.turnRight()
- end
- end
- function builder.reltogr()
- print("Enter where you'd like the building to be, relative to the ground")
- yg = tonumber(read())
- clearCurs()
- if yg > 0 then
- for i = 1, yg, 1 do
- while turtle.detectUp() do
- turtle.digUp()
- sleep(1.5)
- end
- turtle.up()
- end
- else
- for i = 1, math.abs(yg), 1 do
- turtle.digDown()
- turtle.down()
- end
- end
- end
- function builder.turtleName()
- if shell.run("label", "get") == "No Computer label" then
- shell.run("label", "set ", "Builder")
- end
- end
- function builder.box(width, length, height)
- local x = width
- local z = length
- local y = height
- function wallUp(y)
- doubleCheck()
- for local i = 2, y, 1 do
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- turtle.placeDown()
- end
- end
- function forwDecline(y)
- doubleCheck()
- turtle.dig()
- turtle.forward()
- for local i = 2, y, 1 do
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- end
- for i = 2, y, 1 do
- turtle.placeDown()
- turtle.up()
- end
- end
- function floof(y)
- for i = 2, y, 1 do
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- end
- turtle.placeDown()
- for i = 2, y, 1 do
- turtle.up()
- end
- turtle.placeDown()
- end
- function row(y, z)
- floof(y)
- for i = 4, z, 1 do
- clearDig()
- turtle.forward()
- floof(y)
- end
- for i = 4, z, 1 do
- turtle.back()
- end
- end
- for i = 0, 1, 1 do
- for i = 2, z, 1 do
- wallUp(y)
- clearDig()
- turtle.forward()
- end
- turtle.turnRight()
- for i = 2, x, 1 do
- wallUp(y)
- clearDig()
- turtle.forward()
- end
- end
- clearDig()
- turtle.forward()
- turtle.turnRight()
- clearDig()
- turtle.forward()
- turtle.turnLeft()
- clearDig()
- row(y, z)
- for i = 4, x, 1 do
- turtle.turnRight()
- clearDig()
- turtle.forward()
- turtle.turnLeft()
- row(y, z)
- end
- turtle.turnLeft()
- for i = 3, x, 1 do
- turtle.forward()
- end
- end
- return builder
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement