Advertisement
ArbitraryHubris

mobTurtle

Dec 26th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.69 KB | None | 0 0
  1. mobSlot = {enderman = 1, ghast = 2, sheep = 3, blaze = 4, slime = 5, witch = 6, cow = 7, ironGolem = 8, witherSkelly = 9, creeper = 10}
  2. mobActive = {enderman = true, ghast = true, sheep = true, blaze = true, slime = true, witch = true, cow = true, ironGolem = true, witherSkelly = true, creeper = true}
  3.  
  4. function error()
  5.         print("Please check all slots")
  6.         for x, y in pairs(mobSlot) do
  7.                 if mobActive[x] then
  8.                         print("Place " .. x .. " in slot " .. y)
  9.                 end
  10.         end
  11. end
  12.  
  13. function init()
  14.         currentMob = 0
  15.         turtle.select(16)
  16.         loadedNet = turtle.suckUp()
  17.         for x, y in pairs(mobSlot) do
  18.                 if mobActive[x] then
  19.                         if turtle.getItemCount(y) == 0 then
  20.                                 if loadedNet then
  21.                                         turtle.transferTo(y)
  22.                                         loadedNet = false
  23.                                 else
  24.                                         error()
  25.                                 end
  26.                         end
  27.                 end
  28.         end
  29. end
  30.  
  31. init()
  32. local modem = peripheral.wrap("right")
  33. modem.open(1001)
  34.  
  35. while true do
  36.         local messageArguments = {os.pullEvent("modem_message")}
  37.         selection = messageArguments[5]
  38.         if selection == "reset" then
  39.                 init()
  40.         else
  41.                 if currentMob ~= 0 then
  42.                         turtle.select(mobSlot[currentMob])
  43.                         turtle.suckUp()
  44.                 end
  45.                 turtle.select(mobSlot[selection])
  46.                 turtle.dropUp()
  47.                 currentMob = selection
  48.         end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement