sim-ecs - v0.6.5
    Preparing search index...

    Interface ICommands

    Commands is an async interface, which aggregates commands for later execution. The primary usage is to issue commands during system runtime and have them take effect on a common sync point, like after all systems ran

    interface ICommands {
        addEntity(entity: Readonly<IEntity>): void;
        addResource<T extends object>(
            type: T | TTypeProto<T>,
            ...args: readonly unknown[],
        ): T;
        buildEntity(): ICommandEntityBuilder;
        clearEntities(): void;
        load(
            prefab: Readonly<ISerialFormat>,
            options?: Readonly<ISerDeOptions<TDeserializer>>,
        ): number;
        merge(world: Readonly<IWorld>): number;
        mutateEntity(
            entity: Readonly<IReadOnlyEntity>,
            mutator: (entity: IEntity) => void | Promise<void>,
        ): void;
        popState(): void;
        pushState(NewState: IIStateProto): void;
        queueCommand(command: TCommand): void;
        removeEntity(entity: Readonly<IEntity>): void;
        removeGroup(handle: number): void;
        removeResource<T extends object>(type: TTypeProto<T>): void;
        replaceResource<T extends object>(
            type: T | TTypeProto<T>,
            ...args: unknown[],
        ): void;
        stopRun(): void;
    }
    Index

    Methods

    • Add a resource to this world and returns the resource instance

      Type Parameters

      • T extends object

      Parameters

      • type: T | TTypeProto<T>
      • ...args: readonly unknown[]

        constructor parameters

      Returns T

    • Replace a resource from this world

      Type Parameters

      • T extends object

      Parameters

      • type: T | TTypeProto<T>
      • ...args: unknown[]

        constructor parameters

      Returns void