Skip to content

Class: MockCGameTask

Mock x-ray task object.

Implements

  • CGameTask

Constructors

Constructor

ts
new MockCGameTask(): MockCGameTask;

Returns

MockCGameTask

Methods

create()

ts
static create(): MockCGameTask;

Returns

MockCGameTask


mock()

ts
static mock(): CGameTask;

Returns

CGameTask

Properties

add_complete_func

ts
add_complete_func: Mock<() => void>;

Add a script predicate used to decide objective completion.

Remarks

Function names are resolved when a script-created objective is added to a task. Missing functions are logged and then skipped by the engine.

Param

function_name

Script function name.

Implementation of

ts
CGameTask.add_complete_func

add_complete_info

ts
add_complete_info: Mock<() => void>;

Require an info portion for objective completion.

Param

value

Info portion id.

Implementation of

ts
CGameTask.add_complete_info

add_fail_func

ts
add_fail_func: Mock<() => void>;

Add a script predicate used to decide objective failure.

Remarks

Function names are resolved when a script-created objective is added to a task. Missing functions are logged and then skipped by the engine.

Param

function_name

Script function name.

Implementation of

ts
CGameTask.add_fail_func

add_fail_info

ts
add_fail_info: Mock<() => void>;

Require an info portion for objective failure.

Param

value

Info portion id.

Implementation of

ts
CGameTask.add_fail_info

add_objective

ts
add_objective: Mock<() => void>;

Add an objective to this task.

Remarks

The native binding adopts the objective and copies its current data into the task objective list. Mutating the original objective after this call does not update the stored copy.

Param

objective

Objective to adopt into the task.

Implementation of

ts
CGameTask.add_objective

add_on_complete_func

ts
add_on_complete_func: Mock<() => void>;

Add a script function called after objective completion.

Remarks

Function names are resolved when a script-created objective is added to a task. Missing functions are logged and then skipped by the engine.

Param

function_name

Script function name.

Implementation of

ts
CGameTask.add_on_complete_func

add_on_complete_info

ts
add_on_complete_info: Mock<() => void>;

Give an info portion when objective completes.

Param

value

Info portion id.

Implementation of

ts
CGameTask.add_on_complete_info

add_on_fail_func

ts
add_on_fail_func: Mock<() => void>;

Add a script function called after objective failure.

Remarks

Function names are resolved when a script-created objective is added to a task. Missing functions are logged and then skipped by the engine.

Param

function_name

Script function name.

Implementation of

ts
CGameTask.add_on_fail_func

add_on_fail_info

ts
add_on_fail_info: Mock<() => void>;

Give an info portion when objective fails.

Param

value

Info portion id.

Implementation of

ts
CGameTask.add_on_fail_info

change_map_location

ts
change_map_location: Mock<() => void>;

Replace linked map location data and recreate the spot.

Remarks

Removes the current linked spot, sets the objective back to task.in_progress, then creates a new map spot.

Param

new_map_location

New map location type.

Param

new_map_object_id

New target object id.

Implementation of

ts
CGameTask.change_map_location

create_map_location

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

Create the linked map location if the objective has a spot type and object id.

Remarks

During load, the objective tries to reattach to an existing serializable spot owned by the task. During normal creation, it creates a new serializable spot and disables its pointer. The objective must already have a map location type and a valid game object id.

Param

on_load

Whether creation happens during save loading.

Implementation of

ts
CGameTask.create_map_location

def_ml_enabled

ts
def_ml_enabled: boolean = false;

Whether the default map location should be visible for this objective.

Remarks

This mirrors the native def_ml_enabled field used by loaded task objectives.

Implementation of

ts
CGameTask.def_ml_enabled

description

ts
description: string = "test_description";

get_description

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

Returns

Objective description text or string table id.

Implementation of

ts
CGameTask.get_description

get_icon_name

ts
get_icon_name: <T>() => T | null;

Type Parameters

Type Parameter
T extends string

Returns

T | null

Objective icon name, or null when none is set.

Implementation of

ts
CGameTask.get_icon_name

get_id

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

Returns

Task id.

Implementation of

ts
CGameTask.get_id

get_idx

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

Get objective index inside the parent task.

Returns

Objective index.

Implementation of

ts
CGameTask.get_idx

get_map_location

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

