Skip to content

Class: CGameGraph

Game graph access binding.

Source

C++ class CGameGraph

Custom Constructor

CGameGraph

Remarks

Represents the global AI game graph. Validate ids before resolving vertices, and restore accessibility changes when they are only needed temporarily.

Constructors

Constructor

ts
new CGameGraph(): CGameGraph;

Returns

CGameGraph

Methods

accessible()

Call Signature

ts
accessible(vertexId: number): boolean;

Check whether a game-graph vertex can be used for AI travel.

Parameters
ParameterTypeDescription
vertexIdnumberGame-graph vertex id.
Returns

boolean

Whether the vertex is currently accessible.

Remarks

This is pathing accessibility, not whether the vertex exists.

Call Signature

ts
accessible(vertexId: number, value: boolean): void;

Mark a game-graph vertex as accessible or blocked.

Parameters
ParameterTypeDescription
vertexIdnumberGame-graph vertex id.
valuebooleanNew accessibility state.
Returns

void

Remarks

Blocking vertices affects AI travel through the game graph. Prefer narrow, reversible changes.


levels()

ts
levels(): LuaIterable<cse_abstract>;

Iterate over game levels registered in all.spawn.

Returns

LuaIterable<cse_abstract>

Level object on every iteration.

Remarks

Iterates graph-level descriptors, not currently loaded level objects.


valid_vertex_id()

ts
valid_vertex_id(vertexId: number): boolean;

Check whether a game-graph vertex id exists.

Parameters

ParameterTypeDescription
vertexIdnumberGame-graph vertex id.

Returns

boolean

Whether the id can be used with graph methods.


vertex()

ts
vertex(vertexId: number): GameGraph__CVertex;

Get a game-graph vertex by id.

Parameters

ParameterTypeDescription
vertexIdnumberGame-graph vertex id.

Returns

GameGraph__CVertex

Graph vertex descriptor.

Remarks

Call CGameGraph.valid_vertex_id first. Native code expects a valid id and can fail hard on invalid graph references.


vertex_id()

ts
vertex_id(vertex: GameGraph__CVertex): number;

Resolve a graph vertex back to its id.

Parameters

ParameterTypeDescription
vertexGameGraph__CVertexVertex returned by CGameGraph.vertex.

Returns

number

Game-graph vertex id.

Remarks

Pass only vertices returned by this graph instance.