astro.Function.encodeModSystemAddress - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / astro / encodeModSystemAddress

Function: encodeModSystemAddress()

encodeModSystemAddress(parts, origin): bigint

Defined in: src/astro/system-address.ts:400

Encode system-name parts and a resolved region origin into a modulated address.

Parameters

parts

SystemNameParts

The parsed system-name parts, as parseSystemName returns.

origin

NamingRegionOrigin

The region origin (internal units), from resolveNamingRegionOrigin.

Returns

bigint

The 64-bit modulated system address. These routinely exceed 2^53, so keep them as bigint (or a decimal string) rather than a JS number.

Remarks

Prefer encodeSystemAddress for the normal id64; use the modulated form only when a tool you are feeding expects that specific layout.

Throws

If the mass code is outside 0–7, a letter is outside 0–25, n1 is not one the boxel packer accepts, the origin has a negative coordinate, the name's boxel code or sector falls outside the address layout, or the sequence does not fit the 15-bit modulated field.

Example

import { resolveNamingRegionOrigin } from '@elite-dangerous-almanac/core/astro/naming-region-origins';
import { encodeModSystemAddress } from '@elite-dangerous-almanac/core/astro/system-address';
import { parseSystemName } from '@elite-dangerous-almanac/core/astro/system-name';

const parts = parseSystemName('Synuefe EN-H d11-96')!;
encodeModSystemAddress(parts, resolveNamingRegionOrigin(parts.regionName)!).toString();
⚠️ **GitHub.com Fallback** ⚠️