Options
All
  • Public
  • Public/Protected
  • All
Menu

A Wall is an implementation of PlaceableObject which represents a physical or visual barrier within the Scene. Walls are used to restrict Token movement or visibility as well as to define the areas of effect for ambient lights and sounds.

see

WallDocument

see

WallsLayer

Hierarchy

Index

Constructors

  • new Wall(document: any): Wall

Properties

roof: Tile

A reference to an overhead Tile that is a roof, interior to which this wall is contained

highlight: any

A Graphics object used to highlight this wall segment. Only used when the wall is controlled.

intersectsWith: Map<Wall, LineIntersection> = ...

A set which tracks other Wall instances that this Wall intersects with (excluding shared endpoints)

line: any
directionIcon: any
endpoints: any
alpha: number
zIndex: number
scene: Scene

Retain a reference to the Scene within which this Placeable Object resides

document: Document

A reference to the Scene embedded Document instance which this object represents

vision: { fov: Circle; los: PointSourcePolygon }

Track the field of vision for the placeable object. This is necessary to determine whether a player has line-of-sight towards a placeable object or vice-versa

Type declaration

controlIcon: ControlIcon

A control icon for interacting with the object

mouseInteractionManager: MouseInteractionManager

A mouse interaction manager instance which handles mouse workflows related to this object.

cullable: boolean
visible: any
renderable: any
_preview: any
doorControl: DoorControl

A reference the Door Control icon associated with this Wall, if any

_dragPassthrough: boolean = false

Passthrough certain drag operations on locked objects.

_isHoverIn: boolean = false

Know if a placeable is in the hover-in state.

#priorDoorState: number

Cache the prior door state so that we can identify changes in the door state.

#lastQuadtreeBounds: Rectangle

The bounds that the placeable was added to the quadtree with.

#drawing: Promise<PlaceableObject> = ...

An internal reference to a Promise in-progress to draw the Placeable Object.

#drawn: boolean = false

Has this Placeable Object been drawn and is there no drawing in progress?

#controlled: boolean = false
#hover: boolean = false
embeddedName: string = "Wall"

Identify the official Document name for this PlaceableObject class

RENDER_FLAGS: { redraw: { propagate: string[] }; refresh: { propagate: string[]; alias: boolean }; refreshState: { propagate: string[] }; refreshLine: { propagate: string[] }; refreshEndpoints: {}; refreshDirection: {}; refreshHighlight: {} } = ...
override

