Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Class BaseEffectSource<TSourceData, TSourceShape>Abstract

    TODO - Re-document after ESM refactor. An abstract base class which defines a framework for effect sources which originate radially from a specific point. This abstraction is used by the LightSource, VisionSource, SoundSource, and MovementSource subclasses.

    const source = new PointSource({object}); // Create the point source
    source.initialize(data); // Configure the point source with new data
    source.refresh(); // Refresh the point source
    source.destroy(); // Destroy the point source

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    data: TSourceData = ...

    The data of this source.

    object: object | null

    Some other object which is responsible for this source.

    The geometric shape of the effect source which is generated later.

    sourceId: string

    The source id linked to this effect source.

    suppression: Record<string, boolean> = {}

    Records of suppression strings with a boolean value. If any of this record is true, the source is suppressed.

    _flags: Record<string, number | boolean> = {}

    A collection of boolean flags which control rendering and refresh behavior for the source.

    defaultData: BaseEffectSourceData = ...

    Effect source default data.

    effectsCollection: string

    The target collection into the effects canvas group.

    sourceType: string

    The type of source represented by this data structure. Each subclass must implement this attribute.

    Accessors

    • get active(): boolean

      Is this source currently active? A source is active if it is attached to an effect collection and is not disabled or suppressed.

      Returns boolean

    • get attached(): boolean

      Is this source attached to an effect collection?

      Returns boolean

    • get elevation(): number

      The elevation bound to this source.

      Returns number

    • get suppressed(): boolean

      Is this source temporarily suppressed?

      Returns boolean

    • get updateId(): number

      Returns the update ID associated with this source. The update ID is increased whenever the shape of the source changes.

      Returns number

    • get x(): number

      The x-coordinate of the point source origin.

      Returns number

    • get y(): number

      The y-coordinate of the point source origin.

      Returns number

    Methods

    • Add this BaseEffectSource instance to the active collection.

      Returns void

    • Steps that must be performed when the source is destroyed.

      Returns void

    • Initialize and configure the source using provided data.

      Parameters

      • data: Partial<TSourceData> = {}

        Provided data for configuration

      • options: { reset?: boolean } = {}

        Additional options which modify source initialization

        • Optionalreset?: boolean

          Should source data be reset to default values before applying changes?

      Returns BaseEffectSource<BaseEffectSourceData, Polygon>

      The initialized source

    • Refresh the state and uniforms of the source. Only active sources are refreshed.

      Returns void

    • Remove this BaseEffectSource instance from the active collection.

      Returns void

    • Test whether the point is contained within the shape of the source.

      Parameters

      Returns boolean

      Is inside the source?

    • Protected

      Subclass specific configuration steps. Occurs after data initialization and shape computation. Only called if the source is attached and not disabled.

      Parameters

      • changes: Partial<TSourceData>

        Changes to the source data which were applied

      Returns void

    • Protected

      Create the polygon shape (or shapes) for this source using configured data.

      Returns void

    • Protected

      Subclass specific destruction steps.

      Returns void

    • Protected

      Subclass specific data initialization steps.

      Parameters

      • data: Partial<TSourceData>

        Provided data for configuration

      Returns void

    • Protected

      Subclass-specific refresh steps.

      Returns void