Home Reference Source
import {MapChunkView} from 'shapez.io/js/game/map_chunk_view.js'
public class | source

MapChunkView

Extends:

MapChunk → MapChunkView

Static Method Summary

Static Public Methods
public static

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

Whenever something changes, we increase this number - so we know we need to redraw

public

Method Summary

Public Methods
public

Draws the background layer

public

Draws the dynamic foreground layer

public

drawForegroundLayer(parameters: DrawParameters, layer: Layer)

Draws the layer

public

Draws the static foreground layer

public

Overlay

public

Draws the wires layer

public

generateOverlayBuffer(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D, w: number, h: number, dpi: number)

public

Marks this chunk as dirty, rerendering all caches

Inherited Summary

From class MapChunk
public
public

Which entities this chunk contains, sorted by layer

public

Stores the contents of the regular layer

public

Stores the contents of the layers

public

Stores the contents of the lower (= map resources) layer

public

patches: Array<{pos: Vector, item: BaseItem, size: number}>

Store which patches we have so we can render them in the overview

public

root: *

public

Tile space rectangle, can be used for culling

public

tileX: *

public

tileY: *

public

Stores the contents of the wires layer

public

World space rectangle, can be used for culling

public

x: *

public

y: *

public

Generates the lower layer "terrain"

public

Checks if this chunk has predefined contents, and if so returns true and generates the predefined contents

public

getLayerContentFromWorldCoords(worldX: number, worldY: number, layer: Layer): Entity=

Returns the contents of this chunk from the given world space coordinates

public

Returns the contents of this chunk from the given world space coordinates

public

getLowerLayerFromWorldCoords(worldX: number, worldY: number): BaseItem=

public

getTileContentFromLocalCoords(localX: number, localY: number): Entity=

Returns the chunks contents from the given local coordinates

public

getTileContentFromWorldCoords(worldX: number, worldY: number): Entity=

Returns the contents of this chunk from the given world space coordinates

public

internalGeneratePatch(rng: RandomNumberGenerator, patchSize: number, item: any, overrideX: number=, overrideY: number=)

Generates a patch filled with the given item

public

setLayerContentFromWorldCords(tileX: number, tileY: number, contents: Entity, layer: Layer)

Sets the chunks contents

Static Public Methods

public static drawSingleOverviewTile(param0: object) source

Params:

NameTypeAttributeDescription
param0 object
param0.context CanvasRenderingContext2D
param0.x number
param0.y number
param0.entity Entity
param0.tileSizePixels number
param0.overrideColor string=

Optionally override the color to be rendered

Public Constructors

public constructor(root: GameRoot, x: number, y: number) source

Override:

MapChunk#constructor

Params:

NameTypeAttributeDescription
root GameRoot
x number
y number

Public Members

public renderIteration: number source

Whenever something changes, we increase this number - so we know we need to redraw

public renderKey: * source

Public Methods

public drawBackgroundLayer(parameters: DrawParameters) source

Draws the background layer

Params:

NameTypeAttributeDescription
parameters DrawParameters

public drawForegroundDynamicLayer(parameters: DrawParameters) source

Draws the dynamic foreground layer

Params:

NameTypeAttributeDescription
parameters DrawParameters

public drawForegroundLayer(parameters: DrawParameters, layer: Layer) source

Draws the layer

Params:

NameTypeAttributeDescription
parameters DrawParameters
layer Layer

public drawForegroundStaticLayer(parameters: DrawParameters) source

Draws the static foreground layer

Params:

NameTypeAttributeDescription
parameters DrawParameters

public drawOverlay(parameters: DrawParameters) source

Overlay

Params:

NameTypeAttributeDescription
parameters DrawParameters

public drawWiresForegroundLayer(parameters: DrawParameters) source

Draws the wires layer

Params:

NameTypeAttributeDescription
parameters DrawParameters

public generateOverlayBuffer(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D, w: number, h: number, dpi: number) source

Params:

NameTypeAttributeDescription
canvas HTMLCanvasElement
context CanvasRenderingContext2D
w number
h number
dpi number

public markDirty() source

Marks this chunk as dirty, rerendering all caches