Skip to content

Class: MockPatrol

Mock generic patrol object.

The patrol point data is engine test-domain, so it is injected via MockPatrol.setup rather than bundled.

Implements

  • patrol

Constructors

Constructor

ts
new MockPatrol(name: string): MockPatrol;

Parameters

ParameterType
namestring

Returns

MockPatrol

Methods

count()

ts
count(): number;

Returns

number

Number of points in the patrol path.

Implementation of

ts
patrol.count

flag()

ts
flag(index: number, flag: string | number): boolean;

Check a patrol point flag by numeric index.

Parameters

ParameterType
indexnumber
flagstring | number

Returns

boolean

Whether the flag is set.

Implementation of

ts
patrol.flag

flags()

ts
flags(index: number): flags32;

Get all flags for a patrol point.

Parameters

ParameterType
indexnumber

Returns

flags32

Point flags.

Implementation of

ts
patrol.flags

game_vertex_id()

ts
game_vertex_id(index: number): number;

Get game graph vertex id for a patrol point.

Parameters

ParameterType
indexnumber

Returns

number

Game graph vertex id.

Implementation of

ts
patrol.game_vertex_id

get_nearest()

ts
get_nearest(vector: vector): number;

Find nearest patrol point to a position.

Parameters

ParameterTypeDescription
vectorvectorPosition to test.

Returns

number

Patrol point index.

Implementation of

ts
patrol.get_nearest

index()

ts
index(name: string): number;

Find patrol point index by name.

Parameters

ParameterType
namestring

Returns

number

Patrol point index.

Implementation of

ts
patrol.index

level_vertex_id()

ts
level_vertex_id(index: number): number;

Get level vertex id for a patrol point.

Parameters

ParameterType
indexnumber

Returns

number

Level vertex id.

Implementation of

ts
patrol.level_vertex_id

name()

ts
name(index: number): string;

Get patrol point name.

Parameters

ParameterType
indexnumber

Returns

string

Point name.

Implementation of

ts
patrol.name

point()

ts
point(index: number): MockVector;

Get patrol point position.

Parameters

ParameterTypeDescription
indexnumberPatrol point index.

Returns

MockVector

Point position.

Implementation of

ts
patrol.point

terminal()

ts
terminal(index: number): boolean;

Check whether a patrol point is terminal.

Parameters

ParameterType
indexnumber

Returns

boolean

Whether the point ends the route.

Implementation of

ts
patrol.terminal

create()

ts
static create(name: string): MockPatrol;

Parameters

ParameterType
namestring

Returns

MockPatrol


has()

ts
static has(name: string): boolean;

Parameters

ParameterType
namestring

Returns

boolean

Whether a patrol with the given name is registered (used by the level mock's patrol_path_exists).


mock()

ts
static mock(name: string): patrol;

Parameters

ParameterType
namestring

Returns

patrol


setup()

ts
static setup(patrols: Record<string, IPatrolMock>): void;

Inject the registry of named patrol mocks (by reference). Call once at test setup.

Parameters

ParameterType
patrolsRecord<string, IPatrolMock>

Returns

void

Properties

__name

ts
__name: string = "patrol";

LuaBind instance constructor name.

Implementation of

ts
patrol.__name

patrolMock

ts
patrolMock: IPatrolMock;