Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Slots for items (Slots for config options can be changed in the config itself)
- fuelSlot = 16
- alvearyBlockSlot = 15
- oakSlabSlot = 14
- -- Config
- config = {
- addFrameHousings = {enabled = true, slot = 13}
- }
- -- Functions
- -- General functions
- function fuel()
- if turtle.getFuelLevel() == 0 then
- if turtle.getItemCount(fuelSlot) == 0 then
- error("No fuel left.")
- else
- turtle.select(fuelSlot)
- turtle.refuel(1)
- end
- end
- end
- -- Movement functions
- function right()
- turtle.turnRight()
- if turtle.detect() then
- turtle.dig()
- end
- fuel()
- turtle.forward()
- end
- function left()
- turtle.turnLeft()
- if turtle.detect() then
- turtle.dig()
- end
- fuel()
- turtle.forward()
- end
- function back()
- turtle.turnRight()
- turtle.turnRight()
- if turtle.detect() then
- turtle.dig()
- end
- fuel()
- turtle.forward()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function forward()
- if turtle.detect() then
- turtle.dig()
- end
- fuel()
- turtle.forward()
- end
- function up()
- if turtle.detectUp() then
- turtle.digUp()
- end
- fuel()
- turtle.up()
- end
- function down()
- if turtle.detectDown() then
- turtle.digDown()
- end
- fuel()
- turtle.down()
- end
- -- Alveary building functions
- function placeAlvBlock()
- if turtle.getItemCount(alvearyBlockSlot) == 0 then
- error("No alveary blocks left.")
- else
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.select(alvearyBlockSlot)
- turtle.placeDown()
- end
- end
- function placeSlab()
- if turtle.getItemCount(oakSlabSlot) == 0 then
- error("No oak wood slabs left.")
- else
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.select(oakSlabSlot)
- turtle.placeDown()
- end
- end
- function placeFrameHous()
- if config.addFrameHousings.enabled then
- if turtle.getItemCount(config.addFrameHousings.slot) == 0 then
- error("No frame housings left.")
- else
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.select(config.addFrameHousings.slot)
- turtle.placeDown()
- end
- else
- placeAlvBlock()
- end
- end
- function buildAlveary()
- -- Starts from the middle of the first side of the alveary
- -- New First layer
- up()
- placeAlvBlock()
- forward()
- placeAlvBlock()
- right()
- placeAlvBlock()
- right()
- placeAlvBlock()
- forward()
- placeAlvBlock()
- right()
- placeAlvBlock()
- forward()
- placeAlvBlock()
- right()
- placeAlvBlock()
- forward()
- placeAlvBlock()
- right()
- right()
- turtle.turnRight()
- turtle.turnRight()
- up()
- -- New Second layer
- back()
- placeAlvBlock()
- right()
- placeFrameHous()
- left()
- placeFrameHous()
- forward()
- placeFrameHous()
- left()
- placeFrameHous()
- forward()
- placeFrameHous()
- left()
- placeAlvBlock()
- forward()
- placeAlvBlock()
- left()
- left()
- placeFrameHous()
- up()
- -- Third layer
- placeAlvBlock()
- forward()
- placeAlvBlock()
- right()
- placeAlvBlock()
- right()
- placeAlvBlock()
- forward()
- placeAlvBlock()
- right()
- placeAlvBlock()
- forward()
- placeAlvBlock()
- right()
- placeAlvBlock()
- forward()
- placeAlvBlock()
- right()
- right()
- turtle.turnRight()
- turtle.turnRight()
- up()
- -- Oak slabs
- placeSlab()
- forward()
- placeSlab()
- right()
- placeSlab()
- right()
- placeSlab()
- forward()
- placeSlab()
- right()
- placeSlab()
- forward()
- placeSlab()
- right()
- placeSlab()
- forward()
- placeSlab()
- right()
- right()
- turtle.turnRight()
- turtle.turnRight()
- end
- function putInPosition()
- -- Puts itself in position to make another alveary in a line
- forward()
- forward()
- for i = 1, 4 do
- down()
- end
- forward()
- forward()
- forward()
- end
- -- Main program
- local tArgs = {...}
- -- Makes as many alvearies as was passed to it in a straight line, with 2 spaces in between
- count = int
- for i = 1, tArgs[1] do
- buildAlveary()
- putInPosition()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement