Advertisement
steveg22

brewery

Sep 28th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. ae = peripheral.wrap("left")
  2.  
  3. function getAEId(id, meta)
  4.    return meta*32768 + id
  5. end
  6.  
  7. potions = {
  8.    ["regen"] = getAEId(373, 8193),
  9.    ["fire resist"] = getAEId(373, 8195),
  10.    ["strength"] = getAEId(373, 8201),
  11.    ["swiftness"] = getAEId(373, 8194),
  12. }
  13.  
  14. rightTriggers = {
  15.    [colors.white] = "regen",
  16.    [colors.orange] = "fire resist",
  17.    [colors.magenta] = "swiftness",
  18.    [colors.lightBlue] = "strength",
  19. }
  20.  
  21. topTriggers = {}
  22.  
  23. while true do
  24.  
  25.    color = redstone.getBundledInput("right")
  26.    potion = rightTriggers[color]
  27.    if potion == nil then
  28.       color = redstone.getBundledInput("top")
  29.       potion = topTriggers[color]
  30.    end
  31.    
  32.    if not(potion == nil) then
  33.       potionId = potions[potion]
  34.       items = ae.listItems()
  35.       if items[potionId] == nil then
  36.          ae.craft(potionId, 1)
  37.          count = 0
  38.      
  39.          repeat
  40.             items = ae.listItems()
  41.             count = items[potionId]
  42.             sleep(1)
  43.          until count >= 3
  44.       end
  45.      
  46.       turtle.select(1)
  47.      
  48.       ae.retrieve(potionId, 3, 4)
  49.      
  50.       for n=1,3 do
  51.          turtle.select(n)
  52.          turtle.drop()
  53.       end
  54.      
  55.       sleep(10)
  56.       redstone.setBundledOutput("right", colors.black)
  57.       sleep(2)
  58.       redstone.setBundledOutput("right", 0)
  59.    end
  60.    sleep(0.1)
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement