Skip to content

Latest commit

 

History

History
151 lines (97 loc) · 3.52 KB

PickupComponent.md

File metadata and controls

151 lines (97 loc) · 3.52 KB

Class: PickupComponent

Types

<ComponentProps>

See <ComponentProps>


<PickupComponentProps>

A portion of the configuration object to pass to the PickupComponent constructor.

type GrabPointParameters = null | {
  grabPointIndex: number;
  lastLinearPosition: number;
  lastPosition: Position;
  lastRotation: Rotation;
};

type PickupComponentPropsV1 = {
  lastInteractorPlayerId?: number | undefined;
  dockedMemory?: never;
};

type PickupComponentPropsV2 = {
  lastInteractorPlayerId?: number | undefined;
  dockedMemory?: GrabPointParameters[] | undefined;
};

type PickupComponentProps = PickupComponentPropsV1 | PickupComponentPropsV2;

Since v1

  • lastInteractorPlayerId (optional, default 0) <number>

Since v2

  • lastInteractorPlayerId (optional, default 0) <number>
  • dockedMemory (optional, default []) <Array<GrabPointParameters>>

Constructors

new PickupComponent(props)

Creates a versioned Pickup component.

import { PickupComponent } from 'att-string-transcoder';

const componentVersion = 2;
const component = new PickupComponent({ version: componentVersion });

PickupComponent.fromBinary(reader, version)

See Component.fromBinary(reader, version)

Properties

Note that the following properties are sorted in order of appearance when decoding component binary data.

hash

See Component.hash


name

See Component.name


version

See Component.version


lastInteractorPlayerId

The ID of the player that last interacted with the prefab that this component is attached to.

  • Since: v1
  • <number>
import { PickupComponent } from 'att-string-transcoder';

const componentVersion = 2;
const component = new PickupComponent({ version: componentVersion });

const lastInteractorPlayerId = component.lastInteractorPlayerId;
// `lastInteractorPlayerId` is `0`

dockedMemory

An array of <GrabPointParameters> that describes the orientation of prefabs when they were docked. Used to control in which orientation pickups should be held when grabbed from the dock attached to the same prefab this component is attached to.

  • Since: v2
  • <number>
import { PickupComponent } from 'att-string-transcoder';

const componentVersion = 2;
const component = new PickupComponent({ version: componentVersion });

const dockedMemory = component.dockedMemory;
// `dockedMemory` is `[]`

Methods

toBinary(version?)

See Component.toBinary(version?)


write(writer, version?)

See Component.write(writer, version?)