Interface: IXR_level
Global helpers for the currently loaded level.
This namespace covers object lookup, time/weather control, navigation queries, map spots, and effectors.
Source
namespace level
Methods
add_call()
Call Signature
add_call(
this: void,
condition: (this: void) => boolean,
action: (this: void) => boolean): void;Register a conditional level callback.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
condition | (this: void) => boolean | Callback polled by the engine. |
action | (this: void) => boolean | Callback called when the condition is satisfied. |
Returns
void
Remarks
The physics commander polls this callback pair. Remove it with the same condition and action callbacks when the owner no longer needs it.
Call Signature
add_call(
this: void,
object: object,
condition: (this: void) => boolean,
action: (this: void) => boolean): void;Register a conditional level callback owned by an object.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object | object | Owner object used for later removal. |
condition | (this: void) => boolean | Callback polled by the engine. |
action | (this: void) => boolean | Callback called when the condition is satisfied. |
Returns
void
Remarks
The owner is used only for callback lookup and bulk removal. Keep the object alive while the callback can run.
Call Signature
add_call(
this: void,
object: object,
condition: string,
action: string): void;Register named object methods as a conditional level callback.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object | object | Owner object used for callback lookup and removal. |
condition | string | Method name used as condition callback. |
action | string | Method name called when the condition is satisfied. |
Returns
void
Remarks
This overload registers a unique callback pair for the object and method names.
add_cam_effector()
add_cam_effector(
this: void,
effect: string,
id: number,
is_cyclic: boolean,
callback: string): number;Start a camera effector.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
effect | string | Camera effector animation file. |
id | number | Effector id used for replacement and removal. |
is_cyclic | boolean | Whether the effector loops. |
callback | string | Lua callback name called when the effector finishes. |
Returns
number
Effector animation length.
Remarks
Requires an actor. The binding adds the effector to Actor().Cameras().
add_cam_effector2()
add_cam_effector2(
this: void,
effect: string,
id: number,
is_cyclic: boolean,
callback: string,
camera_fov?: number): number;Start a camera effector with custom field of view.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
effect | string | Camera effector animation file. |
id | number | Effector id used for replacement and removal. |
is_cyclic | boolean | Whether the effector loops. |
callback | string | Lua callback name called when the effector finishes. |
camera_fov? | number | Optional field of view for the effector. |
Returns
number
Effector animation length.
Since
OpenXRay 2019-05-07, 2d1b946a, PR #382
Remarks
Requires an actor. The binding adds the effector to Actor().Cameras().
add_complex_effector()
add_complex_effector(
this: void,
section: string,
id: number): void;Start a named complex effector.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
section | string | Effector section name. |
id | number | Effector id used for replacement and removal. |
Returns
void
Remarks
Requires an actor. The effector is attached to the current actor object.
add_dialog_to_render()
add_dialog_to_render(this: void, window: CUIDialogWnd): void;Add a dialog window to the render list.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
window | CUIDialogWnd | Dialog window to render. |
Returns
void
add_pp_effector()
add_pp_effector(
this: void,
file_name: string,
id: number,
is_cyclic: boolean): void;Start a post-process effector.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
file_name | string | Post-process effector file. |
id | number | Effector id used for replacement and removal. |
is_cyclic | boolean | Whether the effector loops. |
Returns
void
Remarks
Requires an actor. The effector is attached to the actor camera manager.
change_game_time()
change_game_time(
this: void,
days: number,
hours: number,
minutes: number): void;Move game time forward.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
days | number | Days to add. |
hours | number | Hours to add. |
minutes | number | Minutes to add. |
Returns
void
Remarks
Works only on a single-player server with ALife available. Otherwise the binding returns without changing time.
check_object()
check_object(this: void, object: game_object): void;Validate a game object pointer in the engine.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object | game_object | Object to check. |
Returns
void
Remarks
Exported only in debug builds.
client_spawn_manager()
client_spawn_manager(this: void): client_spawn_manager;Get the level client spawn manager.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Client spawn manager.
debug_actor()
debug_actor(this: void): Nullable<game_object>;Get the current actor object used by debug helpers.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Nullable<game_object>
Actor game object, or null when no actor is current.
Source
src/xrGame/level_script.cpp, debug_actor binding.
Remarks
Exported only in debug builds. The native helper logs a warning on first use and returns null when the current level entity is not an actor.
debug_object()
debug_object(this: void, name: string): Nullable<game_object>;Find an online object by debug name.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
name | string | Runtime object name. |
Returns
Nullable<game_object>
Matching online object, or null when no object with this name is loaded.
Source
src/xrGame/level_script.cpp, debug_object binding.
Remarks
Exported only in debug builds. The native helper logs a warning on first use and searches loaded level objects by runtime name.
disable_input()
disable_input(this: void): void;Disable player input.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
void
Remarks
Does nothing while the actor exists and permanent god mode is enabled.
enable_input()
enable_input(this: void): void;Enable player input.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
void
environment()
environment(this: void): CEnvironment;Get the active weather environment controller.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Engine-owned environment controller.
game_id()
game_id(this: void): TXR_EGameID;Get current game state id.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Game id bitmask.
get_active_cam()
get_active_cam(this: void): number;Get active camera id.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Camera id.
Since
OpenXRay 2015-07-07, 6e703b4c
Remarks
Returns 255 when the current view entity is not an actor.
get_actor_body_state()
get_actor_body_state(this: void): number;Get current actor body state.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Current actor body state id, or 0 when unavailable.
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrGame/level_script.cpp, level.get_actor_body_state binding.
Remarks
Returns 0 when there is no actor object.
get_actor_body_state_wishful()
get_actor_body_state_wishful(this: void): number;Get body state currently requested by actor movement.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Desired actor body state id, or 0 when unavailable.
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrGame/level_script.cpp, level.get_actor_body_state_wishful binding.
Remarks
Returns 0 when there is no actor object.
get_bounding_volume()
get_bounding_volume(this: void): Fbox;Get the level bounding box.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Level bounds.
get_fov()
get_fov(this: void): number;Get global world field of view.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Current world FOV value.
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrGame/level_script.cpp, level.get_fov binding.
get_game_difficulty()
get_game_difficulty(this: void): TXR_game_difficulty;Get active single-player difficulty.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Current game_difficulty enum value.
Source
src/xrGame/level_script.cpp, get_game_difficulty.
get_ph_time_factor()
get_ph_time_factor(this: void): number;Get the current physics time factor.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Physics simulation time factor.
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrPhysics/PHWorldScript.cpp, level.get_ph_time_factor binding.
get_snd_volume()
get_snd_volume(this: void): number;Get sound volume.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Sound volume.
get_start_time()
get_start_time(this: void): CTime;Get the level start game time.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Start game time value.
Since
OpenXRay 2022-08-09, a2d264fc, PR #1032
Source
src/xrGame/level_script.cpp, level.get_start_time binding.
get_target_dist()
get_target_dist(this: void): number;Get distance to the object or surface under the crosshair.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Target distance.
Since
OpenXRay 2017-08-15, 565b39e5
get_target_element()
get_target_element(this: void): number;Get targeted model element under the crosshair.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Target element id.
Since
OpenXRay 2015-06-03, 7213550c
Remarks
Returns 0 when the current ray query has no model element.
get_target_obj()
get_target_obj(this: void): Nullable<game_object>;Get the object under the crosshair.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Nullable<game_object>
Target object, or null when nothing is targeted.
Since
OpenXRay 2017-08-15, 565b39e5
Source
src/xrGame/level_script.cpp, g_get_target_obj.
Remarks
Reads the current HUD ray query. Returns null when the ray hit has no object or the hit object is not a CGameObject.
get_time_days()
get_time_days(this: void): number;Get current game day count.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Current day count.
get_time_factor()
get_time_factor(this: void): number;Get game time speed multiplier.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Time factor.
get_time_hours()
get_time_hours(this: void): number;Get current game hour.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Hour of day.
get_time_minutes()
get_time_minutes(this: void): number;Get current game minute.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Minute of hour.
get_weather()
get_weather(this: void): string;Get current weather cycle name.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
string
Weather name.
get_wfx_time()
get_wfx_time(this: void): number;Get active weather effect time.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Weather effect time.
hide_indicators()
hide_indicators(this: void): void;Hide HUD indicators.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
void
Remarks
Also enables the runtime god-mode flag used while HUD indicators are hidden.
hide_indicators_safe()
hide_indicators_safe(this: void): void;Hide HUD indicators if the HUD is available.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
void
Remarks
Also enables the runtime god-mode flag used while HUD indicators are hidden.
hide_minimap()
hide_minimap(this: void): void;Hide the HUD minimap.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
void
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrGame/level_script.cpp, level.hide_minimap binding.
Remarks
Requires an active game UI and main in-game HUD window.
high_cover_in_direction()
high_cover_in_direction(
this: void,
vertex_id: number,
direction: vector): number;Sample high cover from a level vertex in a direction.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
vertex_id | number | Level vertex id. |
direction | vector | Direction to sample. |
Returns
number
Cover value.
is_wfx_playing()
is_wfx_playing(this: void): boolean;Check whether a weather effect is playing.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
boolean
Whether a weather effect is active.
iterate_online_objects()
iterate_online_objects(this: void, cb: (this: void, object: game_object) => boolean | void): void;Iterate objects currently online on the level.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
cb | (this: void, object: game_object) => boolean | void | Callback called for each online object. |
Returns
void
Since
OpenXRay 2019-04-28, 13c5c022
iterate_sounds()
Call Signature
iterate_sounds(
this: void,
section: string,
max_count: number,
cb: (this: void, name: string) => void): void;Iterate sounds from a sound collection.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
section | string | Sound collection section. |
max_count | number | Numbered suffixes to probe for each base name. |
cb | (this: void, name: string) => void | Callback called with each sound name. |
Returns
void
Remarks
section may contain a comma-separated list of base names. The callback receives each existing sound name found in $game_sounds$, including numbered variants from 0 up to max_count - 1.
Call Signature
iterate_sounds(
this: void,
section: string,
max_count: number,
object: object,
cb: (this: void, name: string) => void): void;Iterate sounds from a sound collection with an owner object.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
section | string | Sound collection section. |
max_count | number | Numbered suffixes to probe for each base name. |
object | object | Owner object. |
cb | (this: void, name: string) => void | Callback called with each sound name. |
Returns
void
Remarks
section may contain a comma-separated list of base names. The callback receives each existing sound name found in $game_sounds$, including numbered variants from 0 up to max_count - 1.
low_cover_in_direction()
low_cover_in_direction(
this: void,
vertex_id: number,
direction: vector): number;Sample low cover from a level vertex in a direction.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
vertex_id | number | Level vertex id. |
direction | vector | Direction to sample. |
Returns
number
Cover value.
main_input_receiver()
main_input_receiver(this: void): CUIDialogWnd;Get the main UI input receiver.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Active dialog window.
map_add_object_spot()
map_add_object_spot(
this: void,
object_id: number,
spot_type: string,
hint: string): void;Add a PDA map spot for an object.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object_id | number | Target object id. |
spot_type | string | Spot type from map spot config. |
hint | string | Spot hint text. |
Returns
void
map_add_object_spot_ser()
map_add_object_spot_ser(
this: void,
object_id: number,
spot_type: string,
hint: string): void;Add a serialized PDA map spot for an object.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object_id | number | Target object id. |
spot_type | string | Spot type from map spot config. |
hint | string | Spot hint text. |
Returns
void
map_change_spot_hint()
map_change_spot_hint(
this: void,
object_id: number,
spot_type: string,
hint: string): void;Change hint text for an object map spot.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object_id | number | Target object id. |
spot_type | string | Spot type from map spot config. |
hint | string | New hint text. |
Returns
void
Remarks
Does nothing when the object does not have a matching map spot.
map_has_object_spot()
map_has_object_spot(
this: void,
object_id: number,
spot_type: string): number;Check if an object has a map spot registered with provided selector.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object_id | number | Game object id to check. |
spot_type | string | Map spot type. |
Returns
number
Non-zero count when the spot exists.
map_remove_object_spot()
map_remove_object_spot(
this: void,
object_id: number,
spot_type: string): void;Remove an object map spot if it exists.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object_id | number | Game object id to update. |
spot_type | string | Map spot type. |
Returns
void
minimap_shown()
minimap_shown(this: void): boolean;Check whether the HUD minimap is visible.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
boolean
Whether the minimap is currently shown.
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrGame/level_script.cpp, level.minimap_shown binding.
Remarks
Requires an active game UI and main in-game HUD window.
name()
name<T>(this: void): T;Get current level name.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends string | string |
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
T
Level name.
object_by_id()
object_by_id(this: void, object_id: number): Nullable<game_object>;Find an online object by runtime id.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object_id | number | Runtime network object id. |
Returns
Nullable<game_object>
Matching online object, or null when it is not loaded on the level.
Source
src/xrGame/level_script.cpp, object_by_id binding.
Remarks
Looks up the object in Level().Objects by network id. This does not search offline ALife objects.
patrol_path_exists()
patrol_path_exists(this: void, path_name: string): boolean;Check whether a patrol path exists on this level.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
path_name | string | Patrol path name. |
Returns
boolean
Whether the patrol path exists.
physics_world()
physics_world(this: void): physics_world;Get the level physics world.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
Physics world object.
prefetch_sound()
prefetch_sound(this: void, sound: string): void;Preload a sound resource.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
sound | string | Sound resource name. |
Returns
void
present()
present(this: void): boolean;Check whether a game level is loaded.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
boolean
Whether a level is present.
rain_factor()
rain_factor(this: void): number;Get current rain intensity.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
number
Rain intensity, or 0 when no rain is active.
ray_pick()
ray_pick(
this: void,
position: vector,
direction: vector,
range: number,
target: TXR_rq_target,
result: rq_result,
ignore_object: Nillable<game_object>): boolean;Cast a ray through the level collision world.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
position | vector | Ray origin. |
direction | vector | Ray direction. |
range | number | Ray range. |
target | TXR_rq_target | Ray query target flags. |
result | rq_result | Ray query result placeholder. |
ignore_object | Nillable<game_object> | Object ignored by the query, or null. |
Returns
boolean
Whether the ray hit anything.
Remarks
result is updated only when this returns true. Use rq_target flags to choose static, object, or dynamic collision targets.
remove_call()
Call Signature
remove_call(
this: void,
condition: (this: void) => boolean,
action: (this: void) => void): void;Remove a conditional level callback.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
condition | (this: void) => boolean | Condition callback originally registered. |
action | (this: void) => void | Action callback originally registered. |
Returns
void
Remarks
The callbacks must match the original registered pair.
Call Signature
remove_call(
this: void,
object: object,
condition: (this: void) => boolean,
action: (this: void) => void): void;Remove an object-owned conditional level callback.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object | object | Owner object. |
condition | (this: void) => boolean | Condition callback originally registered. |
action | (this: void) => void | Action callback originally registered. |
Returns
void
Remarks
The owner and callbacks must match the original registered pair.
Call Signature
remove_call(
this: void,
object: object,
condition: string,
action: string): void;Remove named object methods registered as a level callback.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object | object | Owner object. |
condition | string | Condition method name. |
action | string | Action method name. |
Returns
void
Remarks
The owner and method names must match the original registered pair.
remove_calls_for_object()
remove_calls_for_object(this: void, object: object): void;Remove all registered level callbacks for an object.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
object | object | Owner object. |
Returns
void
remove_cam_effector()
remove_cam_effector(this: void, id: number): void;Stop a camera effector.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
id | number | Effector id. |
Returns
void
Remarks
Requires an actor. The binding removes the effector from Actor().Cameras().
remove_complex_effector()
remove_complex_effector(this: void, id: number): void;Stop a complex effector.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
id | number | Effector id. |
Returns
void
Remarks
Requires an actor. The binding removes the effector from the current actor object.
remove_dialog_to_render()
remove_dialog_to_render(this: void, window: CUIDialogWnd): void;Remove a dialog window from the render list.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
window | CUIDialogWnd | Dialog window to stop rendering. |
Returns
void
remove_pp_effector()
remove_pp_effector(this: void, id: number): void;Stop a post-process effector.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
id | number | Effector id. |
Returns
void
Remarks
Requires an actor. Does nothing when no post-process effector exists for the id.
send()
send(
this: void,
packet: net_packet,
reliable: boolean,
sequential: boolean,
high_priority: boolean,
send_immediately: boolean): void;Send a network packet through the level.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
packet | net_packet | Packet to send. |
reliable | boolean | Whether the packet is reliable. |
sequential | boolean | Whether the packet is sequential. |
high_priority | boolean | Whether to send with high priority. |
send_immediately | boolean | Whether to flush immediately. |
Returns
void
Since
OpenXRay 2017-08-15, 565b39e5
set_active_cam()
set_active_cam(this: void, id: number): void;Set active camera id.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
id | number | Camera id. |
Returns
void
Since
OpenXRay 2015-07-07, 6e703b4c
Remarks
Does nothing when the current view entity is not an actor or when the id is outside the actor camera range.
set_fov()
set_fov(this: void, fov: number): void;Set global world field of view.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
fov | number | World FOV value to assign. |
Returns
void
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrGame/level_script.cpp, level.set_fov binding.
set_game_difficulty()
set_game_difficulty(this: void, difficulty: TXR_game_difficulty): void;Set active single-player difficulty.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
difficulty | TXR_game_difficulty | game_difficulty enum value. |
Returns
void
Source
src/xrGame/level_script.cpp, set_game_difficulty.
Remarks
Updates the global difficulty and notifies the active single-player game state. The native binding verifies that the current game state is game_cl_Single.
Throws
If the active game state is not single-player.
set_ph_time_factor()
set_ph_time_factor(this: void, factor: number): number;Set physics simulation time factor.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
factor | number | Physics time factor to assign. |
Returns
number
Applied physics time factor.
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrPhysics/PHWorldScript.cpp, level.set_ph_time_factor binding.
set_pp_effector_factor()
set_pp_effector_factor(
this: void,
id: number,
factor: number,
speed?: number): void;Set a post-process effector factor.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
id | number | Effector id. |
factor | number | Target factor. |
speed? | number | Optional transition speed. |
Returns
void
Remarks
Requires an actor. Does nothing when no post-process effector exists for the id.
set_snd_volume()
set_snd_volume(this: void, volume: number): void;Set sound volume.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
volume | number | Sound volume. |
Returns
void
Remarks
The engine clamps the value to the 0..1 range.
set_time_factor()
set_time_factor(this: void, factor: number): void;Set game time speed multiplier.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
factor | number | Time factor. |
Returns
void
Remarks
Works only on the server and outside editor mode. Otherwise the binding returns without changing the time factor.
set_weather()
set_weather(
this: void,
weather_name: string,
is_forced: boolean): void;Change active game weather.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
weather_name | string | Name of weather config to apply. |
is_forced | boolean | Whether weather change should be forced. |
Returns
void
Remarks
Does nothing in editor mode.
set_weather_fx()
set_weather_fx(this: void, weather_fx_name: string): boolean;Start a weather effect by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
weather_fx_name | string | Weather effect config name. |
Returns
boolean
Whether the effect started.
Remarks
Returns false in editor mode.
show_indicators()
show_indicators(this: void): void;Show HUD indicators.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
void
Remarks
Clears the runtime god-mode flag set by hide_indicators() and hide_indicators_safe().
show_minimap()
show_minimap(this: void): void;Show the HUD minimap.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
void
Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Source
src/xrGame/level_script.cpp, level.show_minimap binding.
Remarks
Requires an active game UI and main in-game HUD window.
show_weapon()
show_weapon(this: void, is_visible: boolean): void;Show or hide actor weapon.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
is_visible | boolean | Whether weapon should be visible. |
Returns
void
Remarks
Does nothing while the actor exists and permanent god mode is enabled.
spawn_item()
spawn_item(
this: void,
section: string,
position: vector,
level_vertex_id: number,
parent_id: number,
return_item: boolean): void;Spawn an item on the level.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
section | string | Item section name. |
position | vector | Spawn position. |
level_vertex_id | number | Target level vertex. |
parent_id | number | Parent object id, or 0xffff for none. |
return_item | boolean | Engine spawn flag passed through to Level().spawn_item. |
Returns
void
Since
OpenXRay 2015-01-18, 3ee7401d
Remarks
Uses the level spawn path, which is suitable for sections that are unsafe to create through alife():create(), such as bolts, phantoms, and ammo.
spawn_phantom()
spawn_phantom(this: void, position: vector): void;Spawn a phantom at a position.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
position | vector | Spawn position. |
Returns
void
start_stop_menu()
start_stop_menu(
this: void,
dialog: CUIDialogWnd,
should_hide_indicators: boolean): void;Start or stop a menu dialog.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
dialog | CUIDialogWnd | Dialog window. |
should_hide_indicators | boolean | Whether showing the dialog should hide HUD indicators. |
Returns
void
Remarks
Hides the dialog when it is already shown. Otherwise shows it and applies should_hide_indicators.
start_weather_fx_from_time()
start_weather_fx_from_time(
this: void,
weather_fx_name: string,
time: number): boolean;Start a weather effect from a specific time.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
weather_fx_name | string | Weather effect config name. |
time | number | Start time. |
Returns
boolean
Whether the effect started.
Remarks
Returns false in editor mode.
stop_weather_fx()
stop_weather_fx(this: void): void;Stop the active weather effect.
Parameters
| Parameter | Type |
|---|---|
this | void |
Returns
void
valid_vertex()
valid_vertex(this: void, vertex_id: number): boolean;Check whether a level vertex id is valid.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
vertex_id | number | Level vertex id to check. |
Returns
boolean
Whether the level graph contains the vertex.
Since
OpenXRay 2022-08-09, a2d264fc, PR #1032
Source
src/xrGame/level_script.cpp, level.valid_vertex binding.
vertex_id()
vertex_id(this: void, position: vector): number;Get nearest level vertex for a position.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
position | vector | World position. |
Returns
number
Level vertex id.
Remarks
The binding preserves original Lua behavior for invalid vertices and returns 4294967296 instead of u32(-1).
vertex_in_direction()
vertex_in_direction(
this: void,
vertex_id: number,
direction: vector,
distance: number): number;Move from a level vertex in a direction.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
vertex_id | number | Start level vertex id. |
direction | vector | Direction to move. |
distance | number | Distance to move. |
Returns
number
Result level vertex id.
Remarks
Returns the original vertex when the engine cannot find a valid vertex in the requested direction.
vertex_position()
vertex_position(this: void, id: number): vector;Get world position of a level vertex.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | void | - |
id | number | Level vertex id. |
Returns
Vertex position.