Advertisement
Birog

test

Aug 16th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. local monitor = peripheral.wrap("top")
  3.  
  4. -- the location of the redstone lamp relative to the sensor
  5. local offset = {
  6. X = 0,
  7. Y = 0,
  8. Z = 0
  9. }
  10.  
  11. -- how close a player has to be to activate the lamp
  12. local radius = 5
  13.  
  14. -- find the distance from the player position to the offset
  15. function distance(pos)
  16. local xd = pos.X - offset.X
  17. local yd = pos.Y - offset.Y
  18. local zd = pos.Z - offset.Z
  19. return math.sqrt(xd*xd + yd*yd + zd*zd)
  20. end
  21.  
  22.  
  23. local proximity = sensor.wrap("left")
  24. while true do
  25. local signal = false
  26. local targets = proximity.getTargets()
  27. for k, v in pairs(targets) do
  28. if distance(v.Position) < radius then
  29. for name, basicDetails in pairs(targets) do
  30. local moreDetails = prox.getTargetDetails(name)
  31. term.setTextColor(tonumber(namesCol))
  32. monitor.write("Willkommen "..name.." auf RANZTEKK.DE ")
  33. sleep(1)
  34. monitor.clear()
  35. end
  36. end
  37. end
  38. end
  39. monitor.write("RANZTEKK.DE")
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement