Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- tofu1
- -- 豆腐建築を行うプログラムです
- -- アイテムインベントリに適当にアイテム詰めて
- -- ####### Config ###########
- local haba = 15
- local okuyuki = 12
- local takasa = 5
- -- ####### Functions ########
- -- インベントリを先頭から走査し、確実にアイテムを使う
- function selectNextSlot()
- local current = turtle.getSelectedSlot()
- if current == 16 then
- return false
- else
- turtle.select(current+1)
- return true
- end
- end
- function selectNextItemSlot()
- while (turtle.getItemCount()==0) and selectNextSlot() do
- end
- end
- -- ex. myDo(turtle.place)
- function myDo(func)
- while (turtle.getItemCount()==0) and selectNextItemSlot() do
- end
- return func()
- end
- -- 建築用の関数
- function placeSomeBlocks(n)
- if n<1 then
- -- turtle.placeDown()
- myDo(turtle.placeDown)
- return
- end
- for i=1,n do
- turtle.forward() -- move to next position
- -- turtle.placeDown()
- myDo(turtle.placeDown)
- end
- end
- function placeSquare(okuyuki, haba)
- for i=1,2 do
- placeSomeBlocks(okuyuki - 1)
- turtle.turnRight()
- placeSomeBlocks(haba - 1)
- turtle.turnRight()
- end
- end
- function goToRightForward()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- end
- -- ###### Main ########
- turtle.select(1) -- the usual phrase
- turtle.up() -- move up
- -- stack six squares
- for ronoji=1,takasa do
- -- 1st stage is made with slot 1, 2nd stage is slot 2, ...
- --turtle.select(ronoji)
- -- 四角形の形にブロック配置
- -- placeSquare(haba)
- placeSquare(okuyuki, haba)
- turtle.up() -- move up
- end
- -- 屋根作り
- while (okuyuki > 0) and (haba > 0) do
- print(okuyuki, haba)
- placeSquare(okuyuki, haba)
- goToRightForward()
- okuyuki = okuyuki - 2
- haba = haba - 2
- end
- -- redstone.setOutput("bottom",true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement