Class: MockCGameGraph
Mock of the X-Ray engine game_graph() singleton.
Implements
CGameGraph
Constructors
Constructor
new MockCGameGraph(): MockCGameGraph;Returns
MockCGameGraph
Methods
accessible()
Call Signature
accessible(vertexId: number): boolean;Check whether a game-graph vertex can be used for AI travel.
Parameters
| Parameter | Type | Description |
|---|---|---|
vertexId | number | Game-graph vertex id. |
Returns
boolean
Whether the vertex is currently accessible.
Remarks
This is pathing accessibility, not whether the vertex exists.
Implementation of
CGameGraph.accessibleCall Signature
accessible(vertexId: number, value: boolean): void;Mark a game-graph vertex as accessible or blocked.
Parameters
| Parameter | Type | Description |
|---|---|---|
vertexId | number | Game-graph vertex id. |
value | boolean | New accessibility state. |
Returns
void
Remarks
Blocking vertices affects AI travel through the game graph. Prefer narrow, reversible changes.
Implementation of
CGameGraph.accessiblevalid_vertex_id()
valid_vertex_id(vertexId: number): boolean;Check whether a game-graph vertex id exists.
Parameters
| Parameter | Type | Description |
|---|---|---|
vertexId | number | Game-graph vertex id. |
Returns
boolean
Whether the id can be used with graph methods.
Implementation of
CGameGraph.valid_vertex_idvertex_id()
vertex_id(vertex: GameGraph__CVertex): number;Resolve a graph vertex back to its id.
Parameters
| Parameter | Type | Description |
|---|---|---|
vertex | GameGraph__CVertex | Vertex returned by CGameGraph.vertex. |
Returns
number
Game-graph vertex id.
Remarks
Pass only vertices returned by this graph instance.
Implementation of
CGameGraph.vertex_idcreate()
static create(): MockCGameGraph;Returns
MockCGameGraph
getInstance()
static getInstance(): MockCGameGraph;Returns
MockCGameGraph
mock()
static mock(): CGameGraph;Returns
CGameGraph
Properties
accessibleVertices
accessibleVertices: Map<number, boolean>;levels
levels: Mock<() => LuaIterable<cse_abstract, undefined>>;Iterate over game levels registered in all.spawn.
Remarks
Iterates graph-level descriptors, not currently loaded level objects.
Returns
Level object on every iteration.
Implementation of
CGameGraph.levelsvertex
vertex: Mock<(vertexId: number) => MockCVertex>;Get a game-graph vertex by id.
Remarks
Call CGameGraph.valid_vertex_id first. Native code expects a valid id and can fail hard on invalid graph references.
Param
vertexId
Game-graph vertex id.
Returns
Graph vertex descriptor.
Implementation of
CGameGraph.vertexinstance
static instance: MockCGameGraph | null = null;registry
static registry: Record<number, MockCVertex> = {};