Advertisement
hoblin

Humus crafter

Dec 28th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.54 KB | None | 0 0
  1. -- -----------------------------
  2. -- Humus crafter
  3. -- pastebin get bWRVZAqu startup
  4. -- -----------------------------
  5. -- directions:
  6. --   * front: empty (start position)
  7. --   * left: humus chest
  8. --   * back: dirt chest
  9. --   * right: compost chest
  10. --   * down: macerator
  11. --   * up: wheat chest
  12.  
  13. function toStartPosition(  )
  14.   while turtle.detect() do
  15.     turtle.turnLeft()
  16.   end
  17. end
  18.  
  19. function compressChest( item_type )
  20.   turtle.select(13)
  21.   if item_type == 'dirt' then
  22.     turtle.suck()
  23.     turtle.suck()
  24.     turtle.drop()
  25.     turtle.select(14)
  26.     turtle.drop()
  27.   else
  28.     turtle.suckUp()
  29.     turtle.suckUp()
  30.     turtle.dropUp()
  31.     turtle.select(14)
  32.     turtle.dropUp()
  33.   end
  34. end
  35.  
  36. function suckAmount( slot_num, amount, item_type )
  37.   toStartPosition()
  38.   if item_type == 'dirt' then
  39.     turtle.turnLeft()
  40.     turtle.turnLeft()
  41.   end
  42.   compressChest( item_type )
  43.   turtle.select(slot_num)
  44.   while turtle.getItemCount(slot_num) < amount do
  45.     if item_type == 'dirt' then
  46.       turtle.drop()
  47.       sleep(15)
  48.       turtle.suck()
  49.     else
  50.       turtle.dropUp()
  51.       sleep(15)
  52.       turtle.suckUp()
  53.     end
  54.   end
  55.   if turtle.getItemCount(slot_num) > amount then
  56.     if item_type == 'dirt' then
  57.       turtle.drop(turtle.getItemCount(slot_num) - amount)
  58.     else
  59.       turtle.dropUp(turtle.getItemCount(slot_num) - amount)
  60.     end
  61.   end
  62. end
  63.  
  64. toStartPosition()
  65. for n=1,16 do
  66.   turtle.select(n)
  67.   turtle.drop()
  68. end
  69.  
  70. while true do
  71.   -- Craft 9 Plantballs
  72.   suckAmount(1, 9, 'wheat')
  73.   suckAmount(2, 9, 'wheat')
  74.   suckAmount(3, 9, 'wheat')
  75.   suckAmount(5, 9, 'wheat')
  76.   suckAmount(7, 9, 'wheat')
  77.   suckAmount(9, 9, 'wheat')
  78.   suckAmount(10, 9, 'wheat')
  79.   suckAmount(11, 9, 'wheat')
  80.   turtle.select(15)
  81.   turtle.craft()
  82.   while not turtle.dropDown() do
  83.     sleep(15)
  84.   end
  85.   -- Craft 32 compost
  86.   suckAmount(6,  8, 'dirt')
  87.   suckAmount(2,  8, 'wheat')
  88.   suckAmount(5,  8, 'wheat')
  89.   suckAmount(7,  8, 'wheat')
  90.   suckAmount(10, 8, 'wheat')
  91.   turtle.select(6)
  92.   turtle.craft()
  93.   toStartPosition()
  94.   turtle.turnRight()
  95.   while not turtle.drop(24) do
  96.     sleep(15)
  97.   end
  98.   turtle.turnLeft()
  99.   -- Craft 64 humus
  100.   suckAmount(1,  8, 'dirt')
  101.   suckAmount(2,  8, 'dirt')
  102.   suckAmount(3,  8, 'dirt')
  103.   suckAmount(5,  8, 'dirt')
  104.   suckAmount(7,  8, 'dirt')
  105.   suckAmount(9,  8, 'dirt')
  106.   suckAmount(10, 8, 'dirt')
  107.   suckAmount(11, 8, 'dirt')
  108.   turtle.select(15)
  109.   turtle.craft()
  110.   toStartPosition()
  111.   turtle.turnLeft()
  112.     while not turtle.drop() do
  113.     sleep(15)
  114.   end
  115.   turtle.turnRight()
  116.   sleep(30)
  117. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement