waytale - v0.5.1
    Preparing search index...

    Class WaytaleMap

    A visually represented map to hold gadgets and for avatars to walk around in. Belongs to a space, gets built from a config. Has collision information for each tile.

    document map config, link to docs

    mixinPropertyObserver

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    avatars: Map<number, WaytaleAvatar> = ...
    awareness: any
    config: MapConfig

    configuration details from which this map was built

    gadgets: WaytaleGadget[] = []

    list of gadgets in this space

    getGadgetsAt: (x: number, y: number) => WaytaleGadget[]
    peerInfos: { [k: number]: WaytalePeerInfo } = {}
    sharedGadgets: YMap<object>
    url: string

    URL of the map (deprecated)

    userIdentities: {} = {}
    userProfiles: Map<number, WaytaleUserProfile> = ...

    Methods

    • Check whether the tile at given location is walkable, i.e. no collision is defined for it.

      Parameters

      Returns boolean

    • Unsubscribe from an event by name with a specific handler.

      Parameters

      • eventName: any

        event to unsubscribe from

      • handler: any

        callback handling the event

      Returns void

    • Subscribe to an event by name with a specific handler.

      Parameters

      • eventName: any

        event to subscribe to

      • handler: any

        callback handling the event

      Returns void

    • Subscribe to an event, but run the handler only once. After running exactly once the handler will be immediately unsubscribed.

      Parameters

      • eventName: any

        event to subscribe to

      • handler: any

        callback handling the event

      Returns void

    • Parameters

      • clientId: number

      Returns Promise<void>

    • Trigger the calls of the event handlers subscribed to the given event.

      Parameters

      • eventName: any

        event to trigger

      • ...args: any[]

        arguments to forward to the event handlers

      Returns void

    • Change the value of a property and trigger an event of the same name. A second event is triggered where the event name is the name of the property suffixed by the name of the operation.

      The event handlers will be called with the parameters of (in this order) the new value, the old value, and a reference to this.

      The method parameter specifies how the value is updated depending on whether the property is a normal value, an array, or an object. The respective value in parentheses is used as the suffix for the second trigger call.

      • assign for normal assignment (Assign)
      • prepend, append, and remove for arrays (Add, Add, Remove)
      • insert, replace, and delete for objects and maps (Insert, Replace, Delete)

      For operations on objects, the extra parameter is used as "key" i.e. property name.

      Parameters

      • key: any

        the name of the property

      • value: any

        the new value

      • method: string = 'assign'

        how to update, see description

      • extra: any = undefined

        key to use for object operations

      Returns void