Maxstripe

OpenComputersHoloProjector

Apr 24th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. local component = require("component")
  2. if not component.isAvailable("geolyzer") then
  3. io.stderr:write("This program requires a Geolyzer to run.")
  4. return
  5. end
  6. if not component.isAvailable("hologram") then
  7. io.stderr:write("This program requires a Hologram Projector to run.")
  8. return
  9. end
  10.  
  11. local sx, sz = 48, 48
  12. local ox, oz = -24, -24
  13.  
  14. component.hologram.clear()
  15. for x=ox,sx+ox do
  16. for z=oz,sz+oz do
  17. local hx, hz = 1 + x - ox, 1 + z - oz
  18. local column = component.geolyzer.scan(x, z)
  19. for y=1,32 do
  20. local hardness = column[y + 27]
  21. local color
  22. if hardness == 0 or not hardness then
  23. color = 0
  24. elseif hardness < 3 then
  25. color = 2
  26. elseif hardness < 100 then
  27. color = 1
  28. else
  29. color = 3
  30. end
  31. if component.hologram.maxDepth() > 1 then
  32. component.hologram.set(hx, y, hz, color)
  33. else
  34. component.hologram.set(hx, y, hz, math.min(color, 1))
  35. end
  36. end
  37. os.sleep(0)
  38. end
  39. end
Add Comment
Please, Sign In to add comment