45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import dedent from 'dedent'
|
|
import { z } from 'zod'
|
|
import { BaseNode, nodeType, objectId } from '../base'
|
|
import { CeilingNode } from './ceiling'
|
|
import { FenceNode } from './fence'
|
|
import { GuideNode } from './guide'
|
|
import { RoofNode } from './roof'
|
|
import { ScanNode } from './scan'
|
|
import { SlabNode } from './slab'
|
|
import { SpawnNode } from './spawn'
|
|
import { StairNode } from './stair'
|
|
import { WallNode } from './wall'
|
|
import { ZoneNode } from './zone'
|
|
|
|
export const LevelNode = BaseNode.extend({
|
|
id: objectId('level'),
|
|
type: nodeType('level'),
|
|
children: z
|
|
.array(
|
|
z.union([
|
|
WallNode.shape.id,
|
|
FenceNode.shape.id,
|
|
ZoneNode.shape.id,
|
|
SlabNode.shape.id,
|
|
CeilingNode.shape.id,
|
|
RoofNode.shape.id,
|
|
StairNode.shape.id,
|
|
ScanNode.shape.id,
|
|
GuideNode.shape.id,
|
|
SpawnNode.shape.id,
|
|
]),
|
|
)
|
|
.default([]),
|
|
// Specific props
|
|
level: z.number().default(0),
|
|
}).describe(
|
|
dedent`
|
|
Level node - used to represent a level in the building
|
|
- children: array of floor, wall, ceiling, roof, item nodes
|
|
- level: level number
|
|
`,
|
|
)
|
|
|
|
export type LevelNode = z.infer<typeof LevelNode>
|