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

MetaBuilding

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

id: *

Method Summary

Public Methods
public

computeOptimalDirectionAndRotationVariantAtTile(param0: object): {rotation: number, rotationVariant: number, connectedEntities?: Array<Entity>}

Should compute the optimal rotation variant on the given tile

public

createEntity(param0: object): *

Creates the entity without placing it

public

getAdditionalStatistics(root: GameRoot, variant: string): Array<[string, string]>

Should return additional statistics about this building

public
public

getBlueprintSprite(rotationVariant: number, variant: *): AtlasSprite

Returns a sprite for blueprints

public

getDimensions(variant: string): *

Should return the dimensions of the building

public

Whether to flip the orientation after a building has been placed - useful for tunnels.

public

Returns whether the building has the direction lock switch available

public

getId(): *

Returns the id of this building

public

Returns whether this building is removable

public

getIsReplaceable(variant: *): boolean

Returns whether this building can get replaced

public

Returns whether this building is rotateable

public

Returns whether this building is unlocked for the given game

public

getLayer(root: GameRoot, variant: string): Layer

Returns the edit layer of the building

public

Returns the placement sound

public

getPreviewSprite(rotationVariant: number, variant: *): AtlasSprite

Returns a preview sprite

public

Should return false if the pins are already included in the sprite of the building

public

Whether to rotate automatically in the dragging direction while placing

public

Whether to show a preview of the layer when placing the building

public

getSilhouetteColor(variant: string, rotationVariant: number): *

Should return a silhouette color for the map overview or null if not set

public

getSpecialOverlayRenderMatrix(rotation: number, rotationVariant: number, variant: string, entity: Entity): Array<number> | null

Can return a special interlaved 9 elements overlay matrix for rendering

public

getSprite(rotationVariant: number, variant: string): AtlasSprite

Returns the sprite for a given variant

public

Whether to stay in placement mode after having placed a building

public

Should setup the entity components

public

updateVariants(entity: Entity, rotationVariant: number, variant: string)

Should update the entity to match the given variants

Public Constructors

public constructor(id: string) source

Params:

NameTypeAttributeDescription
id string

Building id

Public Members

public id: * source

Public Methods

public computeOptimalDirectionAndRotationVariantAtTile(param0: object): {rotation: number, rotationVariant: number, connectedEntities?: Array<Entity>} source

Should compute the optimal rotation variant on the given tile

Params:

NameTypeAttributeDescription
param0 object
param0.root GameRoot
param0.tile Vector
param0.rotation number
param0.variant string
param0.layer Layer

Return:

{rotation: number, rotationVariant: number, connectedEntities?: Array<Entity>}

public createEntity(param0: object): * source

Creates the entity without placing it

Params:

NameTypeAttributeDescription
param0 object
param0.root GameRoot
param0.origin Vector

Origin tile

param0.rotation number=

Rotation

param0.originalRotation number

Original Rotation

param0.rotationVariant number

Rotation variant

param0.variant string

Return:

*

public getAdditionalStatistics(root: GameRoot, variant: string): Array<[string, string]> source

Should return additional statistics about this building

Params:

NameTypeAttributeDescription
root GameRoot
variant string

Return:

Array<[string, string]>

public getAvailableVariants(root: GameRoot): undefined[] source

Params:

NameTypeAttributeDescription
root GameRoot

Return:

undefined[]

public getBlueprintSprite(rotationVariant: number, variant: *): AtlasSprite source

Returns a sprite for blueprints

Params:

NameTypeAttributeDescription
rotationVariant number
  • optional
  • default: 0
variant *
  • optional
  • default: defaultBuildingVariant

Return:

AtlasSprite

public getDimensions(variant: string): * source

Should return the dimensions of the building

Params:

NameTypeAttributeDescription
variant string

Return:

*

public getFlipOrientationAfterPlacement(): boolean source

Whether to flip the orientation after a building has been placed - useful for tunnels.

Return:

boolean

public getHasDirectionLockAvailable(): boolean source

Returns whether the building has the direction lock switch available

Return:

boolean

public getId(): * source

Returns the id of this building

Return:

*

public getIsRemovable(variant: string): boolean source

Returns whether this building is removable

Params:

NameTypeAttributeDescription
variant string

Return:

boolean

public getIsReplaceable(variant: *): boolean source

Returns whether this building can get replaced

Params:

NameTypeAttributeDescription
variant *
  • optional
  • default: defaultBuildingVariant

Return:

boolean

public getIsRotateable(variant: string): boolean source

Returns whether this building is rotateable

Params:

NameTypeAttributeDescription
variant string

Return:

boolean

public getIsUnlocked(root: GameRoot): boolean source

Returns whether this building is unlocked for the given game

Params:

NameTypeAttributeDescription
root GameRoot

Return:

boolean

public getLayer(root: GameRoot, variant: string): Layer source

Returns the edit layer of the building

Params:

NameTypeAttributeDescription
root GameRoot
variant string

Return:

Layer

public getPlacementSound(variant: string): string source

Returns the placement sound

Params:

NameTypeAttributeDescription
variant string

Return:

string

public getPreviewSprite(rotationVariant: number, variant: *): AtlasSprite source

Returns a preview sprite

Params:

NameTypeAttributeDescription
rotationVariant number
  • optional
  • default: 0
variant *
  • optional
  • default: defaultBuildingVariant

Return:

AtlasSprite

public getRenderPins(variant: string): boolean source

Should return false if the pins are already included in the sprite of the building

Params:

NameTypeAttributeDescription
variant string

Return:

boolean

public getRotateAutomaticallyWhilePlacing(variant: string): boolean source

Whether to rotate automatically in the dragging direction while placing

Params:

NameTypeAttributeDescription
variant string

Return:

boolean

public getShowLayerPreview(variant: string): * source

Whether to show a preview of the layer when placing the building

Params:

NameTypeAttributeDescription
variant string

Return:

*

public getSilhouetteColor(variant: string, rotationVariant: number): * source

Should return a silhouette color for the map overview or null if not set

Params:

NameTypeAttributeDescription
variant string
rotationVariant number

Return:

*

public getSpecialOverlayRenderMatrix(rotation: number, rotationVariant: number, variant: string, entity: Entity): Array<number> | null source

Can return a special interlaved 9 elements overlay matrix for rendering

Params:

NameTypeAttributeDescription
rotation number
rotationVariant number
variant string
entity Entity

Return:

Array<number> | null

public getSprite(rotationVariant: number, variant: string): AtlasSprite source

Returns the sprite for a given variant

Params:

NameTypeAttributeDescription
rotationVariant number
variant string

Return:

AtlasSprite

public getStayInPlacementMode(): boolean source

Whether to stay in placement mode after having placed a building

Return:

boolean

public setupEntityComponents(entity: Entity, root: GameRoot) source

Should setup the entity components

Params:

NameTypeAttributeDescription
entity Entity
root GameRoot

public updateVariants(entity: Entity, rotationVariant: number, variant: string) source

Should update the entity to match the given variants

Params:

NameTypeAttributeDescription
entity Entity
rotationVariant number
variant string