UNPKG

arx-convert

Version:

Converts various Arx Fatalis formats to JSON or YAML and back

41 lines (40 loc) 2.02 kB
import type { Simplify } from 'type-fest'; import { type ArxAnchor } from './Anchor.js'; import { type ArxCell } from './Cell.js'; import { type ArxFtsHeader } from './FtsHeader.js'; import { type ArxPolygon } from './Polygon.js'; import { type ArxPortal } from './Portal.js'; import { type ArxRoom } from './Room.js'; import { type ArxRoomDistance } from './RoomDistance.js'; import { type ArxSceneHeader } from './SceneHeader.js'; import { type ArxTextureContainer } from './TextureContainer.js'; import { type ArxUniqueHeader } from './UniqueHeader.js'; export type ArxFTS = { $schema?: string; header: Simplify<Omit<ArxFtsHeader, 'numberOfUniqueHeaders'> & Omit<ArxSceneHeader, 'numberOfTextures' | 'numberOfAnchors' | 'numberOfPortals' | 'numberOfRooms'>>; uniqueHeaders?: ArxUniqueHeader[]; textureContainers: ArxTextureContainer[]; cells: Array<Simplify<Omit<ArxCell, 'polygons'>>>; polygons: ArxPolygon[]; anchors: ArxAnchor[]; portals: ArxPortal[]; rooms: ArxRoom[]; roomDistances: ArxRoomDistance[]; }; export declare class FTS { static load(decompressedFile: ArrayBufferLike): ArxFTS; /** * @param {boolean} isCompressed when set to `true` (which is the default value) then the FTS will * need to get partially compressed with {@link https://github.com/arx-tools/node-pkware | node-pkware}. * `arx-libertatis-1.3-dev-2022-12-31` and later {@link https://arx-libertatis.org/files/snapshots/ | Arx Libertatis 1.3 snapshots } * all support uncompressed FTS files, when targeting those versions isCompressed can be set to `false`. */ static save(json: ArxFTS, isCompressed?: boolean): ArrayBuffer; /** * Mutates the `.polygon` property by removing all polygons that are out of bounds * and returns the list of removed polygons. * * A polygon is considered out of bounds when any of its vertices are not 0 <= x < 16000 or 0 <= z < 16000 */ static removeOutOfBoundsPolygons(json: ArxFTS): ArxPolygon[]; }