Something went wrong. Try again.
Starship Simulator Controls thoriumsim.com
Something went wrong. Try again.
1.2 kB · 52 lines
TypeScript
at develop
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253import { edgeFlagsSchema } from "@thorium/utils/flags/DeckEdge";import { nodeFlagsSchema } from "@thorium/utils/flags/DeckNode";import z from "zod";
const roundTo1000 = (num: number) => Math.round(num * 1000) / 1000;
export const shipMap = z .object({ decks: z .array( z.object({ backgroundUrl: z.string().optional(), name: z.string().default("Deck"), }), ) .default([]), deckNodes: z .array( z.object({ id: z.number(), deckIndex: z.number(), x: z.number().transform((val) => roundTo1000(val)), y: z.number().transform((val) => roundTo1000(val)), name: z.string().optional(), icon: z.string().optional(), isRoom: z.boolean().optional(), radius: z.number().optional(), contents: z.record( z.object({ count: z.number(), }), ), flags: nodeFlagsSchema.array(), volume: z.number(), systems: z.string().array(), }), ) .default([]), deckEdges: z .array( z.object({ id: z.number(), from: z.number(), to: z.number(), weight: z.number().optional(), isOpen: z.boolean().optional(), flags: edgeFlagsSchema.array().optional(), }), ) .default([]), }) .default({});