Skip to content

Class: MockCCar ​

Mock of the X-Ray engine car object, used by minigun and vehicle related schemes.

Values supplied through the config are stored as mutable fields, so a test can change car state between calls instead of re-creating the mock.

Extends ​

  • MockCGameObject

Implements ​

  • CCar

Constructors ​

Constructor ​

ts
new MockCCar(): MockCCar;

Returns ​

MockCCar

Inherited from ​

ts
MockCGameObject.constructor

Methods ​

create() ​

ts
static create(config?: IMockCCarConfig): MockCCar;

Parameters ​

ParameterType
configIMockCCarConfig

Returns ​

MockCCar

Overrides ​

ts
MockCGameObject.create

mock() ​

ts
static mock(config?: IMockCCarConfig): CCar;

Parameters ​

ParameterType
configIMockCCarConfig

Returns ​

CCar

Overrides ​

ts
MockCGameObject.mock

Properties ​

__name ​

ts
__name: string = "CCar";

Implementation of ​

ts
CCar.__name

Overrides ​

ts
MockCGameObject.__name

_construct ​

ts
_construct: MockedFunction<() => DLL_Pure>;

Construct engine-side object state.

Remarks ​

Lifecycle hook used by the engine. Calling it from gameplay scripts can reinitialize native state unexpectedly.

Returns ​

Constructed base object.

Implementation of ​

ts
CCar._construct

Inherited from ​

ts
MockCGameObject._construct

Action ​

ts
Action: MockedFunction<(id: number, flags: number) => void>;

Send a mounted-weapon action.

Remarks ​

For eWpnFire, eWpnActivate, and eWpnAutoFire, native code treats flags === 1 as enabled/start and any other value as disabled/stop. eWpnToDefaultDir resets the weapon direction to its bind orientation.

Param ​

id

Weapon action id.

Param ​

flags

Action flags.

Implementation of ​

ts
CCar.Action

canHit ​

ts
canHit: boolean = true;

CanHit ​

ts
CanHit: MockedFunction<() => boolean>;

Returns ​

Whether the mounted weapon can hit its current target.

Implementation of ​

ts
CCar.CanHit

CarExplode ​

ts
CarExplode: MockedFunction<() => void>;

Trigger car explosion.

Implementation of ​

ts
CCar.CarExplode

ChangefFuel ​

ts
ChangefFuel: MockedFunction<(fuel: number) => void>;

Change current fuel by a delta and clamp it to the tank range.

Since ​

OpenXRay 2024-08-09, e08b8073

Remarks ​

Negative deltas cannot reduce fuel below 0; positive deltas cannot increase it above GetfFuelTank(). Use SetfFuel() or set_fuel() when the script needs to assign an absolute fuel value.

Param ​

fuel

Fuel delta.

Implementation of ​

ts
CCar.ChangefFuel

ChangefHealth ​

ts
ChangefHealth: MockedFunction<(value: number) => void>;

Change vehicle health by a delta and clamp it to the normalized health range.

Since ​

OpenXRay 2024-08-09, e08b8073

Remarks ​

The native implementation clamps the result to 0..1. Use SetfHealth() when assigning an absolute health value.

Param ​

value

Health delta.

Implementation of ​

ts
CCar.ChangefHealth

CurrentVel ​

ts
CurrentVel: MockedFunction<() => vector>;

Returns ​

Current velocity vector.

Implementation of ​

ts
CCar.CurrentVel

engaged ​

ts
engaged: MockedFunction<() => boolean>;

Returns ​

Whether the actor is currently attached to this holder.

Implementation of ​

ts
CCar.engaged

explodeTime ​

ts
explodeTime: number = 0;

ExplodeTime ​

ts
ExplodeTime: MockedFunction<() => number>;

Returns ​

Scheduled delayed-fuse explosion time in milliseconds, or 0 when no fuse was initialized.

Implementation of ​

ts
CCar.ExplodeTime

FireDirDiff ​

ts
FireDirDiff: MockedFunction<() => number>;

Returns ​

Difference between current and desired weapon fire direction.

Implementation of ​

ts
CCar.FireDirDiff

fuel ​

ts
fuel: number = 1;

fuelConsumption ​

ts
fuelConsumption: number = 1;

fuelTank ​

ts
fuelTank: number = 1;

get_fuel ​

ts
get_fuel: MockedFunction<() => number>;

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Returns ​

Amount of fuel in vehicle instance.

Implementation of ​

ts
CCar.get_fuel

get_fuel_consumption ​

ts
get_fuel_consumption: MockedFunction<() => number>;

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Returns ​

Fuel consumption rate of vehicle instance.

Implementation of ​

ts
CCar.get_fuel_consumption

get_fuel_tank ​

ts
get_fuel_tank: MockedFunction<() => number>;

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Returns ​

Fuel tank size.

Implementation of ​

ts
CCar.get_fuel_tank

getEnabled ​

ts
getEnabled: MockedFunction<() => boolean>;

Returns ​

Whether the object is enabled in the client object loop.

Implementation of ​

ts
CCar.getEnabled

Inherited from ​

