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

Entity

Extends:

BasicSerializableObject → Entity

Static Method Summary

Static Public Methods
public static
public static

getSchema(): import("../savegame/serialization").Schema

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

The components of the entity

public

layer: Layer

On which layer this entity is

public

Whether this entity was registered on the @see EntityManager so far

public

root: *

Handle to the global game root

public

Internal entity unique id, set by the @see EntityManager

Method Summary

Public Methods
public

addComponent(componentInstance: Component, force: boolean)

Adds a new component, only possible until the entity is registered on the entity manager, after that use @see EntityManager.addDynamicComponent

public

clone(): *

Returns a clone of this entity

public

Draws the entity, to override use @see Entity.drawImpl

public

drawImpl(parameters: DrawParameters)

override, should draw the entity

public

getId(): *

public

removeComponent(componentClass: typeof Component, force: boolean)

Removes a given component, only possible until the entity is registered on the entity manager, after that use @see EntityManager.removeDynamicComponent

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(): import("../savegame/serialization").Schema source

Should return the serialization schema

Override:

BasicSerializableObject#getSchema

Return:

import("../savegame/serialization").Schema

See:

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 components: * source

The components of the entity

public layer: Layer source

On which layer this entity is

public registered: boolean source

Whether this entity was registered on the @see EntityManager so far

public root: * source

Handle to the global game root

public uid: number source

Internal entity unique id, set by the @see EntityManager

Public Methods

public addComponent(componentInstance: Component, force: boolean) source

Adds a new component, only possible until the entity is registered on the entity manager, after that use @see EntityManager.addDynamicComponent

Params:

NameTypeAttributeDescription
componentInstance Component
force boolean

Used by the entity manager. Internal parameter, do not change

public clone(): * source

Returns a clone of this entity

Return:

*

public drawDebugOverlays(parameters: DrawParameters) source

Draws the entity, to override use @see Entity.drawImpl

Params:

NameTypeAttributeDescription
parameters DrawParameters

public drawImpl(parameters: DrawParameters) source

override, should draw the entity

Params:

NameTypeAttributeDescription
parameters DrawParameters

public getId(): * source

Override:

BasicSerializableObject#getId

Return:

*

public removeComponent(componentClass: typeof Component, force: boolean) source

Removes a given component, only possible until the entity is registered on the entity manager, after that use @see EntityManager.removeDynamicComponent

Params:

NameTypeAttributeDescription
componentClass typeof Component
force boolean