Interface GrowOnlyValueSetComponentDefinition<T>

Type Parameters

  • T

Hierarchy

Properties

componentId: number
componentName: string
componentType: GrowOnlyValueSet
schema: ISchema<T>

Methods

  • Appends an element to the set.

    Parameters

    • entity: Entity

      Entity that will host the value

    • val: DeepReadonly<T>

      The final value. The Set will freeze the value, it won't be editable from the script.

    Returns DeepReadonlySet<T>

  • This function writes the whole state of the component into a ByteBuffer

    Parameters

    • buffer: ByteBuffer
    • Optional filterEntity: ((entity: Entity) => boolean)
        • (entity: Entity): boolean
        • Parameters

          Returns boolean

    Returns void

  • Marks the entity as deleted and signals it cannot be used ever again. It must clear the component internal state, produces a synchronization message to remove the component from the entity.

    Parameters

    • entity: Entity

      Entity ID that was deleted.

    • markAsDirty: boolean

    Returns void

  • Get the readonly component of the entity (to mutate it, use getMutable instead), throws an error if the entity doesn't have the component.

    Returns

    Parameters

    • entity: Entity

      Entity that will be used to get the component

    Returns DeepReadonlySet<T>

  • This function returns an iterable with all the CRDT updates that need to be broadcasted to other actors in the system. After returning, this function clears the internal dirty state. Updates are produced only once.

    Returns Iterable<CrdtMessageBody>

  • Get if the entity has this component

    Parameters

    • entity: Entity

      entity to test

    Returns boolean

  • Triggers the callback if the entity has changed on the last tick. If the value is undefined, the component was deleted.

    Parameters

    • entity: Entity
    • cb: ((value: undefined | T) => void)
        • (value: undefined | T): void
        • Parameters

          • value: undefined | T

          Returns void

    Returns void