Class: MockCGameTask
Mock x-ray task object.
Implements
CGameTask
Constructors
Constructor
new MockCGameTask(): MockCGameTask;Returns
MockCGameTask
Methods
create()
static create(): MockCGameTask;Returns
MockCGameTask
mock()
static mock(): CGameTask;Returns
CGameTask
Properties
add_complete_func
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
CGameTask.add_complete_funcadd_complete_info
add_complete_info: Mock<() => void>;Require an info portion for objective completion.
Param
value
Info portion id.
Implementation of
CGameTask.add_complete_infoadd_fail_func
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
CGameTask.add_fail_funcadd_fail_info
add_fail_info: Mock<() => void>;Require an info portion for objective failure.
Param
value
Info portion id.
Implementation of
CGameTask.add_fail_infoadd_objective
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
CGameTask.add_objectiveadd_on_complete_func
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
CGameTask.add_on_complete_funcadd_on_complete_info
add_on_complete_info: Mock<() => void>;Give an info portion when objective completes.
Param
value
Info portion id.
Implementation of
CGameTask.add_on_complete_infoadd_on_fail_func
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
CGameTask.add_on_fail_funcadd_on_fail_info
add_on_fail_info: Mock<() => void>;Give an info portion when objective fails.
Param
value
Info portion id.
Implementation of
CGameTask.add_on_fail_infochange_map_location
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
CGameTask.change_map_locationcreate_map_location
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
CGameTask.create_map_locationdef_ml_enabled
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
CGameTask.def_ml_enableddescription
description: string = "test_description";get_description
get_description: Mock<() => string>;Returns
Objective description text or string table id.
Implementation of
CGameTask.get_descriptionget_icon_name
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
CGameTask.get_icon_nameget_id
get_id: Mock<() => string>;Returns
Task id.
Implementation of
CGameTask.get_idget_idx
get_idx: Mock<() => number>;Get objective index inside the parent task.
Returns
Objective index.
Implementation of
CGameTask.get_idxget_map_location
get_map_location: Mock<() => string>;Returns
Target map location of task object.
Implementation of
CGameTask.get_map_locationget_map_object_id
get_map_object_id: Mock<() => number>;Returns
Target map object ID of task object.
Implementation of
CGameTask.get_map_object_idget_objective
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
CGameTask.get_objectiveget_objectives_cnt
get_objectives_cnt: Mock<() => number>;Count task objectives including the root objective.
Returns
Objective count.
Implementation of
CGameTask.get_objectives_cntget_priority
get_priority: Mock<() => number>;Returns
Task priority.
Implementation of
CGameTask.get_priorityget_state
get_state: Mock<() => TXR_TaskState>;Returns
Current objective state.
Implementation of
CGameTask.get_stateget_title
get_title: Mock<() => string>;Returns
Objective title.
Implementation of
CGameTask.get_titleget_type
get_type: Mock<() => TXR_TaskType>;Returns
Task type, such as task.storyline or task.additional.
Implementation of
CGameTask.get_typeiconName
iconName: string = "test_icon";id
id: string = "test_id";load
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
CGameTask.loadpriority
priority: number = -1;remove_map_locations
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
CGameTask.remove_map_locationsset_article_id
set_article_id: Mock<() => void>;Set encyclopedia article id unlocked with this objective.
Param
id
Encyclopedia article id.
Implementation of
CGameTask.set_article_idset_article_key
set_article_key: Mock<() => void>;Set encyclopedia article key for this objective.
Param
key
Article key.
Implementation of
CGameTask.set_article_keyset_description
set_description: Mock<(description: string) => void>;Set objective description text.
Param
description
Description text or string table id.
Implementation of
CGameTask.set_descriptionset_icon_name
set_icon_name: Mock<(name: string) => void>;Set objective icon texture.
Param
icon_name
Icon texture or string table id.
Implementation of
CGameTask.set_icon_nameset_id
set_id: Mock<(id: string) => void>;Set task id.
Param
id
Task id.
Implementation of
CGameTask.set_idset_map_hint
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
CGameTask.set_map_hintset_map_location
set_map_location: Mock<(location: string) => void>;Set map spot type used by this objective.
Param
location
Map location type.
Implementation of
CGameTask.set_map_locationset_map_object_id
set_map_object_id: Mock<(id: number) => void>;Set object id tracked by the objective map spot.
Param
id
Game object id.
Implementation of
CGameTask.set_map_object_idset_object_id
set_object_id: Mock<() => void>;Shadow of Chernobyl alias for set_map_object_id.
Param
id
Game object id.
Implementation of
CGameTask.set_object_idset_priority
set_priority: Mock<(priority: number) => void>;Set task priority used by task UI ordering.
Param
priority
New priority.
Implementation of
CGameTask.set_priorityset_title
set_title: Mock<(title: string) => void>;Set objective title.
Param
title
Title text or string table id.
Implementation of
CGameTask.set_titleset_type
set_type: Mock<(type: number) => void>;Set task type.
Param
type
Task type, such as task.storyline or task.additional.
Implementation of
CGameTask.set_typestate
state: TXR_TaskState = 1;title
title: string = "test_title";