Skip to content

Class: MockConsole ​

Mock of the X-Ray engine game console.

Implements ​

  • CConsole

Constructors ​

Constructor ​

ts
new MockConsole(): MockConsole;

Returns ​

MockConsole

Methods ​

create() ​

ts
static create(): MockConsole;

Returns ​

MockConsole


getInstance() ​

ts
static getInstance(): MockConsole;

Returns ​

MockConsole


getInstanceMock() ​

ts
static getInstanceMock(): CConsole;

Returns ​

CConsole


mock() ​

ts
static mock(): CConsole;

Returns ​

CConsole


reset() ​

ts
static reset(): void;

Returns ​

void

Properties ​

__name ​

ts
readonly __name: string = "CConsole";

LuaBind instance constructor name.

Implementation of ​

ts
CConsole.__name

execute ​

ts
execute: Mock<UnknownFunction>;

Execute console command immediately.

Remarks ​

Executes without adding the command to console history.

Param ​

command

Console command.

Implementation of ​

ts
CConsole.execute

execute_deferred ​

ts
execute_deferred: Mock<UnknownFunction>;

Queue console command for deferred execution.

Remarks ​

Schedules a KERNEL:console event, so the command runs later on the engine event queue.

Param ​

command

Console command.

Implementation of ​

ts
CConsole.execute_deferred

execute_script ​

ts
execute_script: Mock<UnknownFunction>;

Execute a config file through the console.

Remarks ​

The binding prepends cfg_load to the provided path.

Param ​

script

Config file path.

Implementation of ​

ts
CConsole.execute_script

get_bool ​

ts
get_bool: Mock<() => boolean>;

Read console variable as boolean.

Remarks ​

Returns false when the command is missing or is not a boolean-compatible mask/integer command.

Param ​

key

Console variable name.

Returns ​

Boolean value.

Implementation of ​

ts
CConsole.get_bool

get_float ​

ts
get_float: Mock<() => number>;

Read console variable as float.

Remarks ​

Returns 0 when the command is missing or is not a float command.

Param ​

key

Console variable name.

Returns ​

Float value.

Implementation of ​

ts
CConsole.get_float

get_integer ​

ts
get_integer: Mock<() => number>;

Read console variable as integer.

Remarks ​

Mask commands are returned as 0 or 1. Missing or incompatible commands return 0.

Param ​

key

Console variable name.

Returns ​

Integer value.

Implementation of ​

ts
CConsole.get_integer

get_string ​

ts
get_string: Mock<() => string>;

Read console variable as string.

Remarks ​

Returns null when the command does not exist.

Param ​

key

Console variable name.

Returns ​

String value.

Implementation of ​

ts
CConsole.get_string

get_token ​

ts
get_token: Mock<() => string>;

Read console variable token text.

Remarks ​

Uses the same engine path as get_string, so missing commands return null.

Param ​

key

Console variable name.

Returns ​

Token text.

Implementation of ​

ts
CConsole.get_token

hide ​

ts
hide: Mock<UnknownFunction>;

Hide the console window.

Implementation of ​

ts
CConsole.hide

show ​

ts
show: Mock<UnknownFunction>;

Show the console window.

Implementation of ​

ts
CConsole.show

instance ​

ts
static instance: MockConsole | null = null;