Class ClockworkCostMatrix

A wrapper around the LocalCostMatrix type from the Screeps API. Instances can be passed between WASM and JS as a pointer, using the methods to get and set values, rather than copying the entire matrix.

Constructors

Methods

Constructors

  • Creates a new cost matrix within the WASM module. Optionally, a default value can be provided to initialize all cells in the matrix to that value.

    Parameters

    • Optional_default: number

    Returns ClockworkCostMatrix

Methods

  • Returns void

  • Gets the cost of a given position in the cost matrix.

    Parameters

    • x: number
    • y: number

    Returns number

  • Sets the cost of a given position in the cost matrix.

    Parameters

    • x: number
    • y: number
    • value: number

    Returns void