Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Honeycomb Builder by DennouNeko
- --
- -- Builds a "honeycomb cell" of fixed size, based on project from one of Hypnotized's
- -- YouTube videos.
- --
- -- Place wall material (logs) in slots 1-2, frame material in slots 3-4 (planks/slabs)
- -- and floor material (dirt/grass) in slots 5-13.
- -- Of course those are just suggestions. You can use any materials you want.
- local args = {...}
- local swap = (args[1] == "left")
- local t = turtle
- local slot = 5
- local slota = 1
- local slotb = 3
- function down(num)
- if num == nil then num = 1 end
- num = tonumber(num)
- for i = 1,num do
- while not t.down() do
- end
- end
- end
- function up(num)
- if num == nil then num = 1 end
- for i = 1,num do
- while not t.up() do
- end
- end
- end
- function fwd(num)
- if num == nil then num = 1 end
- num = tonumber(num)
- for i = 1,num do
- while not t.forward() do
- end
- end
- end
- function step()
- while t.getItemCount(slot) == 0 do
- slot = slot + 1
- t.select(slot)
- end
- t.placeDown()
- end
- function run_n(num)
- step()
- for i = 2,num do
- fwd()
- step()
- end
- end
- function row_up(left)
- if left then
- t.turnLeft()
- fwd()
- t.turnRight()
- fwd()
- else
- t.turnRight()
- fwd()
- t.turnLeft()
- fwd()
- end
- t.turnLeft()
- t.turnLeft()
- step()
- end
- function row_dn(left)
- t.turnRight()
- t.turnRight()
- if left then
- fwd()
- t.turnRight()
- fwd()
- t.turnLeft()
- else
- fwd()
- t.turnLeft()
- fwd()
- t.turnRight()
- end
- step()
- end
- function turn(left)
- if left then
- t.turnLeft()
- fwd()
- t.turnLeft()
- step()
- else
- t.turnRight()
- fwd()
- t.turnRight()
- step()
- end
- end
- function put_layer0(place)
- local len = 14
- for i = 1,6 do
- run_n(len)
- row_up(not swap)
- len = len + 2
- run_n(len)
- turn(swap)
- end
- run_n(len)
- turn(not swap)
- run_n(len)
- turn(swap)
- for i=1,6 do
- run_n(len)
- row_dn(not swap)
- len = len - 2
- run_n(len)
- if i < 6 then
- turn(swap)
- else
- if swap then
- t.turnRight()
- fwd(25)
- t.turnRight()
- else
- t.turnLeft()
- fwd(25)
- t.turnLeft()
- end
- end
- end
- end
- function pilar(num)
- for i = 1,num do
- up(1)
- step()
- end
- fwd()
- down(num)
- end
- function step_up1(left)
- if left then
- fwd()
- t.turnLeft()
- fwd()
- t.turnRight()
- step()
- else
- fwd()
- t.turnRight()
- fwd()
- t.turnLeft()
- step()
- end
- end
- function step_up2(left)
- if left then
- t.turnLeft()
- fwd()
- t.turnRight()
- fwd()
- step()
- else
- t.turnRight()
- fwd()
- t.turnLeft()
- fwd()
- step()
- end
- end
- function put_layer1()
- slot = slota
- t.select(slot)
- up(1)
- step()
- pilar(3)
- step()
- for i=3,14 do
- fwd()
- step()
- end
- if swap then
- t.turnRight()
- pilar(3)
- t.turnLeft()
- fwd()
- t.turnRight()
- else
- t.turnLeft()
- pilar(3)
- t.turnRight()
- fwd()
- t.turnLeft()
- end
- step()
- for i = 1,5 do
- fwd()
- step()
- step_up1(swap)
- end
- pilar(3)
- fwd(2)
- step()
- if swap then
- t.turnRight()
- pilar(3)
- t.turnLeft()
- fwd()
- else
- t.turnLeft()
- pilar(3)
- t.turnRight()
- fwd()
- end
- step()
- for i = 1,5 do
- fwd()
- step()
- step_up2(not swap)
- end
- if swap then
- t.turnRight()
- else
- t.turnLeft()
- end
- pilar(3)
- step()
- for i = 3,14 do
- fwd()
- step()
- end
- if swap then
- t.turnRight()
- pilar(3)
- t.turnLeft()
- fwd()
- t.turnRight()
- else
- t.turnLeft()
- pilar(3)
- t.turnRight()
- fwd()
- t.turnLeft()
- end
- step()
- for i = 1,5 do
- fwd()
- step()
- step_up1(swap)
- end
- pilar(3)
- fwd(2)
- step()
- if swap then
- t.turnRight()
- pilar(3)
- t.turnLeft()
- fwd()
- else
- t.turnLeft()
- pilar(3)
- t.turnRight()
- fwd()
- end
- step()
- for i = 1,4 do
- fwd()
- step()
- step_up2(not swap)
- end
- fwd()
- step()
- if swap then
- t.turnRight()
- fwd()
- t.turnLeft()
- up(3)
- fwd()
- t.turnRight()
- else
- t.turnLeft()
- fwd()
- t.turnRight()
- up(3)
- fwd()
- t.turnLeft()
- end
- end
- function put_layer2()
- slot = slotb
- t.select(slot)
- up(1)
- step()
- for i = 2,14 do
- fwd()
- step()
- end
- if swap then
- t.turnRight()
- else
- t.turnLeft()
- end
- step_up1(swap)
- for i = 1,5 do
- fwd()
- step()
- step_up1(swap)
- end
- for i = 1,3 do
- fwd()
- step()
- end
- step_up2(not swap)
- for i = 1,5 do
- fwd()
- step()
- step_up2(not swap)
- end
- if swap then
- t.turnRight()
- else
- t.turnLeft()
- end
- for i = 2,14 do
- fwd()
- step()
- end
- if swap then
- t.turnRight()
- else
- t.turnLeft()
- end
- step_up1(swap)
- for i = 1,5 do
- fwd()
- step()
- step_up1(swap)
- end
- for i = 1,3 do
- fwd()
- step()
- end
- step_up2(not swap)
- for i = 1,5 do
- fwd()
- step()
- step_up2(not swap)
- end
- end
- if swap then
- t.turnLeft()
- else
- t.turnRight()
- end
- t.select(slot)
- put_layer0()
- put_layer1()
- put_layer2()
- if swap then
- t.turnRight()
- -- fwd()
- t.turnRight()
- else
- t.turnLeft()
- -- fwd()
- t.turnLeft()
- end
- fwd()
- down(5)
Advertisement
Add Comment
Please, Sign In to add comment