Home Reference Source
import {StorageComponent} from 'shapez.io/js/game/components/storage.js'
public class | source

StorageComponent

Extends:

BasicSerializableObjectComponent → StorageComponent

Static Method Summary

Static Public Methods
public static
public static

getSchema(): {"storedCount": *, "storedItem": *}

Constructor Summary

Public Constructor
public

constructor(param0: object)

Member Summary

Public Members
public
public

We compute an opacity to make sure it doesn't flicker

public

How many of this item we have stored

public

Currently stored item

Method Summary

Public Methods
public

Returns whether this storage can accept the item

public

Returns whether the storage is full

public

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
From class Component
public static

Returns the components unique id

public static

getSchema(): {}

Should return the schema used for serialization

public

copyAdditionalStateTo(otherComponent: Component)

Copy the current state to another component

public

Returns a string representing the components data, only in dev builds

Static Public Methods

public static getId(): string source

Returns the components unique id

Override:

Component#getId

Return:

string

public static getSchema(): {"storedCount": *, "storedItem": *} source

Should return the schema used for serialization

Override:

Component#getSchema

Return:

{"storedCount": *, "storedItem": *}

Public Constructors

public constructor(param0: object) source

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

Override:

Component#constructor

Params:

NameTypeAttributeDescription
param0 object
param0.maximumStorage number=

How much this storage can hold

Public Members

public maximumStorage: * source

public overlayOpacity: number source

We compute an opacity to make sure it doesn't flicker

public storedCount: number source

How many of this item we have stored

public storedItem: BaseItem source

Currently stored item

Public Methods

public canAcceptItem(item: BaseItem): boolean source

Returns whether this storage can accept the item

Params:

NameTypeAttributeDescription
item BaseItem

Return:

boolean

public getIsFull(): boolean source

Returns whether the storage is full

Return:

boolean

public takeItem(item: BaseItem) source

Params:

NameTypeAttributeDescription
item BaseItem