Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("userInput.lua")
- os.loadAPI("buildSupport.lua")
- os.loadAPI("predictSupport.lua")
- -- type dictates what part of the building is being made. type == 1 gets the cost of the floor and support pillars
- -- type == 2 gets the cost of the walls, and type 3 gets the ceiling
- function blockCost(length, width, height, type)
- if type == 1 then
- return (width * length) + (height * 4)
- end
- if type == 2 then
- return (2 * (height * (width - 2))) + (2 * (height * (length - 2)))
- end
- if type == 3 then
- return (width * length)
- end
- end
- function returnDownCeiling(length, width, height, floors)
- turtle.turnLeft()
- width = width - 1
- height = height + 1
- for i = 1, width do
- turtle.forward()
- end
- turtle.turnLeft()
- for i = 1, length do
- turtle.forward()
- end
- for i = 1, floors do
- for j = 1, height do
- turtle.down()
- end
- end
- turtle.down()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function returnDown(height, floors)
- turtle.back()
- height = height + 1
- for i = 1, floors do
- for j = 1, height do
- turtle.down()
- end
- end
- end
- function predictReturnDown(length, width, height, floors)
- tcost = 0
- width = width - 1
- height = height + 1
- for i = 1, width do
- tcost = tcost + 1
- end
- for i = 1, length do
- tcost = tcost + 1
- end
- for i = 1, floors do
- for j = 1, height do
- tcost = tcost + 1
- end
- end
- tcost = tcost + 1
- return tcost
- end
- blockname = "minecraft:black_concrete"
- blockname2 = "minecraft:black_stained_glass_pane"
- choice = -1
- choice2 = 2
- choice3 = -1
- bcost = 0
- bcost2 = 0
- fcost = 0
- floors = 0
- length = 0
- width = 0
- height = 0
- preset = tonumber(userInput.getUserInput("Preset? (Yes = 0, No = 1) "))
- if preset == 0 then
- length = 16
- width = 16
- height = 5
- floors = 1
- choice = 2
- choice2 = 1
- choice3 = 1
- end
- while length == 0 do
- length = tonumber(userInput.getUserInput("Length: "))
- end
- while width == 0 do
- width = tonumber(userInput.getUserInput("Width: "))
- end
- while height == 0 do
- height = tonumber(userInput.getUserInput("Height: "))
- end
- while floors <= 0 do
- floors = tonumber(userInput.getUserInput("How Many Floors to Make?"))
- end
- while choice < 0 or choice > 2 do
- print("How Many Block Variants to Use?")
- choice = tonumber(userInput.getUserInput("Type 0 (for any available), 1, or 2"))
- if choice == 1 then
- while choice2 < 0 or choice2 > 1 do
- print("Would you Like the Preset?")
- choice2 = tonumber(userInput.getUserInput("Type 0 for Yes, 1 for No"))
- end
- if choice2 == 1 then
- blockname = userInput.getUserInput("Please Input Block ID: ")
- end
- end
- if choice == 2 then
- while choice2 ~= 0 and choice2 ~= 1 do
- print("Would you Like the Preset?")
- choice2 = tonumber(userInput.getUserInput("Type 0 for Yes, 1 for No"))
- end
- if choice2 == 1 then
- blockname = userInput.getUserInput("Please Input Block #1's ID: ")
- blockname2 = userInput.getUserInput("Please Input Block #2's ID: ")
- end
- end
- end
- while choice3 ~= 0 and choice3 ~= 1 do
- print("Build Ceiling?")
- choice3 = tonumber(userInput.getUserInput("Type 0 for Yes, 1 for No"))
- end
- for i = 1, floors do
- bcost = bcost + blockCost(length, width, height, 1)
- if choice == 2 then
- bcost2 = bcost2 + blockCost(length, width, height, 2)
- else
- bcost = bcost + blockCost(length, width, height, 2)
- end
- predictSupport.predictFullBuild(length, width, height)
- end
- if choice3 == 0 then
- bcost = bcost + blockCost(length, width, height, 3)
- predictSupport.predictFloor(length, width)
- end
- fcost = fcost + predictSupport.getCost()
- if not preset then
- choice2 = 3
- end
- while choice2 ~= 0 and choice2 ~= 1 do
- print("Return Drone to Start After Build?")
- choice2 = tonumber(userInput.getUserInput("Type 0 for Yes, 1 for No"))
- end
- if choice2 == 0 then
- fcost = fcost + predictReturnDown(length, width, height, floors)
- end
- while turtle.getFuelLevel() < fcost do
- print("Turtle Fuel Level Too Low for Build!")
- print("Fuel Needed" .. fcost)
- print("Current Fuel" .. turtle.getFuelLevel())
- print("Please Input Fuel")
- userInput.getUserInput("Press Enter to Continue")
- os.loadAPI("turtleRefuel.lua")
- end
- print("The Following Blocks are Needed:")
- print( bcost .. " " .. blockname)
- if bcost2 ~= 0 then
- print( bcost2 .. " " .. blockname2)
- end
- userInput.getUserInput("Press Enter to Continue")
- for j = 1, floors do
- print(choice)
- if choice == 0 then
- print("False 1")
- buildSupport.fullBuild(length, width, height)
- elseif choice == 1 and blockname ~= nil then
- print("False 2")
- buildSupport.fullBuildBlock(length, width, height, blockname)
- elseif choice == 2 and blockname ~= nil and blockname2 ~= nil then
- print("true")
- buildSupport.fullBuildBlocks(length, width, height, blockname, blockname2)
- end
- end
- if choice3 == 0 then
- turtle.up()
- if choice == 0 then
- buildSupport.buildFloor(width, length)
- else
- buildSupport.buildFloorBlock(width, length, blockname)
- end
- if choice2 == 0 then
- returnDownCeiling(length, width, height, floors)
- end
- end
- if choice2 == 0 and choice3 ~= 0 then
- returnDown(height, floors)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement