The diob object.

interface Diob {
    allowDensityCross: boolean;
    alpha: number;
    anchor: { x: number; y: number };
    angle: number;
    animator: object;
    atlasName: string;
    baseType: string;
    clientSyncData: any;
    color: string | number[] | { tint: number };
    composite:
        | "source-over"
        | "source-atop"
        | "source-in"
        | "source-out"
        | "destination-over"
        | "destination-atop"
        | "destination-in"
        | "destination-out"
        | "lighter"
        | "copy"
        | "xor"
        | "multiply"
        | "screen"
        | "overlay"
        | "darken"
        | "lighten"
        | "color-dodge"
        | "color-burn"
        | "hard-light"
        | "soft-light"
        | "difference"
        | "exclusion"
        | "hue"
        | "saturation"
        | "color"
        | "luminosity";
    density: number
    | boolean;
    floatingPlatform?: boolean;
    height: number;
    iconName: string;
    iconState: string;
    id: string | number;
    invisibility: number;
    isCullable: boolean;
    isDiob: boolean;
    isOverlay: null | boolean | Diob;
    layer: number;
    loc: null | Tile;
    map: null | Map;
    mapName: string;
    mouseOpacity: 0 | 1 | 2 | MouseOpacity;
    name: string;
    parentType: string;
    plane: number;
    preventClientUpdates: boolean | { client?: Client[]; type?: string[] };
    preventInterest?: boolean;
    preventInterpolation: boolean;
    preventScreenRelayer: boolean;
    region: null | Region;
    relayerHeight: number;
    scale: { x: number; y: number };
    snapToFloor?: boolean;
    sprite: any;
    tag: string;
    text: string;
    textSprite: any;
    textStyle: object;
    tint: number;
    transform: number[] | TransformMatrixObject;
    type: string;
    visibility: number;
    width: number;
    xCoord: number;
    xCoordOffset: number;
    xIconOffset: number;
    xOrigin: number;
    xPos: number;
    yCoord: number;
    yCoordOffset: number;
    yOrigin: number;
    yPos: number;
    addFilter(pName: string | number, pType: string, pArgs: unknown): void;
    addInvisibilityViewer(pDiob: Diob): void;
    addOverlay(
        pOver: string | Diob | Object,
        pAppearance?: AppearMask,
        pSkipEvent?: boolean,
    ): void;
    checkScreenShown(): void;
    getAnimation(): AnimationInfo;
    getAnimation(pVal: "onFrame" | "frameCount"): number;
    getAnimation(pVal: "atlasName" | "iconName" | "iconState"): string;
    getAnimation(pVal: string): string | number | AnimationInfo;
    getContents(pType?: string, pChild?: boolean): Diob[];
    getCoordOffsets(): Point2D;
    getCoords(): Point2D;
    getCrossed(pType?: string, pChild?: boolean): Diob[];
    getFilters(): string[];
    getIcon(): { atlas: string; icon: string };
    getIconOffsets(): Point2D;
    getInvisibilityViewers(): Diob[];
    getLocs(): Diob[];
    getMask(): Diob;
    getOrigin(): Point2D;
    getOverlays(pType?: string, pChild?: boolean): Diob[];
    getOverScreen(
        pType?: "url" | "pixels" | "canvas" | "sprite",
    ): undefined | ScreenCaptureData;
    getOverScreenMod(): undefined | OverScreenMod;
    getPos(): { x: number; y: number };
    getScreenPos(pO?: Partial<Point2D>): Point2D;
    getSize(): Size2D;
    getSpriteData(pType?: "url" | "pixels" | "canvas"): any;
    getTransform(pAsObj?: boolean): number[] | TransformMatrixObject;
    onAddOverlay(pD: Diob): void;
    onBumped(pMovable: Diob & Movable): void;
    onClientSync(pClient: Client): void;
    onClientSyncData(pOld: unknown): void;
    onCross(pMovable: Diob & Movable, pInit?: boolean): boolean | void;
    onCrossed(pD: Diob, pInit?: number | boolean): void;
    onCrossedRelocated(pD: Diob, pInit?: boolean): void;
    onCrossMove(pDiob: Diob): void;
    onEntered(pDiob: Diob): void;
    onExited(pDiob: Diob): void;
    onIconUpdate(): void;
    onMapChange(pMap: string, pBefore?: boolean): void;
    onMouseClick(
        pClient: Client,
        pX: number,
        pY: number,
        pButton: MouseButton,
    ): void;
    onMouseDblClick(
        pClient: Client,
        pX: number,
        pY: number,
        pButton: MouseButton,
    ): void;
    onMouseDown(
        pClient: Client,
        pX: number,
        pY: number,
        pButton: MouseButton,
    ): void;
    onMouseEnter(pClient: Client, pX: number, pY: number): void;
    onMouseExit(pClient: Client, pX: number, pY: number): void;
    onMouseMove(pClient: Client, pX: number, pY: number): void;
    onMouseUp(
        pClient: Client,
        pX: number,
        pY: number,
        pButton: MouseButton,
    ): void;
    onMouseWheelScrollDown(pClient: Client, pX: number, pY: number): void;
    onMouseWheelScrollUp(pClient: Client, pX: number, pY: number): void;
    onNew(): void;
    onOverlayed(pParent: Diob): void;
    onPacket(pClient: Client, pName: string | number, pData: unknown): void;
    onRemoveOverlay(pD: Diob): void;
    onScreenHide(pClient: Client): void;
    onScreenShow(pClient: Client): void;
    onTouchEnd(
        pClient: Client,
        pX: number,
        pY: number,
        pCancel?: boolean,
        pEvent?: TouchEvent,
    ): void;
    onTouchMove(
        pClient: Client,
        pX: number,
        pY: number,
        pEvent?: TouchEvent,
    ): void;
    onTouchStart(
        pClient: Client,
        pX: number,
        pY: number,
        pEvent?: TouchEvent,
    ): void;
    onTransition(pVar?: string, pChange?: number, pStart?: object): void;
    onUncrossed(pDiob: Diob): void;
    onUnoverlayed(pParent: Diob): void;
    overScreenDraw(pArgs: DrawCommandArgs | DrawCommandArgs[]): void;
    removeFilter(pName: string | number): void;
    removeMask(): void;
    removeOverlay(pOver: string | Diob | Object, pSave?: boolean): void;
    sendPacket(pName: string | number, pData: unknown, pClient?: Client): void;
    setAnchor(pX: number, pY?: number): void;
    setAppearance(pDiob: Diob): void;
    setCoordOffsets(pX: number, pY: number): void;
    setFrame(pFrame: number, pDelay?: number, pCont?: boolean): void;
    setIcon(pAtlas: string, pIcon: string): void;
    setIconOffsets(pX: number, pY: number): void;
    setIconState(pState: string, pFrame?: number): void;
    setLoc(): Diob;
    setMask(pMask: Diob): void;
    setOrigin(pX: number, pY: number): void;
    setOverlays(pOver: Diob[], pSave?: boolean): void;
    setOverScreen(
        pX: number,
        pY: number,
        pWidth: number,
        pHeight: number,
        pData?: unknown,
        pSet?: object,
    ): void;
    setOverScreenMod(pMod: OverScreenMod, pAdd?: boolean): void;
    setPattern(pX: number, pY: number, pWidth?: number, pHeight?: number): void;
    setPos(pX: number, pY: number, pMap?: string): void;
    setScale(pX: number, pY?: number): void;
    setSize(pWidth: number, pHeight: number): void;
    setSpriteData(pData: unknown): void;
    setTransition(
        pO: object,
        pS: number,
        pT: number,
        pQ?: number,
        pLoop?: number,
        pEase?: string,
    ): void;
    [key: string]: any;
}

Indexable

  • [key: string]: any

Properties

Methods

Events

Properties

allowDensityCross: boolean

If set, any movable with the same density as this diob may cross over it.

Client | Server

alpha: number

How visible the diob appears; (0 to 1); 0 completely invisible, 1 completely visible, between partially visible, higher the number the more visible.

Client | Server

anchor: { x: number; y: number }

Default is 0.5. Number for both x and y anchors or an object containing both {'x': 0, 'y': 0}. Determines where the icon's origin is.

Client | Server

angle: number

Angle of the diob (0 to 2PI).

Client | Server

animator: object

If set, will share animation with all other diobs with the same sync id. Example: {'sync': 'water'}.

Client | Server

atlasName: string

Name of atlas the object's icon is in.

Client | Server

baseType: string

Name of the lowest level parent type.

Client | Server

clientSyncData: any

Data shared automatically from the server-side to clients that have a sync for this diob. Changing the variable will update any clients that have this diob's sync in realtime.

Client | Server

color: string | number[] | { tint: number }

Hex, rgb, rgba, color matrix value, or a tint object. Applies color filter to diob. Example: ( #000000 ). Example: ( rgb(10, 20, 30) ). Example: ( {'tint': 0x444444} ).

Client | Server

composite:
    | "source-over"
    | "source-atop"
    | "source-in"
    | "source-out"
    | "destination-over"
    | "destination-atop"
    | "destination-in"
    | "destination-out"
    | "lighter"
    | "copy"
    | "xor"
    | "multiply"
    | "screen"
    | "overlay"
    | "darken"
    | "lighten"
    | "color-dodge"
    | "color-burn"
    | "hard-light"
    | "soft-light"
    | "difference"
    | "exclusion"
    | "hue"
    | "saturation"
    | "color"
    | "luminosity"

String containing composite value that determines how this diob is drawn with other diobs on the same plane. Possible values: normal, add, multiply, screen.

Client | Server

density: number | boolean

Determines if the object is dense or not. True or false for dense or not, or a number for value, over 1 for different densities. For example, density 3 diobs can move over density 2 and lower diobs but not anything density 3 or higher.

Client | Server

floatingPlatform?: boolean
height: number

Height of the collision box of the object.

Client | Server

iconName: string

Name of icon inside object's icon atlas.

Client | Server

iconState: string

State of the icon.

Client | Server

id: string | number

Unique ID of the diob.

Client | Server

invisibility: number

If set, diob will be invisible to all other diobs with visibility less than this value.

Client | Server

isCullable: boolean

CLIENT-ONLY. Controls whether this diob is subject to screen frustum culling. When true (default), the diob is removed from the active screen display list when outside the viewport.

Client

isDiob: boolean

Read-only boolean flag indicating this object is a Diob.

Client | Server

isOverlay: null | boolean | Diob

If this diob is an Overlay type or is being used as an overlay, this will be set. If the overlay has a parent diob, this will be a reference to that diob.

Client | Server

layer: number

Order of display of the diob. Higher layer objects appear above lower layer objects.

Client | Server

loc: null | Tile

The tile that the diob is on.

Client | Server

map: null | Map

The current map instance this diob belongs to.

Client | Server

mapName: string

Name of the map.

Client | Server

mouseOpacity: 0 | 1 | 2 | MouseOpacity

Determines if the cursor executes mouse events on this diob or not.

  • MouseOpacity.Transparent (0): Ignores mouse events (cursor clicks pass through).
  • MouseOpacity.Icon (1): Uses the object's visual icon bounds (iconWidth x iconHeight + icon offsets) to detect mouse events.
  • MouseOpacity.Bounds (2): Uses the object's physical collision bounding box (width x height + origins) to detect mouse events.

Client | Server

diob.mouseOpacity = MouseOpacity.Bounds;
name: string

Name of object.

Client | Server

parentType: string

Name of the highest level parent type.

Client | Server

plane: number

Order of display of the diob. Diobs with the same plane appear together with layers determining the order. A diob with a plane of 1 and layer 1000 will appear below a diob with plane 2 (default planes: Diob 0, Movable 1, Particle 2).

Client | Server

preventClientUpdates: boolean | { client?: Client[]; type?: string[] }

If set, the server will not update clients when changes are made. Can be true to prevent all clients from getting updated or can be an object containing variables and/or specific clients to ignore. Possible variables pos, dir, icon. Example: ( {'type': ['pos', 'dir'], 'client': [someClient]} ).

Server

preventInterest?: boolean

Controls whether this diob is exempt from spatial interest grid tracking and culling on the server.

Server

preventInterpolation: boolean

If set, the client will not interpolate position changes.

Client | Server

preventScreenRelayer: boolean

If set, the client will not update the draw layer of this diob when it changes location on the screen.

Client

region: null | Region

The region that the diob is in.

Client | Server

relayerHeight: number

Height to use when calculating y position relayering.

Client | Server

scale: { x: number; y: number }

The scale factors { x: number, y: number } applied to the diob's visual rendering.

Client | Server

diob.scale = { x: 2, y: 2 };
snapToFloor?: boolean
sprite: any

CLIENT-ONLY. Accesses the underlying PixiJS Sprite instance used to render this diob's icon (_vy_pixS).

Client

tag: string

Custom string used to identify the diob.

Client | Server

text: string

A string to be displayed as text above the diob.

Client | Server

textSprite: any

CLIENT-ONLY. Accesses the underlying PixiJS Text instance used to render this diob's text label (_vy_pixT).

Client

textStyle: object

Default is 0. Number of pixels to offset the text by on the y-axis.

Client | Server

tint: number

Color tint applied to this diob's visual sprite (e.g. 0xFFFFFF for untinted, or a hexadecimal color number).

Client | Server

diob.tint = 0xff0000; // Red tint
transform: number[] | TransformMatrixObject

The diob's transformation matrix (9-element array) or 2D transformation object.

Array format: [scaleX, skewY, 0, skewX, scaleY, 0, moveX, moveY, 1] Object format: { scaleX, skewY, skewX, scaleY, moveX, moveY }

Client | Server

diob.transform = { scaleX: 2, scaleY: 2, skewX: 0, skewY: 0, moveX: 10, moveY: 10 };
type: string

Name of the type of the object.

Client | Server

visibility: number

All invisible diobs with invisibility levels equal to or less than this will be visible to this diob.

Client | Server

width: number

Width of the collision box of the object.

Client | Server

xCoord: number

Position of object on the grid x-axis.

Client | Server

xCoordOffset: number

How many pixels object is offset on the grid x-axis from the xCoord.

Client | Server

xIconOffset: number

X-axis offset of the icon.

Client | Server

xOrigin: number

Position on the x-axis of the origin from the left edge of the diob.

Client | Server

xPos: number

Position on the x-axis from left to right of the map.

Client | Server

yCoord: number

Position of object on the grid y-axis.

Client | Server

yCoordOffset: number

How many pixels object is offset on the grid y-axis from its yCoord.

Client | Server

yOrigin: number

Position on the y-axis of the origin from the top edge of the diob.

Client | Server

yPos: number

Position on the y-axis from top to bottom of the map.

Client | Server

Methods

  • Adds the specified filter.

    Parameters

    • pName: string | number

      Name of the filter. Only one name may be used at a time, using the name will remove the old filter with that name.

    • pType: string

      The type of filter to add. Below is the types and their specific possible pArgs values.

    • pArgs: unknown

      Color-based filter.

    Returns void

    Client | Server

  • Adds pDiob to this diob's viewer array, allowing pDiob to always see this diob.

    Parameters

    • pDiob: Diob

      The diob to add.

    Returns void

    Client | Server

  • Adds an overlay to the object which is a visual icon that always follows the object. Returns the new overlay.

    Parameters

    • pOver: string | Diob | Object

      String of the type of object or overlay to add an overlay of or actual diob to get type from.

    • OptionalpAppearance: AppearMask

      (Optional) If 1 or positive, this overlay will be be treated as if it is part of the the parent's actual appearance - appearance settings such as angle and alpha of the parent will be used for this overlay and the overlay will be drawn directly on top of the parent so no other diobs that are not an overlay of the parent can appear between it and the parent (it will basically be an extension of the parent's icon). If this is false or 0, the overlay will be treated as an independent diob that just follows the parent around. If -1 or negative it will be treated like if it was 1 but it will appear under the parent instead of above it.

    • OptionalpSkipEvent: boolean

      (Optional) If true, the onAddOverlay event will not be called.

    Returns void

    Returns the new overlay.

    Client | Server

  • Returns true if this Diob is currently shown on the screen, false if not.

    Returns void

    Returns true if this Diob is currently shown on the screen, false if not.

    Client | Server

  • Returns animation state information for the diob's currently active animation.

    When called without arguments, returns an AnimationInfo object: { onFrame, frameCount, atlasName, iconName, iconState }.

    When called with a specific key name, returns the corresponding scalar value.

    Returns AnimationInfo

    Complete animation state object.

    Client | Server

    const anim = diob.getAnimation();
    console.log(`Playing frame ${anim.onFrame} of ${anim.frameCount}`);
  • Parameters

    • pVal: "onFrame" | "frameCount"

    Returns number

  • Parameters

    • pVal: "atlasName" | "iconName" | "iconState"

    Returns string

  • Parameters

    • pVal: string

    Returns string | number | AnimationInfo

  • Returns an array of Diobs currently inside this diob's contents container.

    Parameters

    • OptionalpType: string

      Optional type name filter (e.g. 'Item', 'Mob').

    • OptionalpChild: boolean

      If true, includes instances of child/derived types matching pType.

    Returns Diob[]

    Array of child Diob instances.

    Client | Server

    const items: Diob[] = chest.getContents('Item', true);
    for (const item of items) {
    console.log('Item in container:', item.name);
    }
  • Returns the coordinate offsets { x, y } from the diob's grid position.

    Returns Point2D

    Object containing x and y coordinate offsets in pixels.

    Client | Server

    const offsets = diob.getCoordOffsets();
    console.log(`Coord offsets: (${offsets.x}, ${offsets.y})`);
  • Returns the integer grid tile coordinates { x, y } of the diob.

    Returns Point2D

    Coordinates containing xCoord and yCoord.

    Client | Server

    const coords = diob.getCoords();
    console.log(`Tile grid: (${coords.x}, ${coords.y})`);
  • Returns an array of diobs that are crossing this diob using the provided arguments. If pType is not set, all diobs will be returned. If pType is set but pChild is not, all diobs with the exact type of pType will be returned. If pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned. For example, if pType is set to Mob with pChild undefined, all diobs with the exact type of Mob will be returned, but if pChild is set, then all mobs will be returned.

    Parameters

    • OptionalpType: string

      (Optional) String containing type path to return.

    • OptionalpChild: boolean

      (Optional) Boolean that determines if child types are included.

    Returns Diob[]

    Returns an array of diobs that are crossing this diob using the provided arguments. If pType is not set, all diobs will be returned. If pType is set but pChild is not, all diobs with the exact type of pType will be returned. If pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned. For example, if pType is set to Mob with pChild undefined, all diobs with the exact type of Mob will be returned, but if pChild is set, then all mobs will be returned.

    Client | Server

  • Returns an array of filter names.

    Returns string[]

    Returns an array of filter names.

    Client | Server

  • Returns an object containing the diob's icon atlas and icon name.

    Returns { atlas: string; icon: string }

    Object with atlas and icon properties.

    Client | Server

    const { atlas, icon } = diob.getIcon();
    console.log(`Atlas: ${atlas}, Icon: ${icon}`);
  • Returns the icon rendering visual offsets { x, y } in pixels.

    Returns Point2D

    Object containing horizontal (x) and vertical (y) icon offsets.

    Client | Server

    const offsets = diob.getIconOffsets();
    console.log(`Icon visual offsets: (${offsets.x}, ${offsets.y})`);
  • Returns an array of Diobs currently in this diob's invisibility viewer list.

    Returns Diob[]

    Array of Diob instances currently able to see through this diob's invisibility.

    Client | Server

    const viewers: Diob[] = mob.getInvisibilityViewers();
    for (const viewer of viewers) {
    console.log('Viewer present:', viewer.tag);
    }
  • Returns an array of locations the diob is on. If diob is a tile, it returns an array containing only itself.

    Returns Diob[]

    Returns an array of locations the diob is on. If diob is a tile, it returns an array containing only itself.

    Client | Server

  • Returns the current diob being used as a mask.

    Returns Diob

    Returns the current diob being used as a mask.

    Client | Server

  • Returns the origin point offsets { x, y } from which rotation and positioning offsets are calculated.

    Returns Point2D

    Object containing horizontal (x) and vertical (y) origin offsets in pixels.

    Client | Server

    const origin = diob.getOrigin();
    console.log(`Origin: (${origin.x}, ${origin.y})`);
  • Returns an array of diobs that are overlays of this diob using the provided arguments. If pType is not set, all diobs will be returned. If pType is set but pChild is not, all diobs with the exact type of pType will be returned. If pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned. For example, if pType is set to Mob with pChild undefined, all diobs with the exact type of Mob will be returned, but if pChild is set, then all mobs will be returned.

    Parameters

    • OptionalpType: string

      (Optional) String containing type path to return.

    • OptionalpChild: boolean

      (Optional) Boolean that determines if child types are included.

    Returns Diob[]

    Returns an array of diobs that are overlays of this diob using the provided arguments. If pType is not set, all diobs will be returned. If pType is set but pChild is not, all diobs with the exact type of pType will be returned. If pType is set and pChild is set, all diobs with the type pType or a parent type of pType will be returned. For example, if pType is set to Mob with pChild undefined, all diobs with the exact type of Mob will be returned, but if pChild is set, then all mobs will be returned.

    Client | Server

  • Captures or retrieves over screen data for this diob (client-side only).

    Parameters

    • OptionalpType: "url" | "pixels" | "canvas" | "sprite"

      Type of data representation to retrieve.

    Returns undefined | ScreenCaptureData

    Captured screen data object or undefined.

    Client

    const capture = diob.getOverScreen('pixels');
    if (capture && capture.data) {
    console.log('Captured width:', capture.width, 'height:', capture.height);
    }
  • Returns the over screen modifier object currently applied to this diob.

    Returns undefined | OverScreenMod

    Current modifier object containing scale, angle, and alpha settings.

    Client | Server

  • Returns an object {'x': x, 'y': y} containing the x and y positions of the diob on the map.

    Returns { x: number; y: number }

    returns an object {'x': x, 'y': y} containing the x and y positions of the diob on the map.

    Client | Server

  • Calculates the screen viewport position of this diob in pixels.

    Parameters

    • OptionalpO: Partial<Point2D>

      Optional point object to populate with x and y.

    Returns Point2D

    The screen coordinates { x, y } in viewport pixels.

    Client

    const screenPos = diob.getScreenPos();
    console.log(`Diob screen position: (${screenPos.x}, ${screenPos.y})`);
  • Returns the dimensions (width and height in pixels) of this diob's current icon state.

    Returns Size2D

    Dimensions containing width and height in pixels.

    Client | Server

    const { width, height } = diob.getSize();
    console.log(`Diob size: ${width}x${height}`);
  • Returns data extracted from the internal rendering sprite of the diob (client-side only).

    Parameters

    • OptionalpType: "url" | "pixels" | "canvas"

      Format to extract: 'url' for base64 data URL string, 'pixels' for Uint8ClampedArray / ImageData, 'canvas' for HTMLCanvasElement. If omitted, returns the internal PIXI sprite reference.

    Returns any

    Rendered sprite extraction data.

    Client

    const dataUrl = diob.getSpriteData('url') as string;
    const canvas = diob.getSpriteData('canvas') as HTMLCanvasElement;
  • Returns the transformation matrix of this diob either as a 9-element array or as a TransformMatrixObject.

    Parameters

    • OptionalpAsObj: boolean

      If true, returns an object { scaleX, skewY, skewX, scaleY, moveX, moveY } instead of a 9-element array.

    Returns number[] | TransformMatrixObject

    The current 2D transformation matrix.

    Client | Server

    const transformObj = diob.getTransform(true) as TransformMatrixObject;
    console.log(transformObj.scaleX, transformObj.scaleY);
  • Executes 2D canvas drawing commands onto this diob's over screen surface.

    Parameters

    • pArgs: DrawCommandArgs | DrawCommandArgs[]

      A draw command configuration object or array of command objects.

    Returns void

    Client | Server

    diob.overScreenDraw({
    type: 'fillRect',
    color: 'rgba(255, 0, 0, 0.5)',
    x: 0,
    y: 0,
    width: 32,
    height: 32
    });
  • Removes the specified filter.

    Parameters

    • pName: string | number

      Name of filter to remove.

    Returns void

    Client | Server

  • Removes the mask applied to this diob.

    Returns void

    Client | Server

  • Removes all overlays with the pOver type or the exact overlay matching pOver.

    Parameters

    • pOver: string | Diob | Object

      String of the type of object or overlay to remove or actual overlay to remove.

    • OptionalpSave: boolean

      (Optional) If set, the overlay will not be deleted, otherwise this call will delete pOver after removing it from the overlays.

    Returns void

    Client | Server

  • Sends a packet to a client or server specifically for this diob, depending on where the code is executed. Client code executing this will send the packet to the server. Server code executing this will send the packet to the client. This will invoke Diob/onPacket on client-side if the sendPacket is server-side and on the server-side if it is on the client-side.

    Parameters

    • pName: string | number

      Name of packet to send.

    • pData: unknown

      Data to be sent. Example: {'a': 1, 'b': 2} or test.

    • OptionalpClient: Client

      (Optional) SERVER ONLY. Optional. Specific client or array of clients to send this packet to. If no client is specified the packet will be sent to all clients currently synced with this diob.

    Returns void

    Client | Server

  • Sets this diob's icon anchor to pX and pY. Default is 0.5,0.5 which is the center of the diob's icon (0,0 would be the top-left corner).

    Parameters

    • pX: number

      Default is 0. 5. X value of the diob's icon anchor.

    • OptionalpY: number

      (Optional) Default is 0. 5. Y value of the diob's icon anchor.

    Returns void

    Client | Server

  • Changes the appearance of the diob based on the values provided by pDiob.

    Parameters

    • pDiob: Diob

      Object containing the appearance information or a diob itself. Values used: atlasName, iconName, iconState, width, height, layer, scale, color, alpha, transform, anchor, angle, composite, plane, text, textStyle, animator, overlays, overScreen.

    Returns void

    Client | Server

  • Sets the coord offset of the object.

    Parameters

    • pX: number

      The x offset from the xCoord.

    • pY: number

      The y offset from the yCoord.

    Returns void

    Client | Server

  • Sets the animation frame to pFrame and freezes for pDelay milliseconds before returning to the previous frame or continuing on if pCont is set.

    Parameters

    • pFrame: number

      Frame number.

    • OptionalpDelay: number

      (Optional) Delay in milliseconds to freeze the newly set frame for. Passing in -1 will pause the animation until you unpause it by changing the diob's animator.isPaused to false.

    • OptionalpCont: boolean

      (Optional) If true, animation will play like normal after the frame delay. False will return the animation to the frame it was at before the set after the delay.

    Returns void

    Client | Server

  • Changes display icon of object.

    Parameters

    • pAtlas: string

      Name of atlas icon is in.

    • pIcon: string

      Name of icon in pAtlas.

    Returns void

    Client | Server

  • Sets the x and y offsets of the icon.

    Parameters

    • pX: number

      The x offset of the icon of this object.

    • pY: number

      The y offset of the icon of this object.

    Returns void

    Client | Server

  • Sets the icon state of the diob's icon.

    Parameters

    • pState: string

      State of the icon to set.

    • OptionalpFrame: number

      (Optional) If true, animation will start from the frame the last iconState left off on.

    Returns void

    Client | Server

  • Moves this to specified location. If pVal1 and pVal2 are numbers, this is moved to the coordinate pVal1, pVal2. If pVal1 is an object but not a tile, this is moved to the location of object. If pVal1 is a tile, this is moved to that tile.

    Returns Diob

    Client | Server

  • Turns pMask into a mask which this diob interacts with. Transparent portions of the pMask's icon will cut out those same spots from this diob's icon.

    Parameters

    • pMask: Diob

      Diob to use as a mask.

    Returns void

    Client | Server

  • Sets the x and y origin offsets.

    Parameters

    • pX: number

      The x offset of the origin of this object from the left.

    • pY: number

      The y offset of the origin of this object from the top.

    Returns void

    Client | Server

  • Sets the diob's overlays to the array pOver.

    Parameters

    • pOver: Diob[]

      Array of overlays to set this diob's overlays to.

    • OptionalpSave: boolean

      (Optional) If set, removed overlays will not be deleted, otherwise this call will delete removed overlays after removing them from the overlays.

    Returns void

    Client | Server

  • Changes the over screen information. Adding data optional.

    Parameters

    • pX: number

      X offset of display.

    • pY: number

      Y offset of display.

    • pWidth: number

      Width of display.

    • pHeight: number

      Height of display.

    • OptionalpData: unknown

      (Optional) Data to add to the screen.

    • OptionalpSet: object

      (Optional) Settings object. Example: ( {'scaleNearest': true} ).

    Returns void

    Client | Server

  • Modifies the scale, angle, or alpha of this diob's over screen display.

    Parameters

    • pMod: OverScreenMod

      Object containing modifications: scale, angle, alpha.

    • OptionalpAdd: boolean

      (Optional) If true, values in pMod will be added to the existing modifications.

    Returns void

    Client | Server

    diob.setOverScreenMod({ angle: Math.PI / 4, alpha: 0.8, scale: { x: 1.5, y: 1.5 } });
    
  • Turns this diob's sprite into a repeating pattern. Call with no arguments to return to a normal sprite.

    Parameters

    • pX: number

      Default is 0. Position where the pattern starts on the x-axis.

    • pY: number

      Default is 0. Position where the pattern starts on the y-axis.

    • OptionalpWidth: number

      (Optional) Width of the pattern.

    • OptionalpHeight: number

      (Optional) Height of the pattern.

    Returns void

    Client | Server

  • Moves the movable to the position pX and pY on the map named pMap.

    Parameters

    • pX: number

      Value to set the movable's x position on the map to.

    • pY: number

      Value to set the movable's y position on the map to.

    • OptionalpMap: string

      (Optional) String containing name of map to set position on.

    Returns void

    Client | Server

  • Sets the scale of the diob.

    Parameters

    • pX: number

      Number to scale the width of the diob by. For example 2 would be a 200% scale.

    • OptionalpY: number

      (Optional) Number to scale the height of the diob by. For example 2 would be a 200% scale. PX used if null.

    Returns void

    Client | Server

  • Sets the width and height of the diob.

    Parameters

    • pWidth: number

      Value to set the diob's width to.

    • pHeight: number

      Value to set the diob's height to.

    Returns void

    Client | Server

  • Set the diob's sprite to pData.

    Parameters

    • pData: unknown

      Data to set sprite to.

    Returns void

    Client | Server

  • Transitions this diob's pO properties from their current values to the new values over time. If pO is not set all transitions will be cancelled and all properties will automatically go to their end transition values. Current allowed properties: alpha, angle, scale, xScale, yScale, xIconOffset, yIconOffset.

    Parameters

    • pO: object

      Object containing properties to transition. Example: {'alpha': 0.5, 'xIconOffset': 20}.

    • pS: number

      Number of steps to take to transition the properties. Default is 1. -1 for a step every frame.

    • pT: number

      Number of milliseconds between each step. Default is 100. If pS is -1 then this is the total time.

    • OptionalpQ: number

      (Optional) If set, this transition will be added to a queue and happen after the current transition finishes or the rest of the queue clears. Set as -1 to merge this with the last thing in the queue.

    • OptionalpLoop: number

      (Optional) If set, this transition will be added to the current loop of transitions and repeat until told to stop, if this transition is first, this can be set to a specify number to stop looping after that amount of loops; -1 to loop forever.

    • OptionalpEase: string

      (Optional) Use an easing equation that isn't linear. Options: quadraticIn, quadraticOut, quadraticInOut, cubicIn, cubicOut, cubicInOut, quarticIn, quarticOut, quarticInOut, quinticIn, quinticOut, quinticInOut, sineIn, sineOut, sineInOut, expoIn, expoOut, expoInOut, circularIn, circularOut, circularInOut.

    Returns void

    Client | Server

Events

  • When this diob has an overlay added to it.

    Parameters

    • pD: Diob

      The diob added as an overlay.

    Returns void

    Client | Server

  • When a movable bumps into this diob.

    Parameters

    • pMovable: Diob & Movable

      Movable that did the bumping.

    Returns void

    Client | Server

  • CLIENT-ONLY. Called when this diob's state is synchronized from the server to the client.

    Parameters

    • pClient: Client

      The local client instance.

    Returns void

    Client

  • Calls on the client-side when clientSyncData is changed by the server.

    Parameters

    • pOld: unknown

      Old data in clientSyncData.

    Returns void

    Client | Server

  • When pMovable attempts to cross this diob resulting in overlapping bounding boxes. This function must return true in order for pMovable to cross. This event is called for both diobs if they are both movable. Tiles do not have this event.

    Parameters

    • pMovable: Diob & Movable

      Movable that is attempting to cross with this diob.

    • OptionalpInit: boolean

      If set, pMovable initiated the event.

    Returns boolean | void

    Client | Server

  • When this diob and pD have overlapping bounding boxes.

    Parameters

    • pD: Diob

      Diob that crossed with this diob.

    • OptionalpInit: number | boolean

      If set, pD was relocated and initiated the event.

    Returns void

    Client | Server

  • When this diob and pD have overlapping bounding boxes and one of them changes position and stays overlapped.

    Parameters

    • pD: Diob

      Diob that is crossed with this diob.

    • OptionalpInit: boolean

      If set, pD was relocated and initiated the event.

    Returns void

    Client | Server

  • When this diob and pMovable are crossed and pMovable moves.

    Parameters

    • pDiob: Diob

      Diob that moved.

    Returns void

    Client | Server

  • When an object enters the contents of another object.

    Parameters

    • pDiob: Diob

      Object that entered.

    Returns void

    Client | Server

  • When an object exits the contents of another object.

    Parameters

    • pDiob: Diob

      Object that exited.

    Returns void

    Client | Server

  • When this diob changes maps. This event will be called twice if the map has not already been loaded, once before loading and once after the loading has completed (the first event will have pBefore set).

    Parameters

    • pMap: string

      Name of the old map or name of the new map if pBefore is set.

    • OptionalpBefore: boolean

      If set then the map is currently loading and this is the pre-load event.

    Returns void

    Client | Server

  • Called when a mouse button is clicked on this diob (press and release sequence).

    Parameters

    • pClient: Client

      The client instance originating the mouse click.

    • pX: number

      The horizontal coordinate of the mouse relative to the diob's origin.

    • pY: number

      The vertical coordinate of the mouse relative to the diob's origin.

    • pButton: MouseButton

      The mouse button that was clicked (MouseButton.Left, MouseButton.Middle, or MouseButton.Right).

    Returns void

    Client | Server

    onMouseClick(pClient: Client, pX: number, pY: number, pButton: MouseButton): void {
    if (pButton === MouseButton.Left) {
    console.log(`${pClient.getAccountName()} left-clicked on diob at (${pX}, ${pY})`);
    }
    }
  • Called when a mouse button is double clicked on this diob.

    Parameters

    • pClient: Client

      The client instance originating the double click.

    • pX: number

      The horizontal coordinate of the mouse relative to the diob's origin.

    • pY: number

      The vertical coordinate of the mouse relative to the diob's origin.

    • pButton: MouseButton

      The mouse button used (MouseButton.Left, MouseButton.Middle, or MouseButton.Right).

    Returns void

    Client | Server

    onMouseDblClick(pClient: Client, pX: number, pY: number, pButton: MouseButton): void {
    if (pButton === MouseButton.Left) {
    console.log('Double clicked diob with left mouse button');
    }
    }
  • Called when a mouse button has been pressed while positioned over this diob.

    Parameters

    • pClient: Client

      The client instance whose mouse button was pressed.

    • pX: number

      The horizontal coordinate of the mouse relative to the diob's origin.

    • pY: number

      The vertical coordinate of the mouse relative to the diob's origin.

    • pButton: MouseButton

      The mouse button that was pressed (MouseButton.Left, MouseButton.Middle, or MouseButton.Right).

    Returns void

    Client | Server

    onMouseDown(pClient: Client, pX: number, pY: number, pButton: MouseButton): void {
    if (pButton === MouseButton.Left) {
    // Handle left press (e.g. begin dragging or selection)
    } else if (pButton === MouseButton.Right) {
    // Handle right press (e.g. contextual actions)
    }
    }
  • Called when the mouse enters this object.

    Parameters

    • pClient: Client

      Client of the mouse.

    • pX: number

      The x position of the mouse over the diob.

    • pY: number

      The y position of the mouse over the diob.

    Returns void

    Client | Server

  • Called when the mouse exits this object.

    Parameters

    • pClient: Client

      Client of the mouse.

    • pX: number

      The x position of the mouse over the diob.

    • pY: number

      The y position of the mouse over the diob.

    Returns void

    Client | Server

  • Called when the mouse moves after entering this object.

    Parameters

    • pClient: Client

      Client of the mouse.

    • pX: number

      The x position of the mouse over the diob.

    • pY: number

      The y position of the mouse over the diob.

    Returns void

    Client | Server

  • Called when a mouse button is released while positioned over this diob.

    Parameters

    • pClient: Client

      The client instance whose mouse button was released.

    • pX: number

      The horizontal coordinate of the mouse relative to the diob's origin.

    • pY: number

      The vertical coordinate of the mouse relative to the diob's origin.

    • pButton: MouseButton

      The mouse button that was released (MouseButton.Left, MouseButton.Middle, or MouseButton.Right).

    Returns void

    Client | Server

    onMouseUp(pClient: Client, pX: number, pY: number, pButton: MouseButton): void {
    if (pButton === MouseButton.Left) {
    // End dragging or selection
    }
    }
  • Called when a mouse wheel button is scrolled downward while over this object.

    Parameters

    • pClient: Client

      Client of the mouse.

    • pX: number

      The x position of the mouse over the diob.

    • pY: number

      The y position of the mouse over the diob.

    Returns void

    Client | Server

  • Called when a mouse wheel button is scrolled upward while over this object.

    Parameters

    • pClient: Client

      Client of the mouse.

    • pX: number

      The x position of the mouse over the diob.

    • pY: number

      The y position of the mouse over the diob.

    Returns void

    Client | Server

  • Called when this diob is attached as an overlay to another diob or client.

    Parameters

    • pParent: Diob

      The parent diob or client that this diob was attached to.

    Returns void

    Client | Server

  • Called when a packet is sent from this diob on the client or server using diob.sendPacket.

    Parameters

    • pClient: Client

      Client that sent the packet.

    • pName: string | number

      Name of packet.

    • pData: unknown

      Any data containing information for packet. Example: {'a': 1, 'b': 2} or test.

    Returns void

    Client | Server

  • When this diob has an overlay removed from it.

    Parameters

    • pD: Diob

      The diob that was removed from the overlays.

    Returns void

    Client | Server

  • When this diob leaves the client's screen view.

    Parameters

    • pClient: Client

      A reference to the client.

    Returns void

    Client | Server

  • When this diob enters the client's screen view.

    Parameters

    • pClient: Client

      A reference to the client.

    Returns void

    Client | Server

  • Called when a touch point is removed from over this diob.

    Parameters

    • pClient: Client

      The client whose touch was lifted.

    • pX: number

      Horizontal coordinate of the touch relative to the diob.

    • pY: number

      Vertical coordinate of the touch relative to the diob.

    • OptionalpCancel: boolean

      (Optional) Whether the touch was cancelled.

    • OptionalpEvent: TouchEvent

      (Optional) The native browser TouchEvent.

    Returns void

    Client | Server

  • Called when a touch point moves over this diob.

    Parameters

    • pClient: Client

      The client whose touch moved.

    • pX: number

      Horizontal coordinate of the touch relative to the diob.

    • pY: number

      Vertical coordinate of the touch relative to the diob.

    • OptionalpEvent: TouchEvent

      (Optional) The native browser TouchEvent.

    Returns void

    Client | Server

  • Called when a touch point is placed over this diob.

    Parameters

    • pClient: Client

      The client initiating the touch.

    • pX: number

      Horizontal coordinate of the touch relative to the diob.

    • pY: number

      Vertical coordinate of the touch relative to the diob.

    • OptionalpEvent: TouchEvent

      (Optional) The native browser TouchEvent.

    Returns void

    Client | Server

  • When this diob has a transition change. If pVar, pChange, and pStart are all unset then this is the event called when all transitions have ended.

    Parameters

    • OptionalpVar: string

      A string containing the name of the variable involved in the transition.

    • OptionalpChange: number

      The amount changed.

    • OptionalpStart: object

      If this is set then this is the event called when a transition starts. This will be a reference to the transition object used.

    Returns void

    Client | Server

  • When this diob and pMovable no longer have overlapping bounding boxes.

    Parameters

    • pDiob: Diob

      Diob that uncrossed with this diob.

    Returns void

    Client | Server

  • Called when this diob is removed as an overlay from its parent.

    Parameters

    • pParent: Diob

      The parent diob or client that this diob was removed from.

    Returns void

    Client | Server