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

    Class PreptimeWorld

    Implements

    Index

    Constructors

    Properties

    addEntitiesToGroup: (
        this: PreptimeWorld | RuntimeWorld,
        groupHandle: number,
        entities:
            | IterableIterator<Readonly<IEntity>, any, any>
            | readonly Readonly<IEntity>[],
    ) => void = addEntitiesToGroup

    Add several entities in this world to a group in this world

    addEntity: (this: PreptimeWorld, entity: Readonly<IEntity>) => void = addEntity

    Add an entity to this world

    addEntityToGroup: (
        this: PreptimeWorld | RuntimeWorld,
        groupHandle: number,
        entity: Readonly<IEntity>,
    ) => void = addEntityToGroup

    Add an entity in this world to a group in this world

    addResource: <T extends object>(
        this: PreptimeWorld,
        Type: T | TTypeProto<T>,
        ...args: readonly unknown[],
    ) => T | TTypeProto<T> = addResource

    Add a resource to this world and returns the resource instance

    Type declaration

      • <T extends object>(
            this: PreptimeWorld,
            Type: T | TTypeProto<T>,
            ...args: readonly unknown[],
        ): T | TTypeProto<T>
      • Type Parameters

        • T extends object

        Parameters

        • this: PreptimeWorld
        • Type: T | TTypeProto<T>
        • ...args: readonly unknown[]

          constructor parameters

        Returns T | TTypeProto<T>

    assimilateGroup: (
        this: PreptimeWorld | RuntimeWorld,
        otherWorld: Readonly<IPreptimeWorld>,
        handle: number,
    ) => number = assimilateGroup

    Move group from other world to this one. A new handle will be generated!

    buildEntity: (this: IMutableWorld, uuid?: string) => IEntityBuilder = buildEntity

    Convenience builder to create a new Entity

    clearEntities: (this: IMutableWorld & (PreptimeWorld | RuntimeWorld)) => void = clearEntities

    Clear all entities and groups from this world

    clearGroups: (this: PreptimeWorld | RuntimeWorld) => void = clearGroups

    Disband all groups. Entities will not be removed

    clearResources: (this: PreptimeWorld | RuntimeWorld) => void = clearResources

    Remove all resources from this world

    Configuration of how a runtime should work

    createEntity: (this: IMutableWorld) => IEntity = createEntity

    Create a new entity and add it to this world

    createGroup: (this: PreptimeWorld | RuntimeWorld) => number = createGroup

    Create a new group and add it to this world

    Initial data to operate on

    getEntities: (
        this: PreptimeWorld | RuntimeWorld,
        query?: Readonly<IEntitiesQuery>,
    ) => IterableIterator<IEntity> = getEntities

    Query entities and find the ones with a certain combination of component. To get a single entity by ID, please use the global function getEntity()

    getGroupEntities: (
        this: PreptimeWorld | RuntimeWorld,
        groupHandle: number,
    ) => IterableIterator<IEntity> = getGroupEntities

    Get all entities associated with a group

    getResource: <T extends object>(this: RuntimeWorld, type: TTypeProto<T>) => T = getResource

    Get a resource which was previously stored

    getResources: (
        this: PreptimeWorld | RuntimeWorld,
        types?: readonly TExistenceQueryParameter<any>[],
    ) => IterableIterator<object> = getResources

    Get all resources stored in this world. Useful for debugging

    hasEntity: (this: PreptimeWorld, entity: Readonly<IEntity>) => boolean = hasEntity

    Check whether an entity exists in this world

    hasResource: <T extends object>(
        this: PreptimeWorld | RuntimeWorld,
        obj: Readonly<T> | TTypeProto<T>,
    ) => boolean = hasResource

    Check if a resource was stored

    load: (
        this: PreptimeWorld,
        prefab: Readonly<ISerialFormat>,
        options?: Readonly<ISerDeOptions<TDeserializer>>,
        intoGroup?: number,
    ) => number = load

    Load a prefab

    merge: (
        this: IMutableWorld & (PreptimeWorld | RuntimeWorld),
        elsewhere: Readonly<IPreptimeWorld>,
        intoGroup?: number,
    ) => [number, IEntity[]] = merge

    Merge entities from another world into this one

    name?: string

    World's name

    removeEntity: (this: PreptimeWorld, entity: Readonly<IEntity>) => void = removeEntity

    Remove an entity from this world

    removeGroup: (
        this: IMutableWorld & (PreptimeWorld | RuntimeWorld),
        groupHandle: number,
    ) => void = removeGroup

    Remove a group and all entities inside from this world

    removeResource: <T extends object>(
        this: PreptimeWorld,
        type: TTypeProto<T>,
    ) => void = removeResource

    Remove a resource from this world

    save: (
        this: PreptimeWorld,
        options?: Readonly<ISerDeOptions<TSerializer>>,
    ) => ISerialFormat = save

    Prepare a savable version of the current world. The query can be used to only save a sub-set with specific conditions

    Methods