@game-vir/entity - v15.1.1
    Preparing search index...

    Type Alias DefineEntityParams<EntityKey, Shape, Events>

    type DefineEntityParams<
        EntityKey extends string,
        Shape extends ShapeDefinition<AnyObject, any> | undefined,
        Events extends ReadonlyArray<Constructor<Event>> = never,
    > = {
        events?: Events;
        key: EntityKey;
        paramsMap?: ParamsMap<
            Shape extends ShapeDefinition<AnyObject, any>
                ? Shape["runtimeType"]
                : undefined,
        >;
        paramsShape: Shape;
    }

    Type Parameters

    • EntityKey extends string
    • Shape extends ShapeDefinition<AnyObject, any> | undefined
    • Events extends ReadonlyArray<Constructor<Event>> = never
    Index

    Properties

    events?: Events

    All events that this entity can emit, in addition to the default EntityDestroyEvent event.

    This key is used for deserialization of entities to track which class needs to be constructed. Do not use duplicate key strings across multiple entity classes.

    paramsMap?: ParamsMap<
        Shape extends ShapeDefinition<AnyObject, any>
            ? Shape["runtimeType"]
            : undefined,
    >

    A mapping of the entity's params object (defined by DefineEntityParams.paramsShape) keys to hitbox and/or view properties.

    undefined // no mapping
    
    paramsShape: Shape

    This should contain all parameters necessary to reconstruct this entity from scratch so it can be serialized, sent across the network in JSON format, then reconstructed on another device (for multiplayer support).

    Make sure to include entityPositionParamsShape if you want to include the base entity position parameters.