Something went wrong. Try again.
Starship Simulator Controls thoriumsim.com
Something went wrong. Try again.
1.3 kB · 32 lines
TypeScript
at develop
123456789101112131415161718192021222324252627282930313233import { stationComplementSchema } from "@thorium/ecs-components/stationComplementSchema";import { generateIncrementedName } from "@thorium/utils/generateIncrementedName";import type { z } from "zod";
import type BasePlugin from ".";import { Aspect } from "./Aspect";
export default class StationComplementPlugin extends Aspect { static schema = stationComplementSchema; apiVersion = "stations/v1" as const; kind = "stationComplements" as const; name!: string; hasShipMap!: boolean; stations!: z.infer<typeof stationComplementSchema>["stations"]; flightMode!: "nova" | "legacy"; get stationCount() { return this.stations.length; } assets!: Record<string, string>; constructor(params: Partial<StationComplementPlugin>, plugin: BasePlugin) { const name = generateIncrementedName( params.name || "New Station Complement", plugin.aspects.stationComplements.map((station) => station.name), ); super({ ...params, name }, { kind: "stationComplements" }, plugin); if (!this.name) this.name = name; this.stations = this.stations || params.stations || []; this.hasShipMap = this.hasShipMap || params.hasShipMap || false; this.assets = this.assets || params.assets || {}; this.flightMode = this.flightMode || params.flightMode || "nova"; }}