Advertisement
Craft4Cube

geo2holo

Mar 1st, 2015
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 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. hologram.clear()
  12.  
  13. local seed = math.random(0xFFFFFFFF)
  14. for x = 1, 16 * 3 do
  15. for z = 1, 16 * 3 do
  16. component.hologram.fill(x, z, 15 + noise.fbm(x/(16*3) + seed, 1, z/(16*3) + seed) * 28,1)
  17. end
  18. end
  19.  
  20. local sx, sz = 48, 48
  21. local ox, oz = -24, -24
  22.  
  23. for true do
  24. for x=ox,sx+ox do
  25. for z=oz,sz+oz do
  26. local hx, hz = 1 + x - ox, 1 + z - oz
  27. local column = component.geolyzer.scan(x, z)
  28. for y=1,32 do
  29. local hardness = column[y + 27]
  30. local color
  31. if hardness == 0 or not hardness then
  32. color = 0
  33. elseif hardness < 3 then
  34. color = 2
  35. elseif hardness < 100 then
  36. color = 1
  37. else
  38. color = 3
  39. end
  40. if component.hologram.maxDepth() > 1 then
  41. component.hologram.set(hx, y, hz, color)
  42. else
  43. component.hologram.set(hx, y, hz, math.min(color, 1))
  44. end
  45. end
  46. os.sleep(0)
  47. end
  48. end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement