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

WireSystem

Extends:

GameSystemGameSystemWithFilter → WireSystem

Static Method Summary

Static Public Methods
public static

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public
public
public

wireSprites: Object<MetaWireBuilding.wireVariants, Object<enumWireType, AtlasSprite>>

Method Summary

Public Methods
public

drawChunk_WiresForegroundLayer(parameters: import("../../core/draw_utils").DrawParameters, chunk: MapChunkView)

Draws a given chunk

public

findNetworkForEjector(initialEntity: Entity, slot: import("../components/wired_pins").WirePinSlot)

Finds the network for the given slot

public

findSurroundingWireTargets(initialTile: Vector, directions: Array<enumDirection>, network: WireNetwork, variantMask: MetaWireBuilding.wireVariants=): Array<any>

Finds surrounding entities which are not yet assigned to a network

public

getSpriteSetAndOpacityForWire(wireComp: WireComponent): {spriteSet: Object<enumWireType, import("../../core/draw_utils").AtlasSprite>, opacity: number}

Returns the given tileset and opacity

public

Returns whether this entity is relevant for the wires network

public
public

Invalidates the wires network if the given entity is relevant for it

public

Recomputes the whole wires network

public

update()

Updates the wires network

public

Updates the wire 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 isFirstRecompute: boolean source

public needsRecompute: boolean source

public networks: Array<WireNetwork> source

public staleArea: * source

public wireSprites: Object<MetaWireBuilding.wireVariants, Object<enumWireType, AtlasSprite>> source

Public Methods

public drawChunk_WiresForegroundLayer(parameters: import("../../core/draw_utils").DrawParameters, chunk: MapChunkView) source

Draws a given chunk

Params:

NameTypeAttributeDescription
parameters import("../../core/draw_utils").DrawParameters
chunk MapChunkView

public findNetworkForEjector(initialEntity: Entity, slot: import("../components/wired_pins").WirePinSlot) source

Finds the network for the given slot

Params:

NameTypeAttributeDescription
initialEntity Entity
slot import("../components/wired_pins").WirePinSlot

public findSurroundingWireTargets(initialTile: Vector, directions: Array<enumDirection>, network: WireNetwork, variantMask: MetaWireBuilding.wireVariants=): Array<any> source

Finds surrounding entities which are not yet assigned to a network

Params:

NameTypeAttributeDescription
initialTile Vector
directions Array<enumDirection>
network WireNetwork
variantMask MetaWireBuilding.wireVariants=

Only accept connections to this mask

Return:

Array<any>

public getSpriteSetAndOpacityForWire(wireComp: WireComponent): {spriteSet: Object<enumWireType, import("../../core/draw_utils").AtlasSprite>, opacity: number} source

Returns the given tileset and opacity

Params:

NameTypeAttributeDescription
wireComp WireComponent

Return:

{spriteSet: Object<enumWireType, import("../../core/draw_utils").AtlasSprite>, opacity: number}

public isEntityRelevantForWires(entity: Entity): * source

Returns whether this entity is relevant for the wires network

Params:

NameTypeAttributeDescription
entity Entity

Return:

*

public queuePlacementUpdate(entity: Entity) source

Params:

NameTypeAttributeDescription
entity Entity

public queueRecomputeIfWire(entity: Entity) source

Invalidates the wires network if the given entity is relevant for it

Params:

NameTypeAttributeDescription
entity Entity

public recomputeWiresNetwork() source

Recomputes the whole wires network

public update() source

Updates the wires network

Override:

GameSystem#update

public updateSurroundingWirePlacement(affectedArea: Rectangle) source

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

Params:

NameTypeAttributeDescription
affectedArea Rectangle