Advertisement
Guest User

Radar.lua

a guest
Feb 26th, 2014
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local SensorSide = "left"
  2. local badNPC = {"Zombie","Enderman","Skeleton","Creeper","Spider"}
  3. local goodNPC = {"Pig","Cow","Chicken","SnowGolem"}
  4. local trusted = {"gfcwfzkm","Zachecho"}
  5.  
  6. os.loadAPI("ocs/apis/sensor") --Load Sensor API
  7. local prox = sensor.wrap(SensorSide) --Sensor Side
  8. local targets = prox.getTargets() --Find People/NPCs
  9.  
  10.  
  11. function CheckMob( Str )
  12.   for ii,xx in pairs(badNPC) do
  13.     if string.match(Str,ii) == true then
  14.       term.setTextColor(colors.blue)
  15.       return true
  16.     end
  17.   end
  18.   for ii,xx in pairs(goodNPC) do
  19.     if string.match(Str,ii) == true then
  20.       term.setTextColor(colors.lightBlue)
  21.       return true
  22.     end
  23.   end
  24.   for ii,xx in pairs(trusted) do
  25.     if string.match(Str,ii) == true then
  26.       term.setTextColor(colors.green)
  27.       return true
  28.     end
  29.   end
  30. end
  31.  
  32. for name, basicDetails in pairs(targets) do
  33.   CheckMob( name )
  34.   print("Found entity: "..name)
  35.   term.setTextColor(colors.white)
  36.   local moreDetails = prox.getTargetDetails(name)
  37.   print("Health: "..moreDetails.Health)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement