Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Usage: place at Stone brick level, turtle facing against the wall (it will turn itself anyway)
- -- Supply with stone Blocks,
- -- Supply with dirt Blocks (cursed earth)
- -- it will build a whole floor row for a level (inside pre-built walls! https://pastebin.com/vBszs7pe )
- -- ItemSupply:
- -- rows, starting with 1
- wireBlock = 1 -- need 76+ per level (PLUS spawnerHeight)
- chestSlot = 16 -- ender chest: slot or 0 to disable
- spawnerHeight = (2) * 2 -- height between Fan levels
- direction = "up"
- -- moves row to the first slow of the row
- -- at least keep Target supply in slot
- function moveSupplyRow(row, target)
- if not target then target = 16 end
- local start = (row-1)*4+2
- for i = start, 16 do
- if i ~= chestSlot then
- -- exit if enough items
- if turtle.getItemCount(start-1) >= target then break end
- turtle.select(i)
- turtle.transferTo(start-1)
- end
- end
- if chestSlot ~= 0 and turtle.getItemCount(start-1) < target then
- -- not enough items, fill from ender chest
- local direction
- local dirs = {"", "Up", "Down"}
- turtle.select(chestSlot)
- for d = 1, #dirs do
- direction = dirs[d]
- if turtle["place" .. direction]() then
- break
- end
- if d == 3 then
- error("Couldnt refill from chest")
- end
- end
- for i = 1, 15 do
- turtle["suck" .. direction]()
- os.sleep(0.2)
- end
- -- free enderchest slot
- turtle.select(chestSlot)
- turtle["drop" .. direction]()
- turtle["dig" .. direction]()
- end
- turtle.select(row2slot(row))
- end
- function row2slot(row)
- return (row-1)*4+1
- end
- function buildRow(n)
- for i = 1, n do
- turtle.place()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- function buildCorner(n)
- for i = 1, n do
- -- Corner 1 Front
- turtle.place()
- -- Corner 1 Left
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.place()
- --
- turtle.turnRight()
- end
- end
- function buildLevel()
- -- build complete row
- for i = 1, 4 do
- moveSupplyRow(wireBlock, target)
- -- build first side half
- buildRow(7)
- turtle.forward()
- buildCorner(6)
- turtle.forward()
- turtle.turnLeft()
- turtle.back()
- end
- -- turtle can't move to start position because of cable block
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- for i = 1, spawnerHeight do
- turtle[direction]()
- end
- end
- buildLevels = 17
- stoneEnabled = true
- dirtEnabled = true
- print("How many levels to build? Default: ".. tostring(buildLevels))
- buildLevels = tonumber(io.read()) or buildLevels
- print("--> ".. tostring(buildLevels) .. " levels")
- print("Direction? 'up' or 'down'. Default: 'up'")
- direction = io.read()
- if direction == "" then
- direction = "up"
- end
- -- move away from wall after placement
- turtle.back()
- for n = 1, buildLevels do
- buildLevel()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement