Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --enderchests:
- --white = 0, red = 1
- --241 0 wall slot 14
- --241:224 2 roof slot 15
- --241:14 1 fuel slot 16
- --
- local action = "wall"
- local roofType = 0
- local materialSlot = 1
- local materialChestSlot = 14
- local roofSlot = 12
- local roofChestSlot = 15
- local FuelSlot = 13
- local FuelChestSlot = 16
- local xt = 0
- local yt = 0
- local xcalc = 0 --voor berekening
- local ycalc = 0
- local angle = 1
- --local angleIncrease = 1 --resolutie circel
- local ht = 0
- local hhl = 1
- local diam = 10 --voor dak zonder toren
- local autostart = 0 --voor autodinges
- function selMat()
- local fillSlot = 1
- while turtle.getItemCount(materialSlot) == 0 do
- materialSlot = materialSlot + 1
- if materialSlot == 12 then
- turtle.select(materialChestSlot)
- turtle.placeUp()
- while fillSlot < 12 do
- turtle.select(fillSlot)
- turtle.suckUp(fillSlot)
- fillSlot = fillSlot + 1
- end
- turtle.select(materialChestSlot)
- turtle.digUp()
- materialSlot = 1
- else
- end
- end
- turtle.select(materialSlot)
- end
- function selRoofMat()
- if turtle.getItemCount(roofSlot) == 0 then
- turtle.select(roofChestSlot)
- turtle.placeUp()
- turtle.select(roofSlot)
- turtle.suckUp(roofSlot)
- turtle.select(roofChestSlot)
- turtle.digUp()
- else
- end
- turtle.select(roofSlot)
- end
- function getTowerWallSpec()
- local aftreksel = 0
- term.clear()
- term.setCursorPos(1,1)
- term.write(" tower diameter = ")
- diam = tonumber(read())
- term.write(" tower height = ")
- hhl = tonumber(read())
- term.write("this is the center [y/n] ")
- center = tostring(read())
- print(" ")
- origineleDiam = diam
- while diam < 17 and aftreksel == 0 do
- term.clear()
- term.setCursorPos(1,1)
- print("Circels smaller than 17 look like crap.")
- print(" Are you sure you want to continue? ")
- print(" ")
- term.write(" y/n ")
- queef = tostring(read())
- print(" ")
- if queef ~= "y" and queef ~= "Y" then
- getTowerWallSpec()
- else
- aftreksel = 1
- end
- end
- end
- function getRoofSpec()
- term.clear()
- term.setCursorPos(1,1)
- print("Roof properties:")
- print(" ")
- print("0-No roof")
- print("1-Pointy Roof")
- print("2-Slanted Roof")
- print(" ")
- term.write("Choose type = ")
- roofType = tonumber(read())
- print(" ")
- if roofType == 1 then
- term.clear()
- term.setCursorPos(1,1)
- print("Roof properties:")
- print(" ")
- term.write("Roof overhang = ")
- overhang = tonumber(read())
- print(" ")
- roofOffset = overhang + 1
- elseif roofType == 2 then
- print("Slanted")
- else
- end
- end
- function toCenter()
- local ft = 0
- if center == "y" or center == "Y" then
- turtle.turnRight()
- while ft < diam/2 do
- turtle.forward()
- ft = ft + 1
- print(ft.."/"..diam/2)
- end
- turtle.turnLeft()
- else
- end
- end
- function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- function drawCircel()
- for angle = 1, 360 do
- xcalc = math.cos(angle * math.pi / 180) * diam + xcalc
- ycalc = math.sin(angle * math.pi / 180) * diam + ycalc
- xCoordinate = round(xcalc/110, 0)
- yCoordinate = round(ycalc/110, 0)
- moveToXY()
- angle = angle + 1
- printPos(angle, ht)
- reFuel()
- if action == "wall" then
- selMat()
- elseif action == "roof" then
- selRoofMat()
- else
- print("fuckass")
- sleep(20)
- end
- turtle.placeDown()
- --sleep(0.1)
- end
- end
- function moveToXY()
- while xt > xCoordinate do
- local moved = false
- while not moved do
- moved = turtle.forward()
- end
- xt = xt - 1
- end
- while xt < xCoordinate do
- moved = false
- while not moved do
- moved = turtle.back()
- end
- xt = xt + 1
- end
- while yt > yCoordinate do
- turtle.turnRight()
- moved = false
- while not moved do
- moved = turtle.forward()
- end
- turtle.turnLeft()
- yt = yt - 1
- end
- while yt < yCoordinate do
- turtle.turnRight()
- moved = false
- while not moved do
- moved = turtle.back()
- end
- turtle.turnLeft()
- yt = yt + 1
- end
- end
- function printPos(angle, ht)
- progress = 100 * (angle / 360 + ht) / hhl
- progressR = round(progress, 1)
- roofProgress = 100 * (angle / 360)
- roofProgressR = round(roofProgress, 1)
- roofLevel = ht - hhl
- if roofOffset > 0 then
- maxRoofLevel = (origineleDiam + 2) / 2
- else
- maxRoofLevel = (origineleDiam - 2) / 2
- end
- term.clear()
- term.setCursorPos(1,1)
- print("diameter = "..diam.." blocks")
- print("angle = "..angle.." deg")
- print(" ")
- if action == "wall" then
- print("Wall:")
- print(" ")
- print("Wall height = "..ht.."/"..hhl)
- print("Wall progress = "..progressR.."%")
- elseif action == "roof" then
- print("Roof:")
- print(" ")
- print("Overhang = "..overhang)
- print("Roof height = "..roofLevel.."/"..maxRoofLevel)
- print("Current level progress = "..roofProgressR.."%")
- else
- end
- end
- function reFuel()
- if turtle.getFuelLevel() < 10 then
- if turtle.getItemCount(FuelSlot) == 0 then
- turtle.select(FuelChestSlot)
- turtle.placeUp()
- turtle.select(FuelSlot)
- turtle.suckUp()
- turtle.select(FuelChestSlot)
- turtle.digUp()
- else
- end
- turtle.select(FuelSlot)
- turtle.refuel()
- else
- end
- end
- function towerWall()
- action = "wall"
- toCenter()
- while ht < hhl do
- drawCircel()
- local moved = false
- while not moved do
- moved = turtle.up()
- end
- ht = ht + 1
- reFuel()
- end
- end
- function towerRoof()
- local ot = 1
- action = "roof"
- diam = diam + 2 * roofOffset
- if roofOffset > 0 then
- turtle.turnRight()
- while ot < roofOffset do
- local moved = false
- while not moved do
- moved = turtle.forward()
- end
- ot = ot + 1
- end
- turtle.turnLeft()
- elseif roofOffset <= 0 then
- turtle.turnLeft()
- while ot > roofOffset do
- moved = false
- while not moved do
- moved = turtle.forward()
- end
- ot = ot - 1
- end
- turtle.turnRight()
- else
- print("kloothommel")
- end
- while diam > 1 do
- diam = diam - 2
- drawCircel()
- turtle.up()
- ht = ht + 1
- progress = 0
- turtle.turnLeft()
- moved = false
- while not moved do
- moved = turtle.forward()
- end
- turtle.turnRight()
- end
- end
- function slantedTowerRoof()
- action = "roof"
- while diam > 1 do
- diam = diam - 1
- drawCircel()
- local moved = false
- while not moved do
- moved = turtle.up()
- end
- ht = ht + 1
- progress = 0
- end
- end
- function tower()
- reFuel()
- getTowerWallSpec()
- getRoofSpec()
- towerWall()
- if roofType == 1 then
- towerRoof()
- elseif roofType == 2 then
- slantedTowerRoof()
- else
- end
- end
- --[[
- so for arguments: diameter height overhang autostart
- example: tower 20 40 2 1
- --]]
- local args = { ... }
- if args[1] == nil then
- tower()
- else
- diam = tonumber(args[1]) --diameter
- hhl = tonumber(args[2]) --tower height
- overhang = tonumber(args[3]) --should be 2
- if args[4] == nil then
- autostart = 0
- else
- autostart = tonumber(args[4])
- end
- roofOffset = overhang + 1
- local center = "y"
- origineleDiam = diam
- if autostart == 1 then --refuel en alle kistjes pakken
- turtle.select(FuelSlot)
- turtle.suckDown(16)
- turtle.refuel()
- turtle.select(FuelChestSlot)
- turtle.digDown()
- turtle.down()
- turtle.select(materialChestSlot)
- turtle.digDown()
- turtle.down()
- turtle.select(roofChestSlot)
- turtle.digDown()
- turtle.down()
- local moved = false
- local dist = 0
- while dist < 5 do
- while not moved do
- moved = turtle.up()
- end
- dist = dist + 1
- end
- else
- end
- reFuel()
- towerWall()
- towerRoof()
- print("done")
- end
Add Comment
Please, Sign In to add comment