Returns

Target map location of task object.

Implementation of

ts
CGameTask.get_map_location

get_map_object_id

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

Returns

Target map object ID of task object.

Implementation of

ts
CGameTask.get_map_object_id

get_objective

ts
get_objective: Mock<() => CGameTask>;

Get objective by index.

Remarks

Index 0 returns the root objective. Other indices access native storage without a bounds check.

Param

objective_id

Objective index.

Returns

Objective instance.

Implementation of

ts
CGameTask.get_objective

get_objectives_cnt

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

Count task objectives including the root objective.

Returns

Objective count.

Implementation of

ts
CGameTask.get_objectives_cnt

get_priority

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

Returns

Task priority.

Implementation of

ts
CGameTask.get_priority

get_state

ts
get_state: Mock<() => TXR_TaskState>;

Returns

Current objective state.

Implementation of

ts
CGameTask.get_state

get_title

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

Returns

Objective title.

Implementation of

ts
CGameTask.get_title

get_type

ts
get_type: Mock<() => TXR_TaskType>;

Returns

Task type, such as task.storyline or task.additional.

Implementation of

ts
CGameTask.get_type

iconName

ts
iconName: string = "test_icon";

id

ts
id: string = "test_id";

load

ts
load: Mock<() => void>;

Load task data from configs.

Remarks

Reads from gameplay/game_tasks.xml. Task XML function names are resolved immediately.

Throws

If the task id is missing from game_tasks.xml or a referenced task function cannot be resolved.

Param

id

Task id.

Implementation of

ts
CGameTask.load

priority

ts
priority: number = -1;

remove_map_locations

ts
remove_map_locations: Mock<(flag: boolean) => void>;

Remove linked map locations.

Remarks

When notify is false, the linked map location is removed from the level map manager. The objective then clears its stored location type and object id.

Param

notify

Whether to notify task manager that the location was released.

Implementation of

ts
CGameTask.remove_map_locations

set_article_id

ts
set_article_id: Mock<() => void>;

Set encyclopedia article id unlocked with this objective.

Param

id

Encyclopedia article id.

Implementation of

ts
CGameTask.set_article_id

set_article_key

ts
set_article_key: Mock<() => void>;

Set encyclopedia article key for this objective.

Param

key

Article key.

Implementation of

ts
CGameTask.set_article_key

set_description

ts
set_description: Mock<(description: string) => void>;

Set objective description text.

Param

description

Description text or string table id.

Implementation of

ts
CGameTask.set_description

set_icon_name

ts
set_icon_name: Mock<(name: string) => void>;

Set objective icon texture.

Param

icon_name

Icon texture or string table id.

Implementation of

ts
CGameTask.set_icon_name

set_id

ts
set_id: Mock<(id: string) => void>;

Set task id.

Param

id

Task id.

Implementation of

ts
CGameTask.set_id

set_map_hint

ts
set_map_hint: Mock<(hint: string) => void>;

Set hint text for the linked map location.

Param

hint

Hint text or string table id.

Implementation of

ts
CGameTask.set_map_hint

set_map_location

ts
set_map_location: Mock<(location: string) => void>;

Set map spot type used by this objective.

Param

location

Map location type.

Implementation of

ts
CGameTask.set_map_location

set_map_object_id

ts
set_map_object_id: Mock<(id: number) => void>;

Set object id tracked by the objective map spot.

Param

id

Game object id.

Implementation of

ts
CGameTask.set_map_object_id

set_object_id

ts
set_object_id: Mock<() => void>;

Shadow of Chernobyl alias for set_map_object_id.

Param

id

Game object id.

Implementation of

ts
CGameTask.set_object_id

set_priority

ts
set_priority: Mock<(priority: number) => void>;

Set task priority used by task UI ordering.

Param

priority

New priority.

Implementation of

ts
CGameTask.set_priority

set_title

ts
set_title: Mock<(title: string) => void>;

Set objective title.

Param

title

Title text or string table id.

Implementation of

ts
CGameTask.set_title

set_type

ts
set_type: Mock<(type: number) => void>;

Set task type.

Param

type

Task type, such as task.storyline or task.additional.

Implementation of

ts
CGameTask.set_type

state

ts
state: TXR_TaskState = 1;

title

ts
title: string = "test_title";