diff --git a/src/bin/helpers.ts b/src/bin/helpers.ts index c108189..859ac05 100644 --- a/src/bin/helpers.ts +++ b/src/bin/helpers.ts @@ -9,6 +9,7 @@ import { SUPPORTED_DATA_FORMATS, SUPPORTED_FORMATS, } from '@bin/constants.js' +import { DoubleOf } from '@common/types.js' export const getPackageVersion = async () => { try { @@ -78,7 +79,7 @@ const sliceBuffer = (buffer: string | Buffer, start?: number, end?: number) => { } } -export const evenAndRemainder = (divisor: number, n: number): [number, number] => { +export const evenAndRemainder = (divisor: number, n: number): DoubleOf => { return [Math.floor(n / divisor), n % divisor] } diff --git a/src/common/types.ts b/src/common/types.ts index 17e2e29..d75182f 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -26,6 +26,8 @@ export type ArxQuaternion = { w: number } +export type DoubleOf = [T, T] + export type TripleOf = [T, T, T] export type QuadrupleOf = [T, T, T, T] diff --git a/src/fts/helpers.ts b/src/fts/helpers.ts index c204c4c..ac7bb9d 100644 --- a/src/fts/helpers.ts +++ b/src/fts/helpers.ts @@ -1,5 +1,5 @@ import { any } from '@common/helpers.js' -import { QuadrupleOf, TripleOf } from '@common/types.js' +import { DoubleOf, QuadrupleOf, TripleOf } from '@common/types.js' import { ArxPolygon, ArxPolygonFlags } from '@fts/Polygon.js' import { ArxVertex } from '@fts/Vertex.js' import { COORDS_THAT_ROUND_UP } from '@fts/constants.js' @@ -31,7 +31,7 @@ const doCoordsNeedToBeRoundedUp = (coords: TripleOf) => { return any(([x, y, z]) => a === x && b === y && c === z, COORDS_THAT_ROUND_UP) } -export const getCellCoords = ([a, b, c]: QuadrupleOf): [number, number] => { +export const getCellCoords = ([a, b, c]: QuadrupleOf): DoubleOf => { const x = (a.x + b.x + c.x) / 3 const z = (a.z + b.z + c.z) / 3 diff --git a/src/utils.ts b/src/utils.ts index f69f5ff..d6346f9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ export { getCellCoords } from '@fts/helpers.js' -export type { TripleOf, QuadrupleOf, Optional, Expand, RecursiveExpand } from '@common/types.js' +export type { DoubleOf, TripleOf, QuadrupleOf, Optional, Expand, RecursiveExpand } from '@common/types.js' export { MAP_WIDTH_IN_CELLS, MAP_DEPTH_IN_CELLS } from '@common/constants.js'