Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- -----------------------------
- -- Railbed crafter
- -- pastebin get k3vJG3ED startup
- -- -----------------------------
- DEBUG = false
- function log( message )
- if DEBUG then
- print(message)
- end
- end
- function toStartPosition( )
- while turtle.detect() do
- turtle.turnLeft()
- end
- log('Start position')
- end
- function suckFrom( direction )
- log('suckFrom '..direction)
- sucked = false
- while not sucked do
- if direction == 'front' then
- sucked = turtle.suck()
- elseif direction == 'down' then
- sucked = turtle.suckDown()
- elseif direction == 'up' then
- sucked = turtle.suckUp()
- end
- if not sucked then
- sleep(15)
- end
- end
- log('suck done')
- end
- function dropTo( direction, amount )
- log('dropTo '..direction)
- amount = amount or 64
- dropped = false
- while not dropped do
- if direction == 'front' then
- dropped = turtle.drop(amount)
- elseif direction == 'down' then
- dropped = turtle.dropDown(amount)
- elseif direction == 'up' then
- dropped = turtle.dropUp(amount)
- end
- if not dropped then
- sleep(15)
- end
- end
- log('drop done')
- end
- function compressChest()
- log('compressChest')
- turtle.select(13)
- turtle.suck()
- turtle.suck()
- turtle.drop()
- turtle.select(14)
- turtle.drop()
- log('compress done')
- end
- function suckAmount( slot_num, amount, direction )
- log('suckAmount '..direction)
- compressChest()
- turtle.select(slot_num)
- suckFrom(direction)
- while turtle.getItemCount(slot_num) < amount do
- turtle.drop()
- sleep(15)
- suckFrom(direction)
- end
- if turtle.getItemCount(slot_num) > amount then
- dropTo(direction, turtle.getItemCount(slot_num) - amount)
- end
- log('suck amount done')
- end
- toStartPosition()
- rs.setOutput('bottom', false)
- for n=1,16 do
- turtle.select(n)
- turtle.drop()
- end
- turtle.turnLeft()
- while true do
- -- Craft planks
- log('Craft planks')
- suckAmount(1, 3, 'front')
- turtle.craft()
- turtle.turnLeft()
- dropTo('front', 12)
- -- Craft half-blocks
- log('Craft half-blocks')
- suckAmount(1, 4, 'front')
- suckAmount(2, 4, 'front')
- suckAmount(3, 4, 'front')
- turtle.select(4)
- turtle.craft()
- dropTo( 'front', 24 )
- -- Craft tie
- log('Craft tie')
- suckAmount(5, 8, 'front')
- suckAmount(6, 8, 'front')
- suckAmount(7, 8, 'front')
- for i=1,8 do
- suckAmount(2, 1, 'up')
- turtle.select(1)
- turtle.craft()
- dropTo('front', 1)
- turtle.select(2)
- turtle.turnLeft()
- dropTo( 'front', 1 )
- turtle.turnRight()
- end
- -- Craft railbed
- log('Craft railbed')
- suckAmount(1, 2, 'front')
- suckAmount(2, 2, 'front')
- suckAmount(5, 2, 'front')
- suckAmount(6, 2, 'front')
- turtle.craft()
- turtle.dropDown()
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement