Files
dusk/types/entity/component.d.ts
T
2026-06-02 09:32:07 -05:00

40 lines
986 B
TypeScript

/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
/**
* Base type for all components. `entity.add()` returns a subtype when the
* component type has a dedicated module; cast with `as Position` etc. when
* you need the specific API.
*/
interface Component {
/** Entity ID this component belongs to. */
readonly entity: number;
/** Component slot index. */
readonly id: number;
toString(): string;
}
interface ComponentConstructor {
/** Sentinel for an invalid component ID. */
readonly INVALID: number;
readonly POSITION: number;
readonly CAMERA: number;
readonly RENDERABLE: number;
readonly PHYSICS: number;
readonly TRIGGER: number;
readonly OVERWORLD: number;
readonly PLAYER: number;
readonly INTERACTABLE: number;
readonly OVERWORLD_CAMERA: number;
readonly OVERWORLD_TRIGGER: number;
new(): never;
}
declare var Component: ComponentConstructor;