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
new MockPatrol(name: string): MockPatrol;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
MockPatrol
Methods
count()
count(): number;Returns
number
Number of points in the patrol path.
Implementation of
patrol.countflag()
flag(index: number, flag: string | number): boolean;Check a patrol point flag by numeric index.
Parameters
| Parameter | Type |
|---|---|
index | number |
flag | string | number |
Returns
boolean
Whether the flag is set.
Implementation of
patrol.flagflags()
flags(index: number): flags32;Get all flags for a patrol point.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
flags32
Point flags.
Implementation of
patrol.flagsgame_vertex_id()
game_vertex_id(index: number): number;Get game graph vertex id for a patrol point.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
number
Game graph vertex id.
Implementation of
patrol.game_vertex_idget_nearest()
get_nearest(vector: vector): number;Find nearest patrol point to a position.
Parameters
| Parameter | Type | Description |
|---|---|---|
vector | vector | Position to test. |
Returns
number
Patrol point index.
Implementation of
patrol.get_nearestindex()
index(name: string): number;Find patrol point index by name.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
number
Patrol point index.
Implementation of
patrol.indexlevel_vertex_id()
level_vertex_id(index: number): number;Get level vertex id for a patrol point.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
number
Level vertex id.
Implementation of
patrol.level_vertex_idname()
name(index: number): string;Get patrol point name.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
string
Point name.
Implementation of
patrol.namepoint()
point(index: number): MockVector;Get patrol point position.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Patrol point index. |
Returns
Point position.
Implementation of
patrol.pointterminal()
terminal(index: number): boolean;Check whether a patrol point is terminal.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
boolean
Whether the point ends the route.
Implementation of
patrol.terminalcreate()
static create(name: string): MockPatrol;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
MockPatrol
has()
static has(name: string): boolean;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
boolean
Whether a patrol with the given name is registered (used by the level mock's patrol_path_exists).
mock()
static mock(name: string): patrol;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
patrol
setup()
static setup(patrols: Record<string, IPatrolMock>): void;Inject the registry of named patrol mocks (by reference). Call once at test setup.
Parameters
| Parameter | Type |
|---|---|
patrols | Record<string, IPatrolMock> |
Returns
void
Properties
__name
__name: string = "patrol";LuaBind instance constructor name.
Implementation of
patrol.__namepatrolMock
patrolMock: IPatrolMock;