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

BaseMap

Extends:

BasicSerializableObject → BaseMap

Direct Subclass:

MapView

Static Method Summary

Static Public Methods
public static
public static

getSchema(): {"seed": *}

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

Mapping of 'X|Y' to chunk

public

root: *

public

Method Summary

Public Methods
public

getChunk(chunkX: number, chunkY: number): *

Returns the given chunk by index

public

Gets a chunk if not existent for the given tile

public

getLayerContentXY(x: number, y: number, layer: Layer): Entity

Returns the tile content of a given tile

public

Returns the tile contents of a given tile

public

getLowerLayerContentXY(x: number, y: number): BaseItem=

Returns the lower layers content of the given tile

public

Gets or creates a new chunk if not existent for the given tile

public

getTileContent(tile: Vector, layer: Layer): Entity

Returns the tile content of a given tile

public

Checks a given tile for validty

public

isTileUsed(tile: Vector, layer: Layer): boolean

Checks if the tile is used

public

isTileUsedXY(x: number, y: number, layer: Layer): boolean

Checks if the tile is used

public

Checks if a given tile is within the map bounds

public

Places an entity with the StaticMapEntity component

public

Removes an entity with the StaticMapEntity component

public

setTileContent(tile: Vector, entity: Entity)

Sets the tiles content

Inherited Summary

From class BasicSerializableObject
public static
public static

getId()

public static

Should return the serialization schema

public static

verify(data: *): string | void

public

deserialize(data: any, root: import("./savegame_serializer").GameRoot): string | void

public

Static Public Methods

public static getId(): string source

Override:

BasicSerializableObject#getId

Return:

string

public static getSchema(): {"seed": *} source

Should return the serialization schema

Override:

BasicSerializableObject#getSchema

Return:

{"seed": *}

Public Constructors

public constructor(root: GameRoot) source

Fixes typeof DerivedComponent is not assignable to typeof Component, compiled out in non-dev builds

Override:

BasicSerializableObject#constructor

Params:

NameTypeAttributeDescription
root GameRoot

Public Members

public chunksById: Map<string, MapChunkView> source

Mapping of 'X|Y' to chunk

public root: * source

public seed: number source

Public Methods

public getChunk(chunkX: number, chunkY: number): * source

Returns the given chunk by index

Params:

NameTypeAttributeDescription
chunkX number
chunkY number

Return:

*

public getChunkAtTileOrNull(tileX: number, tileY: number): MapChunkView source

Gets a chunk if not existent for the given tile

Params:

NameTypeAttributeDescription
tileX number
tileY number

Return:

MapChunkView

public getLayerContentXY(x: number, y: number, layer: Layer): Entity source

Returns the tile content of a given tile

Params:

NameTypeAttributeDescription
x number
y number
layer Layer

Return:

Entity

Entity or null

public getLayersContentsMultipleXY(x: number, y: number): Array<Entity> source

Returns the tile contents of a given tile

Params:

NameTypeAttributeDescription
x number
y number

Return:

Array<Entity>

Entity or null

public getLowerLayerContentXY(x: number, y: number): BaseItem= source

Returns the lower layers content of the given tile

Params:

NameTypeAttributeDescription
x number
y number

Return:

BaseItem=

public getOrCreateChunkAtTile(tileX: number, tileY: number): MapChunkView source

Gets or creates a new chunk if not existent for the given tile

Params:

NameTypeAttributeDescription
tileX number
tileY number

Return:

MapChunkView

public getTileContent(tile: Vector, layer: Layer): Entity source

Returns the tile content of a given tile

Params:

NameTypeAttributeDescription
tile Vector
layer Layer

Return:

Entity

Entity or null

public internalCheckTile(tile: Vector) source

Checks a given tile for validty

Params:

NameTypeAttributeDescription
tile Vector

public isTileUsed(tile: Vector, layer: Layer): boolean source

Checks if the tile is used

Params:

NameTypeAttributeDescription
tile Vector
layer Layer

Return:

boolean

public isTileUsedXY(x: number, y: number, layer: Layer): boolean source

Checks if the tile is used

Params:

NameTypeAttributeDescription
x number
y number
layer Layer

Return:

boolean

public isValidTile(tile: Vector): boolean source

Checks if a given tile is within the map bounds

Params:

NameTypeAttributeDescription
tile Vector

Return:

boolean

public placeStaticEntity(entity: Entity) source

Places an entity with the StaticMapEntity component

Params:

NameTypeAttributeDescription
entity Entity

public removeStaticEntity(entity: Entity) source

Removes an entity with the StaticMapEntity component

Params:

NameTypeAttributeDescription
entity Entity

public setTileContent(tile: Vector, entity: Entity) source

Sets the tiles content

Params:

NameTypeAttributeDescription
tile Vector
entity Entity