ts
MockCGameObject.getEnabled

GetfFuel ​

ts
GetfFuel: MockedFunction<() => number>;

Since ​

OpenXRay 2024-08-09, e08b8073

Returns ​

Amount of fuel in vehicle instance.

Implementation of ​

ts
CCar.GetfFuel

GetfFuelConsumption ​

ts
GetfFuelConsumption: MockedFunction<() => number>;

Since ​

OpenXRay 2024-08-09, e08b8073

Returns ​

Fuel consumption rate of vehicle instance.

Implementation of ​

ts
CCar.GetfFuelConsumption

GetfFuelTank ​

ts
GetfFuelTank: MockedFunction<() => number>;

Since ​

OpenXRay 2024-08-09, e08b8073

Returns ​

Fuel tank size (max possible amount of fuel at time).

Implementation of ​

ts
CCar.GetfFuelTank

GetfHealth ​

ts
GetfHealth: MockedFunction<() => number>;

Returns ​

Vehicle health value.

Implementation of ​

ts
CCar.GetfHealth

GetRPM ​

ts
GetRPM: MockedFunction<() => number>;

Since ​

OpenXRay 2024-08-09, e08b8073

Returns ​

Current vehicle RPM value (speed).

Implementation of ​

ts
CCar.GetRPM

getVisible ​

ts
getVisible: MockedFunction<() => boolean>;

Returns ​

Whether the object is visible.

Implementation of ​

ts
CCar.getVisible

Inherited from ​

ts
MockCGameObject.getVisible

HandBreak ​

ts
HandBreak: MockedFunction<() => void>;

Set vehicle hand break in active state.

Since ​

OpenXRay 2024-08-09, e08b8073

Implementation of ​

ts
CCar.HandBreak

hasWeapon ​

ts
hasWeapon: boolean = true;

HasWeapon ​

ts
HasWeapon: MockedFunction<() => boolean>;

Returns ​

Whether vehicle has mounted weapon.

Implementation of ​

ts
CCar.HasWeapon

health ​

ts
health: number = 1;

IsActiveEngine ​

ts
IsActiveEngine: MockedFunction<() => boolean>;

Since ​

OpenXRay 2024-08-09, e08b8073

Returns ​

Whether vehicle engine is active at the moment.

Implementation of ​

ts
CCar.IsActiveEngine

isEngaged ​

ts
isEngaged: boolean = false;

isEngineActive ​

ts
isEngineActive: boolean = false;

isObjectVisible ​

ts
isObjectVisible: boolean = true;

IsObjectVisible ​

ts
IsObjectVisible: MockedFunction<(game_object: game_object) => boolean>;

Check whether an object is visible from the car weapon.

Param ​

game_object

Object to test.

Returns ​

Whether the object is visible.

Implementation of ​

ts
CCar.IsObjectVisible

net_Export ​

ts
net_Export: MockedFunction<(net_packet: net_packet) => void>;

Export network state to a packet.

Param ​

net_packet

Destination network packet.

Implementation of ​

ts
CCar.net_Export

Inherited from ​

ts
MockCGameObject.net_Export

net_Import ​

ts
net_Import: MockedFunction<(net_packet: net_packet) => void>;

Import network state from a packet.

Param ​

net_packet

Source network packet.

Implementation of ​

ts
CCar.net_Import

Inherited from ​

ts
MockCGameObject.net_Import

net_Spawn ​

ts
net_Spawn: MockedFunction<(cse_abstract: cse_abstract) => boolean>;

Spawn the client object from its server object.

Remarks ​

Lifecycle hook used during network spawn. Return false to reject spawn in custom subclasses.

Param ​

cse_abstract

Server object used for spawn data.

Returns ​

Whether spawn succeeded.

Implementation of ​

ts
CCar.net_Spawn

Inherited from ​

ts
MockCGameObject.net_Spawn

PlayDamageParticles ​

ts
PlayDamageParticles: MockedFunction<() => void>;

Start car damage particles.

Since ​

OpenXRay 2024-08-09, e08b8073

Implementation of ​

ts
CCar.PlayDamageParticles

ReleaseHandBreak ​

ts
ReleaseHandBreak: MockedFunction<() => void>;

Deactivate vehicle hand break.

Since ​

OpenXRay 2024-08-09, e08b8073

Implementation of ​

ts
CCar.ReleaseHandBreak

rpm ​

ts
rpm: number = 0;

set_fuel ​

ts
set_fuel: MockedFunction<(fuel: number) => void>;

Set current fuel amount directly.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Remarks ​

Lowercase alias for SetfFuel().

Param ​

fuel

Fuel amount.

Implementation of ​

ts
CCar.set_fuel

set_fuel_consumption ​

ts
set_fuel_consumption: MockedFunction<(consumption: number) => void>;

Set fuel consumption rate.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Param ​

consumption

Fuel consumption rate.

Implementation of ​

ts
CCar.set_fuel_consumption

set_fuel_tank ​

ts
set_fuel_tank: MockedFunction<(fuel: number) => void>;

Set fuel tank capacity.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Param ​

fuel

Fuel tank capacity.

Implementation of ​

ts
CCar.set_fuel_tank

SetEnterLocked ​

ts
SetEnterLocked: MockedFunction<(is_enabled: boolean) => void>;

Lock or unlock entering the car.

Param ​

is_enabled

Whether entering is locked.

Implementation of ​

ts
CCar.SetEnterLocked

SetExitLocked ​

ts
SetExitLocked: MockedFunction<(is_enabled: boolean) => void>;

Lock or unlock exiting the car.

Param ​

is_enabled

Whether exiting is locked.

Implementation of ​

ts
CCar.SetExitLocked

SetExplodeTime ​

ts
SetExplodeTime: MockedFunction<(time: number) => void>;

Set delayed-fuse explosion time.

Remarks ​

The native method accepts milliseconds and converts them to the delayed action fuse timeout.

Param ​

time

Explosion time in milliseconds.

Implementation of ​

ts
CCar.SetExplodeTime

SetfFuel ​

ts
SetfFuel: MockedFunction<(fuel: number) => void>;

Set current fuel amount directly.

Since ​

OpenXRay 2024-08-09, e08b8073

Remarks ​

This is an absolute setter and does not clamp against tank capacity.

Param ​

fuel

Fuel amount.

Implementation of ​

ts
CCar.SetfFuel

SetfFuelConsumption ​

ts
SetfFuelConsumption: MockedFunction<(consumption: number) => void>;

Set fuel consumption rate.

Since ​

OpenXRay 2024-08-09, e08b8073

Param ​

consumption

Fuel consumption rate.

Implementation of ​

ts
CCar.SetfFuelConsumption

SetfFuelTank ​

ts
SetfFuelTank: MockedFunction<(fuel: number) => void>;

Set fuel tank capacity.

Since ​

OpenXRay 2024-08-09, e08b8073

Param ​

fuel

Fuel tank capacity.

Implementation of ​

ts
CCar.SetfFuelTank

SetfHealth ​

ts
SetfHealth: MockedFunction<(health: number) => number>;

Set vehicle health directly.

Remarks ​

This forwards to the entity health setter and returns the applied value. ChangefHealth() is the clamped delta helper.

Param ​

health

New health value.

Returns ​

Applied health value.

Implementation of ​

ts
CCar.SetfHealth

SetParam ​

ts
SetParam: MockedFunction<{
  (id: number, vector: vector): void;
  (id: 2, vector: vector): void;
}>;

Set a mounted-weapon vector parameter.

Remarks ​

The script binding exposes the vector overload. Native code handles eWpnDesiredPos by aiming the weapon at the provided world position; other ids are ignored by this overload.

Param ​

id

Weapon parameter id.

Param ​

vector

Parameter value.

Implementation of ​

ts
CCar.SetParam

SetRPM ​

ts
SetRPM: MockedFunction<(rpm: number) => void>;

Set current vehicle RPM value (speed).

Since ​

OpenXRay 2024-08-09, e08b8073

Param ​

rpm

RPM value to apply.

Implementation of ​

ts
CCar.SetRPM

StartEngine ​

ts
StartEngine: MockedFunction<() => void>;

Start vehicle engine.

Since ​

OpenXRay 2024-08-09, e08b8073

Implementation of ​

ts
CCar.StartEngine

StopDamageParticles ​

ts
StopDamageParticles: MockedFunction<() => void>;

Stop car damage particles.

Since ​

OpenXRay 2024-08-09, e08b8073

Implementation of ​

ts
CCar.StopDamageParticles

StopEngine ​

ts
StopEngine: MockedFunction<() => void>;

Stop vehicle engine.

Since ​

OpenXRay 2024-08-09, e08b8073

Implementation of ​

ts
CCar.StopEngine

use ​

ts
use: MockedFunction<(object: CGameObject) => boolean>;

Use another object through the engine interaction path.

Param ​

object

Object being used.

Returns ​

Whether the use action was handled.

Implementation of ​

ts
CCar.use

Inherited from ​

ts
MockCGameObject.use

Visual ​

ts
Visual: MockedFunction<() => IXR_IRender_Visual>;

Returns ​

Render visual assigned to the object.

Implementation of ​

ts
CCar.Visual

Inherited from ​

ts
MockCGameObject.Visual

eWpnActivate ​

ts
readonly static eWpnActivate: 3;

Engine enum value for CCar.eWpnActivate.


eWpnAutoFire ​

ts
readonly static eWpnAutoFire: 5;

Engine enum value for CCar.eWpnAutoFire.


eWpnDesiredDir ​

ts
readonly static eWpnDesiredDir: 1;

Engine enum value for CCar.eWpnDesiredDir.


eWpnDesiredPos ​

ts
readonly static eWpnDesiredPos: 2;

Engine enum value for CCar.eWpnDesiredPos.


eWpnFire ​

ts
readonly static eWpnFire: 4;

Engine enum value for CCar.eWpnFire.


eWpnToDefaultDir ​

ts
readonly static eWpnToDefaultDir: 6;

Engine enum value for CCar.eWpnToDefaultDir.