Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 1x 12x 12x 12x 12x 12x 12x 12x 12x 1x 13x 12x 12x 12x 12x 12x 12x 12x 12x 13x 13x 12x 12x 13x 2x 13x 10x 10x 13x 13x 12x 12x 12x 12x 12x 12x 12x 12x 12x 12x | import { exactGlyphLength } from '@/constants/restrictions'; import type { VoxelOutput } from '@/types/voxelTypes'; function splitGlyphs(glyphs: string) { const x_glyphs = glyphs.substring(9, 12); const y_glyphs = glyphs.substring(4, 6); const z_glyphs = glyphs.substring(6, 9); const system_idx = glyphs.substring(1, 4); const planet_idx = glyphs.substring(0, 1); return [x_glyphs, y_glyphs, z_glyphs, system_idx, planet_idx]; } export function glyphs2XYZ(glyphs: string): VoxelOutput { if (glyphs.length !== exactGlyphLength) return {} as VoxelOutput; const coordinates = splitGlyphs(glyphs); const numberCoords = coordinates.map((coordinate) => parseInt(coordinate, 16)); const x_glyphs = numberCoords[0]; const y_glyphs = numberCoords[1]; const z_glyphs = numberCoords[2]; // NoSonar this is stupid indexing const system_idx = numberCoords[3]; // NoSonar this is stupid indexing const planet_idx = numberCoords[4]; // NoSonar this is stupid indexing let VoxelX, VoxelY, VoxelZ; if (x_glyphs > 2047) { VoxelX = x_glyphs - 4096; } else { VoxelX = x_glyphs; } if (z_glyphs > 2047) { VoxelZ = z_glyphs - 4096; } else { VoxelZ = z_glyphs; } if (y_glyphs > 127) { VoxelY = y_glyphs - 256; } else { VoxelY = y_glyphs; } return { VoxelX, VoxelY, VoxelZ, SolarSystemIndex: system_idx, PlanetIndex: planet_idx, }; } |