Home Reference Source
import {BeltSystem} from 'shapez.io/js/game/systems/belt.js'
public class | source

BeltSystem

Extends:

GameSystemGameSystemWithFilter → BeltSystem

Manages all belts

Static Method Summary

Static Public Methods
public static

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public

Method Summary

Public Methods
public

Adds the given entity to the appropriate paths

public

Verifies all belt paths

public

Attempts to delete the belt from its current path

public

deserializePaths(data: Array<any>): *

Deserializes all belt paths

public

Draws all belt paths

public

Draws the belt path debug overlays

public

Draws a given chunk

public

Finds the follow up entity for a given belt.

public

Finds the supplying belt for a given belt.

public

Called when an entity got added

public

Called when an entity got destroyed

public

Recomputes the belt path network.

public

Serializes all belt paths

public

update()

Updates all belts

public

Updates the belt placement after an entity has been added / deleted

Inherited Summary

From class GameSystem
public static

Returns static id

public

root: *

public

draw(parameters: DrawParameters)

Override, do not call this directly, use startDraw()

public

Should refresh all caches

public

startDraw(parameters: DrawParameters)

public

update()

Updates the game system, override to perform logic

From class GameSystemWithFilter
public

All entities which match the current components

public
public
public
public
public

Recomputes all target entities after the game has loaded

public
public
public
public

Static Public Methods

public static getId(): string source

Returns static id

Override:

GameSystem#getId

Return:

string

Public Constructors

public constructor() source

Constructs a new game system with the given component filter. It will process all entities which have all of the passed components

Override:

GameSystemWithFilter#constructor

Public Members

public beltAnimations: Object<enumDirection, Array<AtlasSprite>> source

public beltPaths: Array<BeltPath> source

public beltSprites: Object<enumDirection, Array<AtlasSprite>> source

Public Methods

public addEntityToPaths(entity: Entity) source

Adds the given entity to the appropriate paths

Params:

NameTypeAttributeDescription
entity Entity

public debug_verifyBeltPaths() source

Verifies all belt paths

public deleteEntityFromPath(path: BeltPath, entity: Entity) source

Attempts to delete the belt from its current path

Params:

NameTypeAttributeDescription
path BeltPath
entity Entity

public deserializePaths(data: Array<any>): * source

Deserializes all belt paths

Params:

NameTypeAttributeDescription
data Array<any>

Return:

*

public drawBeltItems(parameters: DrawParameters) source

Draws all belt paths

Params:

NameTypeAttributeDescription
parameters DrawParameters

public drawBeltPathDebug(parameters: DrawParameters) source

Draws the belt path debug overlays

Params:

NameTypeAttributeDescription
parameters DrawParameters

public drawChunk_BackgroundLayer(parameters: DrawParameters, chunk: MapChunkView) source

Draws a given chunk

Params:

NameTypeAttributeDescription
parameters DrawParameters
chunk MapChunkView

public findFollowUpEntity(entity: Entity): Entity | null source

Finds the follow up entity for a given belt. Used for building the dependencies

Params:

NameTypeAttributeDescription
entity Entity

Return:

Entity | null

public findSupplyingEntity(entity: Entity): Entity | null source

Finds the supplying belt for a given belt. Used for building the dependencies

Params:

NameTypeAttributeDescription
entity Entity

Return:

Entity | null

public onEntityAdded(entity: Entity) source

Called when an entity got added

Params:

NameTypeAttributeDescription
entity Entity

public onEntityDestroyed(entity: Entity) source

Called when an entity got destroyed

Params:

NameTypeAttributeDescription
entity Entity

public recomputeAllBeltPaths() source

Recomputes the belt path network. Only required for old savegames

public serializePaths(): Array<object> source

Serializes all belt paths

Return:

Array<object>

public update() source

Updates all belts

Override:

GameSystem#update

public updateSurroundingBeltPlacement(entity: Entity) source

Updates the belt placement after an entity has been added / deleted

Params:

NameTypeAttributeDescription
entity Entity