Skip to content

Latest commit

 

History

History
288 lines (191 loc) · 7.09 KB

PopulationSpawnAreaComponent.md

File metadata and controls

288 lines (191 loc) · 7.09 KB

Class: PopulationSpawnAreaComponent

Types

<ComponentProps>

See <ComponentProps>


<PopulationSpawnAreaComponentProps>

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

type PopulationSaveDataChild = null | {
  index: number;
  pointIndex: number;
};

type PopulationSpawnAreaComponentPropsV2 = {
  definition?: number | undefined;
  isPopulationStarted?: boolean | undefined;
  children?: PopulationSaveDataChild[] | undefined;
  maxPopulation?: number | undefined;
  currentPopulation?: number | undefined;
  checkPopulationTime?: number | undefined;
  numberOfSpawnPoints?: number | undefined;
  startingPopulation?: number | undefined;
  isOneOff?: boolean | undefined;
};

type PopulationSpawnAreaComponentProps = PopulationSpawnAreaComponentPropsV2;

Since v2

  • definition (optional, default 30040) <PopulationDefinitionHash>
  • isPopulationStarted (optional, default true) <boolean>
  • children (optional, default []) <Array<PopulationSaveDataChild>>
  • maxPopulation (optional, default 20) <number>
  • currentPopulation (optional, default 5) <number>
  • checkPopulationTime (optional, default 852974979330) <number>
  • numberOfSpawnPoints (optional, default 40) <number>
  • startingPopulation (optional, default 5) <number>
  • isOneOff (optional, default false) <boolean>

Constructors

new PopulationSpawnAreaComponent(props)

Creates a versioned PopulationSpawnArea component.

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

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

PopulationSpawnAreaComponent.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


definition

The hash of the population to spawn in the SpawnArea component that is attached to the same prefab this component is attached to.

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

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

const definition = component.definition;
// `definition` is `30040`

isPopulationStarted

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

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

const isPopulationStarted = component.isPopulationStarted;
// `isPopulationStarted` is `true`

children

  • Since: v2
  • <Array<PopulationSaveDataChild>>
import { PopulationSpawnAreaComponent } from 'att-string-transcoder';

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

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

maxPopulation

The maximum amount of spawned prefabs in this population.

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

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

const maxPopulation = component.maxPopulation;
// `maxPopulation` is `20`

currentPopulation

The current amount of spawned prefabs in this population.

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

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

const currentPopulation = component.currentPopulation;
// `currentPopulation` is `5`

checkPopulationTime

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

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

const checkPopulationTime = component.checkPopulationTime;
// `checkPopulationTime` is `852974979330`

numberOfSpawnPoints

The amount of spawn locations inside the SpawnArea component that is attached to the same prefab this component is attached to.

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

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

const numberOfSpawnPoints = component.numberOfSpawnPoints;
// `numberOfSpawnPoints` is `40`

startingPopulation

The amount of spawned prefabs that this population begins with.

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

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

const startingPopulation = component.startingPopulation;
// `startingPopulation` is `5`

isOneOff

Whether any removed prefabs from this population shouldn't be replaced after the server's respawn timer has elapsed.

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

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

const isOneOff = component.isOneOff;
// `isOneOff` is `false`

Methods

toBinary(version?)

See Component.toBinary(version?)


write(writer, version?)

See Component.write(writer, version?)