Clem105

Water Boss

May 31st, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. local chest  = peripheral.wrap("left")
  2. local Data = {}
  3. local Size = chest.getInventorySize()
  4. local sensor = peripheral.wrap("right")
  5.  
  6. function FillData()
  7.         for i=1,Size do
  8.                 Data[i] = {}
  9.                 if chest.getStackInSlot(i) ~= nil then
  10.                         for k,v in pairs(chest.getStackInSlot(i)) do
  11.                                         Data[i][k] = v
  12.                         end
  13.                 end
  14.         end
  15. end
  16.  
  17.  
  18. function Kill()
  19.     for i = 1,#sensor.getMobIds() do
  20.         for k,v in pairs(sensor.getMobData(sensor.getMobIds()[i])) do
  21.             if k == "type" and v == "Water Guardian" then
  22.                 for 1,10 do
  23.                     turtle.attack()
  24.                 end
  25.                 Kill()
  26.             else
  27.                 turtle.suck()
  28.                 turtle.turnLeft()
  29.                 for i = 1,14 do
  30.                     turtle.select(i)
  31.                     turtle.drop()
  32.                 end
  33.             end
  34.         end
  35.     end
  36. end
  37.    
  38.    
  39.    
  40. while rs.getInput("back") == true do
  41.     turtle.select(16)
  42.     if turtle.getItemCount(16) == 32 then
  43.         for i = 1,#Data do
  44.             if Data[i]["name"] == "bucket" then
  45.                 chest.pushItemIntoSlot(2,i,32,16)
  46.             end
  47.         end
  48.     end
  49.     turtle.dropDown()
  50.     turtle.select(1)
  51.     turtle.dropUp()
  52.     turtle.select(15)
  53.     if turtle.getItemCount(15) == 32 then
  54.         for i = 1,#Data do
  55.             if Data[i]["name"] == "boat" then
  56.                 chest.pushItemIntoSlot(2,i,32,15)
  57.             end
  58.         end
  59.     end
  60.     turtle.dropUp()
  61.     sleep(5)
  62.     Kill()
  63. end
Advertisement
Add Comment
Please, Sign In to add comment