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
new MockCCar(): MockCCar;Returns
MockCCar
Inherited from
MockCGameObject.constructorMethods
create()
static create(config?: IMockCCarConfig): MockCCar;Parameters
| Parameter | Type |
|---|---|
config | IMockCCarConfig |
Returns
MockCCar
Overrides
MockCGameObject.createmock()
static mock(config?: IMockCCarConfig): CCar;Parameters
| Parameter | Type |
|---|---|
config | IMockCCarConfig |
Returns
CCar
Overrides
MockCGameObject.mockProperties
__name
__name: string = "CCar";Implementation of
CCar.__nameOverrides
MockCGameObject.__name_construct
_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
CCar._constructInherited from
MockCGameObject._constructAction
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
CCar.ActioncanHit
canHit: boolean = true;CanHit
CanHit: MockedFunction<() => boolean>;Returns
Whether the mounted weapon can hit its current target.
Implementation of
CCar.CanHitCarExplode
CarExplode: MockedFunction<() => void>;Trigger car explosion.
Implementation of
CCar.CarExplodeChangefFuel
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
CCar.ChangefFuelChangefHealth
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
CCar.ChangefHealthCurrentVel
CurrentVel: MockedFunction<() => vector>;Returns
Current velocity vector.
Implementation of
CCar.CurrentVelengaged
engaged: MockedFunction<() => boolean>;Returns
Whether the actor is currently attached to this holder.
Implementation of
CCar.engagedexplodeTime
explodeTime: number = 0;ExplodeTime
ExplodeTime: MockedFunction<() => number>;Returns
Scheduled delayed-fuse explosion time in milliseconds, or 0 when no fuse was initialized.
Implementation of
CCar.ExplodeTimeFireDirDiff
FireDirDiff: MockedFunction<() => number>;Returns
Difference between current and desired weapon fire direction.
Implementation of
CCar.FireDirDifffuel
fuel: number = 1;fuelConsumption
fuelConsumption: number = 1;fuelTank
fuelTank: number = 1;get_fuel
get_fuel: MockedFunction<() => number>;Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Returns
Amount of fuel in vehicle instance.
Implementation of
CCar.get_fuelget_fuel_consumption
get_fuel_consumption: MockedFunction<() => number>;Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Returns
Fuel consumption rate of vehicle instance.
Implementation of
CCar.get_fuel_consumptionget_fuel_tank
get_fuel_tank: MockedFunction<() => number>;Since
OpenXRay 2026-01-01, e3b0e3c5, PR #2028
Returns
Fuel tank size.
Implementation of
CCar.get_fuel_tankgetEnabled
getEnabled: MockedFunction<() => boolean>;Returns
Whether the object is enabled in the client object loop.
Implementation of
CCar.getEnabledInherited from
MockCGameObject.getEnabledGetfFuel
GetfFuel: MockedFunction<() => number>;Since
OpenXRay 2024-08-09, e08b8073
Returns
Amount of fuel in vehicle instance.
Implementation of
CCar.GetfFuelGetfFuelConsumption
GetfFuelConsumption: MockedFunction<() => number>;Since
OpenXRay 2024-08-09, e08b8073
Returns
Fuel consumption rate of vehicle instance.
Implementation of
CCar.GetfFuelConsumptionGetfFuelTank
GetfFuelTank: MockedFunction<() => number>;Since
OpenXRay 2024-08-09, e08b8073
Returns
Fuel tank size (max possible amount of fuel at time).
Implementation of
CCar.GetfFuelTankGetfHealth
GetfHealth: MockedFunction<() => number>;Returns
Vehicle health value.
Implementation of
CCar.GetfHealthGetRPM
GetRPM: MockedFunction<() => number>;Since
OpenXRay 2024-08-09, e08b8073
Returns
Current vehicle RPM value (speed).
Implementation of
CCar.GetRPMgetVisible
getVisible: MockedFunction<() => boolean>;Returns
Whether the object is visible.
Implementation of
CCar.getVisibleInherited from
MockCGameObject.getVisibleHandBreak
HandBreak: MockedFunction<() => void>;Set vehicle hand break in active state.
Since
OpenXRay 2024-08-09, e08b8073
Implementation of
CCar.HandBreakhasWeapon
hasWeapon: boolean = true;HasWeapon
HasWeapon: MockedFunction<() => boolean>;Returns
Whether vehicle has mounted weapon.
Implementation of
CCar.HasWeaponhealth
health: number = 1;IsActiveEngine
IsActiveEngine: MockedFunction<() => boolean>;Since
OpenXRay 2024-08-09, e08b8073
Returns
Whether vehicle engine is active at the moment.
Implementation of
CCar.IsActiveEngineisEngaged
isEngaged: boolean = false;isEngineActive
isEngineActive: boolean = false;isObjectVisible
isObjectVisible: boolean = true;IsObjectVisible
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
CCar.IsObjectVisiblenet_Export
net_Export: MockedFunction<(net_packet: net_packet) => void>;Export network state to a packet.
Param
net_packet
Destination network packet.
Implementation of
CCar.net_ExportInherited from
MockCGameObject.net_Exportnet_Import
net_Import: MockedFunction<(net_packet: net_packet) => void>;Import network state from a packet.
Param
net_packet
Source network packet.
Implementation of
CCar.net_ImportInherited from
MockCGameObject.net_Importnet_Spawn
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
CCar.net_SpawnInherited from
MockCGameObject.net_SpawnPlayDamageParticles
PlayDamageParticles: MockedFunction<() => void>;Start car damage particles.
Since
OpenXRay 2024-08-09, e08b8073
Implementation of
CCar.PlayDamageParticlesReleaseHandBreak
ReleaseHandBreak: MockedFunction<() => void>;Deactivate vehicle hand break.
Since
OpenXRay 2024-08-09, e08b8073
Implementation of
CCar.ReleaseHandBreakrpm
rpm: number = 0;set_fuel
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
CCar.set_fuelset_fuel_consumption
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
CCar.set_fuel_consumptionset_fuel_tank
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
CCar.set_fuel_tankSetEnterLocked
SetEnterLocked: MockedFunction<(is_enabled: boolean) => void>;Lock or unlock entering the car.
Param
is_enabled
Whether entering is locked.
Implementation of
CCar.SetEnterLockedSetExitLocked
SetExitLocked: MockedFunction<(is_enabled: boolean) => void>;Lock or unlock exiting the car.
Param
is_enabled
Whether exiting is locked.
Implementation of
CCar.SetExitLockedSetExplodeTime
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
CCar.SetExplodeTimeSetfFuel
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
CCar.SetfFuelSetfFuelConsumption
SetfFuelConsumption: MockedFunction<(consumption: number) => void>;Set fuel consumption rate.
Since
OpenXRay 2024-08-09, e08b8073
Param
consumption
Fuel consumption rate.
Implementation of
CCar.SetfFuelConsumptionSetfFuelTank
SetfFuelTank: MockedFunction<(fuel: number) => void>;Set fuel tank capacity.
Since
OpenXRay 2024-08-09, e08b8073
Param
fuel
Fuel tank capacity.
Implementation of
CCar.SetfFuelTankSetfHealth
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
CCar.SetfHealthSetParam
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
CCar.SetParamSetRPM
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
CCar.SetRPMStartEngine
StartEngine: MockedFunction<() => void>;Start vehicle engine.
Since
OpenXRay 2024-08-09, e08b8073
Implementation of
CCar.StartEngineStopDamageParticles
StopDamageParticles: MockedFunction<() => void>;Stop car damage particles.
Since
OpenXRay 2024-08-09, e08b8073
Implementation of
CCar.StopDamageParticlesStopEngine
StopEngine: MockedFunction<() => void>;Stop vehicle engine.
Since
OpenXRay 2024-08-09, e08b8073
Implementation of
CCar.StopEngineuse
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
CCar.useInherited from
MockCGameObject.useVisual
Visual: MockedFunction<() => IXR_IRender_Visual>;Returns
Render visual assigned to the object.
Implementation of
CCar.VisualInherited from
MockCGameObject.VisualeWpnActivate
readonly static eWpnActivate: 3;Engine enum value for CCar.eWpnActivate.
eWpnAutoFire
readonly static eWpnAutoFire: 5;Engine enum value for CCar.eWpnAutoFire.
eWpnDesiredDir
readonly static eWpnDesiredDir: 1;Engine enum value for CCar.eWpnDesiredDir.
eWpnDesiredPos
readonly static eWpnDesiredPos: 2;Engine enum value for CCar.eWpnDesiredPos.
eWpnFire
readonly static eWpnFire: 4;Engine enum value for CCar.eWpnFire.
eWpnToDefaultDir
readonly static eWpnToDefaultDir: 6;Engine enum value for CCar.eWpnToDefaultDir.