Type declaration

  • redraw: { propagate: string[] }
    • propagate: string[]
  • refresh: { propagate: string[]; alias: boolean }
    • propagate: string[]
    • alias: boolean
  • refreshState: { propagate: string[] }
    • propagate: string[]
  • refreshLine: { propagate: string[] }
    • propagate: string[]
  • refreshEndpoints: {}
    • refreshDirection: {}
      • refreshHighlight: {}

        Accessors

        • get coords(): number[]
        • A convenience reference to the coordinates Array for the Wall endpoints, [x0,y0,x1,y1].

          Returns number[]

        • get vertices(): { a: PolygonVertex; b: PolygonVertex }
        • The endpoints of the wall expressed as {@link PolygonVertex} instances.

          Returns { a: PolygonVertex; b: PolygonVertex }

          • a: PolygonVertex
          • b: PolygonVertex
        • get A(): PolygonVertex
        • The initial endpoint of the Wall.

          Returns PolygonVertex

        • get B(): PolygonVertex
        • The second endpoint of the Wall.

          Returns PolygonVertex

        • get wallKeys(): Set<number>
        • A set of vertex sort keys which identify this Wall's endpoints.

          Returns Set<number>

        • inheritdoc

          Returns Rectangle

        • get isDoor(): boolean
        • A boolean for whether this wall contains a door

          Returns boolean

        • get isOpen(): boolean
        • A boolean for whether the wall contains an open door

          Returns boolean

        • get hasActiveRoof(): boolean
        • Is this Wall interior to a non-occluded roof Tile?

          Returns boolean

        • get midpoint(): number[]
        • Return the coordinates [x,y] at the midpoint of the wall segment

          Returns number[]

        • get center(): any
        • inheritdoc

          Returns any

        • get direction(): number
        • Get the direction of effect for a directional Wall

          Returns number

        • get interactionState(): { NONE: number; HOVER: number; CLICKED: number; DRAG: number; DROP: number }
        • The mouse interaction state of this placeable.

          Returns { NONE: number; HOVER: number; CLICKED: number; DRAG: number; DROP: number }

          • NONE: number
          • HOVER: number
          • CLICKED: number
          • DRAG: number
          • DROP: number
        • get id(): string
        • The id of the corresponding Document which this PlaceableObject represents.

          Returns string

        • get objectId(): string
        • A unique identifier which is used to uniquely identify elements on the canvas related to this object.

          Returns string

        • get sourceId(): string
        • The named identified for the source object associated with this PlaceableObject. This differs from the objectId because the sourceId is the same for preview objects as for the original.

          Returns string

        • get isPreview(): boolean
        • Is this placeable object a temporary preview?

          Returns boolean

        • get hasPreview(): boolean
        • Does there exist a temporary preview of this placeable object?

          Returns boolean

        • The field-of-vision polygon for the object, if it has been computed

          Returns Circle

        • Provide a reference to the CanvasLayer which contains this PlaceableObject.

          Returns PlaceablesLayer

        • The line-of-sight polygon for the object, if it has been computed

          Returns PointSourcePolygon

        • A Form Application which is used to configure the properties of this Placeable Object or the Document it represents.

          Returns FormApplication

        • get controlled(): boolean
        • An indicator for whether the object is currently controlled

          Returns boolean

        • get hover(): boolean
        • set hover(state: boolean): void
        • An indicator for whether the object is currently a hover target

          Returns boolean

        • An indicator for whether the object is currently a hover target

          Parameters

          • state: boolean

          Returns void

        Methods

        • This helper converts the wall segment to a Ray

          Returns Ray

          The wall in Ray representation

        • _draw(): Promise<void>
        • Draw a control icon that is used to manipulate the door's open/closed state

          Returns DoorControl

        • clearDoorControl(): void
        • Clear the door control if it exists.

          Returns void

        • orientPoint(point: Point): number
        • Determine the orientation of this wall with respect to a reference point

          Parameters

          • point: Point

            Some reference point, relative to which orientation is determined

          Returns number

          An orientation in CONST.WALL_DIRECTIONS which indicates whether the Point is left, right, or collinear (both) with the Wall

        • applyThreshold(sourceType: string, sourceOrigin: Point, externalRadius?: number): boolean
        • Test whether to apply a configured threshold of this wall. When the proximity threshold is met, this wall is excluded as an edge in perception calculations.

          Parameters

          • sourceType: string

            Sense type for the source

          • sourceOrigin: Point

            The origin or position of the source on the canvas

          • externalRadius: number = 0

          Returns boolean

          True if the wall has a threshold greater than 0 for the source type, and the source type is within that distance.

        • control(__namedParameters?: { chain: boolean }): boolean
        • Assume control over a PlaceableObject, flagging it as controlled and enabling downstream behaviors

          Parameters

          • __namedParameters: { chain: boolean } = {}

            Additional options which modify the control request

            • chain: boolean

          Returns boolean

          A flag denoting whether control was successful

        • _destroy(options: any): void
        • isDirectionBetweenAngles(lower: number, upper: number): boolean
        • Test whether the Wall direction lies between two provided angles This test is used for collision and vision checks against one-directional walls

          Parameters

          • lower: number

            The lower-bound limiting angle in radians

          • upper: number

            The upper-bound limiting angle in radians

          Returns boolean

        • canRayIntersect(ray: Ray): boolean
        • A simple test for whether a Ray can intersect a directional wall

          Parameters

          • ray: Ray

            The ray to test

          Returns boolean

          Can an intersection occur?

        • getLinkedSegments(): any
        • Get an Array of Wall objects which are linked by a common coordinate

          Returns any

          An object reporting ids and endpoints of the linked segments

        • identifyInteriorState(): void
        • Determine whether this wall is beneath a roof tile, and is considered "interior", or not. Tiles which are hidden do not count as roofs for the purposes of defining interior walls.

          Returns void

        • updateIntersections(): void
        • Update any intersections with this wall.

          Returns void

        • _identifyIntersectionsWith(other: Wall): void
        • Record the intersection points between this wall and another, if any.

          Parameters

          • other: Wall

            The other wall.

          Returns void

        • _applyRenderFlags(flags: any): void
        • _onCreate(data: any, options: any, userId: any): void
        • Register pending canvas operations which should occur after a new PlaceableObject of this type is created

          Parameters

          • data: any
          • options: any
          • userId: any

          Returns void

        • _onUpdate(data: any, options: any, userId: any): void
        • _onDelete(options: any, userId: any): void
        • Define additional steps taken when an existing placeable object of this type is deleted

          Parameters

          • options: any
          • userId: any

          Returns void

        • activateListeners(): void
        • _canControl(user: any, event: any): boolean
        • Does the User have permission to control the Placeable Object?

          Parameters

          • user: any

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _onHoverIn(event: any, options: any): boolean
        • Actions that should be taken for this Placeable Object when a mouseover event occurs. Hover events on PlaceableObject instances allow event propagation by default.

          Parameters

          • event: any

            The triggering canvas interaction event

          • options: any

            Options which customize event handling

          Returns boolean

          True if the event was handled, otherwise false

        • _onHoverOut(event: any): boolean
        • Actions that should be taken for this Placeable Object when a mouseout event occurs

          Parameters

          • event: any

            The triggering canvas interaction event

          Returns boolean

          True if the event was handled, otherwise false

        • _onClickLeft(event: any): boolean | Promise<void>
        • Callback actions which occur on a single left-click event to assume control of the object

          Parameters

          • event: any

            The triggering canvas interaction event

          Returns boolean | Promise<void>

        • _onClickLeft2(event: any): void
        • _onClickRight2(event: any): void
        • _onDragLeftStart(event: any): any
        • Callback actions which occur when a mouse-drag action is first begun.

          Parameters

          • event: any

            The triggering canvas interaction event

          Returns any

        • _onDragLeftMove(event: any): void
        • _onDragLeftDrop(event: any): Promise<any>
        • applyRenderFlags(): void
        • destroy(options: any): any
        • Refresh all incremental render flags for the PlaceableObject. This method is no longer used by the core software but provided for backwards compatibility.

          Parameters

          • options: any = {}

          Returns PlaceableObject

          The refreshed object

        • _updateQuadtree(): void
        • release(options?: any): boolean
        • Release control over a PlaceableObject, removing it from the controlled set

          Parameters

          • options: any = {}

            Options which modify the releasing workflow

          Returns boolean

          A Boolean flag confirming the object was released.

        • Clone the placeable object, returning a new object with identical attributes. The returned object is non-interactive, and has no assigned ID. If you plan to use it permanently you should call the create method.

          Returns PlaceableObject

          A new object with identical data

        • Rotate the PlaceableObject to a certain angle of facing

          Parameters

          • angle: number

            The desired angle of rotation

          • snap: number

            Snap the angle of rotation to a certain target degree increment

          Returns Promise<PlaceableObject>

          The rotated object

        • _updateRotation(options?: { angle: number; delta: number; snap: number }): number
        • Determine a new angle of rotation for a PlaceableObject either from an explicit angle or from a delta offset.

          Parameters

          • options: { angle: number; delta: number; snap: number } = {}

            An object which defines the rotation update parameters

            • angle: number
            • delta: number
            • snap: number

          Returns number

          The new rotation angle for the object

        • _getShiftedPosition(dx: number, dy: number): { x: number; y: number }
        • Obtain a shifted position for the Placeable Object

          Parameters

          • dx: number

            The number of grid units to shift along the X-axis

          • dy: number

            The number of grid units to shift along the Y-axis

          Returns { x: number; y: number }

          The shifted target coordinates

          • x: number
          • y: number
        • can(user: User, action: string): boolean
        • Test whether a user can perform a certain interaction regarding a Placeable Object

          Parameters

          • user: User

            The User performing the action

          • action: string

            The named action being attempted

          Returns boolean

          Does the User have rights to perform the action?

        • _getWallColor(): number
        • Given the properties of the wall - decide upon a color to render the wall for display on the WallsLayer

          Returns number

        • _playDoorSound(interaction: string): void
        • Play a door interaction sound. This plays locally, each client independently applies this workflow.

          internal

          Parameters

          • interaction: string

            The door interaction: "open", "close", "lock", "unlock", or "test".

          Returns void

        • _onMouseOverLine(event: FederatedEvent): boolean
        • Handle mouse-hover events on the line segment itself, pulling the Wall to the front of the container stack

          Parameters

          • event: FederatedEvent

          Returns boolean

        • _getTargetAlpha(): number
        • Get the target opacity that should be used for a Placeable Object depending on its preview state.

          Returns number

        • _onControl(options: any): void
        • Additional events which trigger once control of the object is established

          Parameters

          • options: any

            Optional parameters which apply for specific implementations

          Returns void

        • _onRelease(options: any): void
        • Additional events which trigger once control of the object is released

          Parameters

          • options: any

            Options which modify the releasing workflow

          Returns void

        • _canHUD(user: User, event: any): boolean
        • Can the User access the HUD for this Placeable Object?

          Parameters

          • user: User

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _canConfigure(user: User, event: any): boolean
        • Does the User have permission to configure the Placeable Object?

          Parameters

          • user: User

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _canView(user: User, event: any): boolean
        • Does the User have permission to view details of the Placeable Object?

          Parameters

          • user: User

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _canCreate(user: User, event: any): boolean
        • Does the User have permission to create the underlying Document?

          Parameters

          • user: User

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _canDrag(user: User, event: any): boolean
        • Does the User have permission to drag this Placeable Object?

          Parameters

          • user: User

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _canHover(user: User, event: any): boolean
        • Does the User have permission to hover on this Placeable Object?

          Parameters

          • user: User

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _canUpdate(user: User, event: any): boolean
        • Does the User have permission to update the underlying Document?

          Parameters

          • user: User

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _canDelete(user: User, event: any): boolean
        • Does the User have permission to delete the underlying Document?

          Parameters

          • user: User

            The User performing the action.

          • event: any

            The event object.

          Returns boolean

          The returned status.

        • _propagateLeftClick(event: FederatedEvent): boolean
        • _propagateRightClick(event: FederatedEvent): boolean
        • _onClickRight(event: FederatedEvent): void
        • Callback actions which occur on a single right-click event to configure properties of the object

          see

          MouseInteractionManager##handleClickRight

          Parameters

          • event: FederatedEvent

            The triggering canvas interaction event

          Returns void

        • _onDragStart(): void
        • Begin a drag operation from the perspective of the preview clone. Modify the appearance of both the clone (this) and the original (_original) object.

          Returns void

        • _onDragEnd(): void
        • Conclude a drag operation from the perspective of the preview clone. Modify the appearance of both the clone (this) and the original (_original) object.

          Returns void

        • _onDragLeftCancel(event: FederatedEvent): any
        • Callback actions which occur on a mouse-move operation.

          see

          MouseInteractionManager##handleDragCancel

          Parameters

          • event: FederatedEvent

            The triggering mouse click event

          Returns any

        • _onLongPress(event: FederatedEvent, origin: Point): any
        • Callback action which occurs on a long press.

          see

          MouseInteractionManager##handleLongPress

          Parameters

          • event: FederatedEvent

            The triggering canvas interaction event

          • origin: Point

            The local canvas coordinates of the mousepress.

          Returns any

        • #initializeVertices(): void
        • Create PolygonVertex instances for the Wall endpoints and register the set of vertex keys.

          Returns void

        • #drawDirection(): any
        • Draw a directional prompt icon for one-way walls to illustrate their direction of effect.

          Returns any

          The drawn icon

        • #getHitPolygon(pad: number): Polygon
        • Compute an approximate Polygon which encloses the line segment providing a specific hitArea for the line

          Parameters

          • pad: number

            The amount of padding to apply

          Returns Polygon

          A constructed Polygon for the line

        • #removeIntersections(): void
        • Remove this wall's intersections.

          Returns void

        • #refreshLine(): void
        • Refresh the displayed position of the wall which refreshes when the wall coordinates or type changes.

          Returns void

        • #refreshEndpoints(): void
        • Refresh the display of wall endpoints which refreshes when the wall position or state changes.

          Returns void

        • #refreshDirection(): any
        • Draw a directional prompt icon for one-way walls to illustrate their direction of effect.

          Returns any

          The drawn icon

        • #refreshHighlight(): void
        • Refresh the appearance of the wall control highlight graphic. Occurs when wall control or position changes.

          Returns void

        • #refreshState(): void
        • Refresh the displayed state of the Wall.

          Returns void

        • #onModifyWall(doorChange?: boolean): void
        • Callback actions when a wall that contains a door is moved or its state is changed

          Parameters

          • doorChange: boolean = false

            Update vision and sound restrictions

          Returns void

        • #getLineWidth(): number
        • Adapt the width that the wall should be rendered based on the grid size.

          Returns number