Advertisement
Ewgeniy

Geeo

Feb 6th, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local sqrt = math.sqrt
  2. local component = require('component')
  3. local geolyzer = component.geolyzer
  4. local hologram = component.hologram
  5.  
  6. local function distance(x, y, z)
  7.   return sqrt(x^2 + y^2 + z^2)
  8. end
  9.  
  10. local function magic(R, H, D)
  11.   return 2112 * (R - H) / D % 1
  12. end
  13.  
  14. local function visualize(hardness, elevation, size)
  15.   hologram.clear()
  16.   hologram.setScale(9)
  17.   local blocks, result
  18.   for x = -size, size do
  19.     for z = -size, size do
  20.       blocks = geolyzer.scan(x, z, elevation, 1, 1, 32)
  21.       for i_y = 1, 32 do
  22.         result = magic(blocks[i_y], hardness, distance(x, i_y+elevation-1, z))
  23.         if blocks[i_y] ~= 0 and (result > 0.9998 or result < 0.00005) then
  24.           hologram.set(x+24, i_y, z+24, true)
  25.         end
  26.       end
  27.     end
  28.   end
  29. end
  30.  
  31. local hrd, ele, siz = table.unpack({...})
  32. hrd = hrd or 3
  33. ele = ele or -32
  34. siz = siz or 16
  35. visualize(hrd, ele, siz)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement