Advertisement
cochise57

Untitled

Aug 28th, 2015
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2.   p1 = peripheral.wrap("right")
  3.   p2 = peripheral.wrap("left")
  4.     prox = sensor.wrap("back")
  5.  
  6.  
  7. while true do
  8.  local target = prox.getTargets()
  9. for tarName, _ in pairs(target) do
  10.     --fetch the detailed information table for the current target.
  11.     local details = prox.getTargetDetails(tarName)
  12.     if details ~= nil then
  13.     if details.Riding ~= nil then
  14.      if details.Riding.Name == "Creeper" then
  15.        print("Creper")
  16.        while p2.testBundledInput("west",colors.green) == false do
  17.          --print("Wait")
  18.          p1.setBundledOutput(colors.white)
  19.          os.sleep(1)
  20.        end
  21.       p1.setBundledOutput(0)
  22.       --os.reboot()
  23.       break
  24.      elseif details.Riding.Name == "Spider" then
  25.        print("Spider")
  26.        while p2.testBundledInput("west",colors.green) == false do
  27.          --print("Wait")
  28.          p1.setBundledOutput(colors.black)
  29.          os.sleep(1)
  30.        end
  31.       p1.setBundledOutput(0)
  32.       --os.reboot()
  33.       break
  34.      elseif details.Riding.Name == "Skeleton" then
  35.        print("Skeleton")
  36.        while p2.testBundledInput("west",colors.green) == false do
  37.         -- print("Wait")
  38.          p1.setBundledOutput(colors.gray)
  39.           os.sleep(1)
  40.        end
  41.       p1.setBundledOutput(0)
  42.       --os.reboot()
  43.       break
  44.      elseif details.Riding.Name == "Zombie" then
  45.       print("Zombie")
  46.       while p2.testBundledInput("west",colors.green) == false do
  47.        --  print("Wait")
  48.          p1.setBundledOutput(colors.green)
  49.          --os.reboot()
  50.          os.sleep(1)
  51.        end
  52.       p1.setBundledOutput("right",0)
  53.       break
  54.      else
  55.        while p2.testBundledInput("west",colors.green) == false do
  56.        --  print("Wait")
  57.          p1.setBundledOutput(colors.brown)
  58.          --os.reboot()
  59.          os.sleep(1)
  60.        end
  61.       p1.setBundledOutput(0)
  62.       break
  63.      end
  64.     else
  65.      --os.reboot()
  66.      break    
  67.     end
  68.     else
  69.     break
  70.     end
  71.    
  72. end
  73. os.sleep(0.7)
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement