Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ItemSupply:
- -- rows, starting with 1
- stoneBlock = 1
- dirtBlock = 2
- redstoneBlock = 3
- fanBlock = 4
- spawnerHeight = 1
- -- 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, (row)*4 do
- -- exit if enough items
- if turtle.getItemCount(start-1) >= target then break end
- turtle.select(i)
- turtle.transferTo(start-1)
- end
- end
- function row2slot(row)
- return (row-1)*4+1
- end
- function buildLevel()
- -- place dirt
- if dirtEnabled then
- moveSupplyRow(dirtBlock)
- turtle.select(row2slot(dirtBlock))
- turtle.place()
- end
- -- move up
- turtle.up()
- --place stone brick below
- moveSupplyRow(stoneBlock)
- turtle.select(row2slot(stoneBlock))
- turtle.placeDown()
- -- place fan
- if fanEnabled then
- turtle.forward(); turtle.forward(); turtle.turnLeft(); turtle.turnLeft()
- moveSupplyRow(fanBlock)
- turtle.select(row2slot(fanBlock))
- turtle.place()
- --move up and back to wall position
- turtle.up()
- turtle.turnLeft(); turtle.turnLeft(); turtle.back(); turtle.back()
- else
- turtle.up()
- end
- -- place redstone block below?
- if redstoneEnabled then
- moveSupplyRow(redstoneBlock)
- turtle.select(row2slot(redstoneBlock))
- turtle.placeDown()
- end
- turtle.select(row2slot(stoneBlock))
- -- Which height?
- -- i = 1 -> 2 blocks height
- -- i = 2 -> 3 blocks height
- -- ...
- for i = 1, spawnerHeight do
- -- place stone brick
- turtle.up()
- turtle.placeDown()
- end
- -- place floor of the next level
- turtle.place()
- turtle.up()
- turtle.placeDown()
- end
- buildLevels = 1
- fanEnabled = false
- redstoneEnabled = false
- stoneEnabled = true
- dirtEnabled = true
- print("How many levels to build? Default: 1")
- buildLevels = tonumber(io.read()) or 1
- print("--> ".. tostring(buildLevels) .. " levels")
- print("Build redstone? Y/n")
- redstoneEnabled = false
- if string.lower(io.read()) == "n" then
- redstoneEnabled = false
- else
- redstoneEnabled = true
- end
- print("--> Build redstone: ".. tostring(redstoneEnabled))
- print("Build fans? y/N")
- fanEnabled = string.lower(io.read()) == "y" and true or false
- print("--> Build fans: ".. tostring(fanEnabled))
- for n = 1, buildLevels do
- buildLevel()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement