DayZ 1.24
Loading...
Searching...
No Matches
Transport Class Reference

Base native class for all motorized wheeled vehicles. More...

Private Member Functions

proto native CarController GetController ()
 DEPRECATED, left for backwards compatibility, the methods of this class are now directly accessible on Car itself.
 
proto native float GetSpeedometer ()
 Returns the current speed of the vehicle in km/h.
 
float GetSpeedometerAbsolute ()
 Returns the current speed of the vehicle in km/h. Value is absolute.
 
override bool IsAreaAtDoorFree (int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
 
override Shape DebugFreeAreaAtDoor (int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
 
override int GetHideIconMask ()
 
proto native float GetSteering ()
 Returns the current steering value in range <-1, 1>.
 
proto native void SetSteering (float in, bool analog=false)
 
proto native float GetThrustTurbo ()
 Returns the current thrust turbo modifier value in range <0, 1>.
 
proto native float GetThrustGentle ()
 Returns the current thrust gentle modifier value in range <0, 1>.
 
proto native float GetThrust ()
 Returns the current thrust value in range <0, 1>.
 
proto native void SetThrust (float in, float gentle=0, float turbo=0)
 
proto native float GetBrake ()
 Returns the current brake value in range <0, 1>.
 
proto native void SetBrake (float in, float panic=0, bool gentle=false)
 
proto native float GetHandbrake ()
 Returns the current handbrake value in range <0, 1>.
 
proto native void SetHandbrake (float in)
 
proto native void SetBrakesActivateWithoutDriver (bool activate=true)
 
proto native float GetClutch ()
 Returns the current clutch value in range <0, 1>.
 
proto native void SetClutchState (bool in)
 
proto native int GetGear ()
 Returns index of the current gear.
 
proto native void ShiftUp ()
 
proto native void ShiftTo (CarGear gear)
 
proto native void ShiftDown ()
 
proto native float GetFluidCapacity (CarFluid fluid)
 
proto native float GetFluidFraction (CarFluid fluid)
 
proto native void Leak (CarFluid fluid, float amount)
 Removes from the specified fluid the specified amount.
 
proto native void LeakAll (CarFluid fluid)
 Removes all the specified fluid from vehicle.
 
proto native void Fill (CarFluid fluid, float amount)
 Adds to the specified fluid the specified amount.
 
void OnFluidChanged (CarFluid fluid, float newValue, float oldValue)
 
proto native float EngineGetRPMMin ()
 Returns engine's min operating rpm.
 
proto native float EngineGetRPMIdle ()
 Returns engine's idle rpm before engine stalls.
 
proto native float EngineGetRPMMax ()
 Returns engine's max rpm before engine blows up.
 
proto native float EngineGetRPMRedline ()
 Returns engine's maximal working rpm without damaging the engine.
 
proto native float EngineGetRPM ()
 Returns engine's rpm value.
 
proto native bool EngineIsOn ()
 Returns true when engine is running, false otherwise.
 
proto native void EngineStart ()
 Starts the engine.
 
bool OnBeforeEngineStart ()
 
void OnEngineStart ()
 Is called every time the engine starts.
 
proto native void EngineStop ()
 Stops the engine.
 
void OnEngineStop ()
 Is called every time the engine stops.
 
proto native vector GetEnginePos ()
 Get actual position of engine (model space)
 
proto native void SetEnginePos (vector pos)
 Override the position of engine (model space)
 
proto native int GetGearsCount ()
 Returns total number of gears.
 
proto native CarGearboxType GearboxGetType ()
 Returns gearbox type. See CarGearboxType enum for more info.
 
proto native CarAutomaticGearboxMode GearboxGetMode ()
 Returns gearbox mode. This is useful when car has automatic gearbox.
 
void OnGearChanged (int newGear, int oldGear)
 
proto native bool WheelIsAnyLocked ()
 Returns true if any of the wheels are locked in terms of its movement.
 
proto native bool WheelIsLocked (int wheelIdx)
 
proto native int WheelCount ()
 How many wheel can be attached to a car (hubs only)
 
proto native int WheelCountPresent ()
 Number of actually attached wheels (hubs only)
 
void OnContact (string zoneName, vector localPos, IEntity other, Contact data)
 
float OnSound (CarSoundCtrl ctrl, float oldValue)
 
void OnInput (float dt)
 
void OnUpdate (float dt)
 
proto native void ForcePosition (vector pos)
 
proto native void ForceDirection (vector dir)
 

Detailed Description

Base native class for all motorized wheeled vehicles.

Base native class for helicopter.

Definition at line 74 of file Car.c.

Member Function Documentation

◆ DebugFreeAreaAtDoor()

override Shape Transport::DebugFreeAreaAtDoor ( int currentSeat,
float maxAllowedObjHeight = 0.5,
float horizontalExtents = 0.5,
float playerHeight = 1.7 )
inlineprivate

Definition at line 107 of file Car.c.

108 {
109 int color = ARGB(20, 0, 255, 0);
110
111 vector transform[4];
112
114
118
119 float speed = GetSpeedometerAbsolute();
120 if (speed > 8)
121 extents[2] = extents[2] * 6;
122 if (speed > 8)
123 extents[0] = 2;
124
126 color = ARGB(20, 255, 0, 0);
127
128 Shape shape = Debug.DrawBox(-extents * 0.5, extents * 0.5, color);
129 shape.SetMatrix(transform);
130 return shape;
131 }
Definition Debug.c:14
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Definition Debug.c:401
float GetSpeedometerAbsolute()
Returns the current speed of the vehicle in km/h. Value is absolute.
Definition Car.c:83
override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Definition Car.c:88
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
int ARGB(int a, int r, int g, int b)
Definition proto.c:322

References ARGB(), Debug::DrawBox(), and Shape.

◆ EngineGetRPM()

proto native float Transport::EngineGetRPM ( )
private

Returns engine's rpm value.

◆ EngineGetRPMIdle()

proto native float Transport::EngineGetRPMIdle ( )
private

Returns engine's idle rpm before engine stalls.

◆ EngineGetRPMMax()

proto native float Transport::EngineGetRPMMax ( )
private

Returns engine's max rpm before engine blows up.

◆ EngineGetRPMMin()

proto native float Transport::EngineGetRPMMin ( )
private

Returns engine's min operating rpm.

◆ EngineGetRPMRedline()

proto native float Transport::EngineGetRPMRedline ( )
private

Returns engine's maximal working rpm without damaging the engine.

◆ EngineIsOn()

proto native bool Transport::EngineIsOn ( )
private

Returns true when engine is running, false otherwise.

◆ EngineStart()

proto native void Transport::EngineStart ( )
private

Starts the engine.

◆ EngineStop()

proto native void Transport::EngineStop ( )
private

Stops the engine.

◆ Fill()

proto native void Transport::Fill ( CarFluid fluid,
float amount )
private

Adds to the specified fluid the specified amount.

◆ ForceDirection()

proto native void Transport::ForceDirection ( vector dir)
private

◆ ForcePosition()

proto native void Transport::ForcePosition ( vector pos)
private

◆ GearboxGetMode()

proto native CarAutomaticGearboxMode Transport::GearboxGetMode ( )
private

Returns gearbox mode. This is useful when car has automatic gearbox.

◆ GearboxGetType()

proto native CarGearboxType Transport::GearboxGetType ( )
private

Returns gearbox type. See CarGearboxType enum for more info.

◆ GetBrake()

proto native float Transport::GetBrake ( )
private

Returns the current brake value in range <0, 1>.

◆ GetClutch()

proto native float Transport::GetClutch ( )
private

Returns the current clutch value in range <0, 1>.

◆ GetController()

proto native CarController Transport::GetController ( )
private

DEPRECATED, left for backwards compatibility, the methods of this class are now directly accessible on Car itself.

◆ GetEnginePos()

proto native vector Transport::GetEnginePos ( )
private

Get actual position of engine (model space)

◆ GetFluidCapacity()

proto native float Transport::GetFluidCapacity ( CarFluid fluid)
private

Returns tank capacity for the specified vehicle's fluid.

Parameters
fluidthe specified fluid type

◆ GetFluidFraction()

proto native float Transport::GetFluidFraction ( CarFluid fluid)
private

Returns fraction value (in range <0, 1>) of the current state of the specified vehicle's fluid.

Parameters
[in]fluidthe specified fluid type

◆ GetGear()

proto native int Transport::GetGear ( )
private

Returns index of the current gear.

◆ GetGearsCount()

proto native int Transport::GetGearsCount ( )
private

Returns total number of gears.

◆ GetHandbrake()

proto native float Transport::GetHandbrake ( )
private

Returns the current handbrake value in range <0, 1>.

◆ GetHideIconMask()

override int Transport::GetHideIconMask ( )
inlineprivate

Definition at line 133 of file Car.c.

134 {
135 return EInventoryIconVisibility.HIDE_VICINITY;
136 }

◆ GetSpeedometer()

proto native float Transport::GetSpeedometer ( )
private

Returns the current speed of the vehicle in km/h.

◆ GetSpeedometerAbsolute()

float Transport::GetSpeedometerAbsolute ( )
inlineprivate

Returns the current speed of the vehicle in km/h. Value is absolute.

Definition at line 83 of file Car.c.

84 {
86 }
Definition EnMath.c:7
proto native float GetSpeedometer()
Returns the current speed of the vehicle in km/h.
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat().

◆ GetSteering()

proto native float Transport::GetSteering ( )
private

Returns the current steering value in range <-1, 1>.

◆ GetThrust()

proto native float Transport::GetThrust ( )
private

Returns the current thrust value in range <0, 1>.

◆ GetThrustGentle()

proto native float Transport::GetThrustGentle ( )
private

Returns the current thrust gentle modifier value in range <0, 1>.

◆ GetThrustTurbo()

proto native float Transport::GetThrustTurbo ( )
private

Returns the current thrust turbo modifier value in range <0, 1>.

◆ IsAreaAtDoorFree()

override bool Transport::IsAreaAtDoorFree ( int currentSeat,
float maxAllowedObjHeight = 0.5,
float horizontalExtents = 0.5,
float playerHeight = 1.7 )
inlineprivate

Definition at line 88 of file Car.c.

89 {
91
93
97
98 float speed = GetSpeedometerAbsolute();
99 if (speed > 8)
100 extents[2] = extents[2] * 6;
101 if (speed > 8)
102 extents[0] = 2;
103
105 }

Referenced by EntityAI::DebugFreeAreaAtDoor(), and EntityAI::IsAreaAtDoorFree().

◆ Leak()

proto native void Transport::Leak ( CarFluid fluid,
float amount )
private

Removes from the specified fluid the specified amount.

◆ LeakAll()

proto native void Transport::LeakAll ( CarFluid fluid)
private

Removes all the specified fluid from vehicle.

◆ OnBeforeEngineStart()

bool Transport::OnBeforeEngineStart ( )
inlineprivate

Is called every time the game wants to start the engine.

Returns
true if the engine can start, false otherwise.

Definition at line 274 of file Car.c.

275 {
276 // engine can start by default
277 return true;
278 }

◆ OnContact()

void Transport::OnContact ( string zoneName,
vector localPos,
IEntity other,
Contact data )
inlineprivate

Is called every time when vehicle collides with other object.

Parameters
[in]zoneNameconfigured vehicle's zone that was hit
[in]localPosposition where the vehicle was hit in vehicle's space
[in]otherobject with which the vehicle is colliding
[in]datacontact properties

Definition at line 353 of file Car.c.

353{}

◆ OnEngineStart()

void Transport::OnEngineStart ( )
inlineprivate

Is called every time the engine starts.

Definition at line 281 of file Car.c.

281{}

◆ OnEngineStop()

void Transport::OnEngineStop ( )
inlineprivate

Is called every time the engine stops.

Definition at line 287 of file Car.c.

287{}

◆ OnFluidChanged()

void Transport::OnFluidChanged ( CarFluid fluid,
float newValue,
float oldValue )
inlineprivate

Is called every time when the specified vehicle's fluid level changes eg. when car is consuming fuel.

Parameters
[in]fluidfluid identifier,
See also
CarFluid
Parameters
[in]newValuenew fluid level
[in]oldValueprevious fluid level before change

Definition at line 241 of file Car.c.

241{}

◆ OnGearChanged()

void Transport::OnGearChanged ( int newGear,
int oldGear )
inlineprivate

Is called every time when the simulation changed gear.

Parameters
[in]newGearnew gear level
[in]oldGearprevious gear level before gear shift

Definition at line 315 of file Car.c.

316 {
317 }

◆ OnInput()

void Transport::OnInput ( float dt)
inlineprivate

Is called after every input simulation step.

Note that the player character and other systems can always change the internal state. It is highly recommended to store state of custom inputs elsewhere and call Setters here.

Parameters
[in]dtframe time in seconds

Definition at line 377 of file Car.c.

377{}

◆ OnSound()

float Transport::OnSound ( CarSoundCtrl ctrl,
float oldValue )
inlineprivate

Is called every sound simulation step. In this callback, user can modify behaviour of sound controllers.

Parameters
[in]ctrlsound controller identifier,
See also
CarSoundCtrl
Parameters
[in]oldValuealready computed value by the game code
Returns
new value of the specified sound controller.

Definition at line 363 of file Car.c.

364 {
365 // just use the computed value by the game code
366 return oldValue;
367 }

◆ OnUpdate()

void Transport::OnUpdate ( float dt)
inlineprivate

Is called every game frame.

Parameters
[in]dtframe time in seconds

Definition at line 383 of file Car.c.

383{}

◆ SetBrake()

proto native void Transport::SetBrake ( float in,
float panic = 0,
bool gentle = false )
private

Sets the brake value.

Parameters
inshould be in range <0, 1>
panicshould be in range <0, 1>

◆ SetBrakesActivateWithoutDriver()

proto native void Transport::SetBrakesActivateWithoutDriver ( bool activate = true)
private

Sets if brakes should activate without a driver present

◆ SetClutchState()

proto native void Transport::SetClutchState ( bool in)
private

Sets the clutch state.

◆ SetEnginePos()

proto native void Transport::SetEnginePos ( vector pos)
private

Override the position of engine (model space)

◆ SetHandbrake()

proto native void Transport::SetHandbrake ( float in)
private

Sets the handbrake value.

Parameters
inshould be in range <0, 1>

◆ SetSteering()

proto native void Transport::SetSteering ( float in,
bool analog = false )
private

Sets the steering value.

Parameters
inshould be in range <-1, 1>
analogindicates if the input value was taken from analog controller

◆ SetThrust()

proto native void Transport::SetThrust ( float in,
float gentle = 0,
float turbo = 0 )
private

Sets the thrust value.

Parameters
inshould be in range <0, 1>
gentleshould be in range <0, 1>, thrust modifier
turboshould be in range <0, 1>, thrust modifier

◆ ShiftDown()

proto native void Transport::ShiftDown ( )
private

◆ ShiftTo()

proto native void Transport::ShiftTo ( CarGear gear)
private

◆ ShiftUp()

proto native void Transport::ShiftUp ( )
private

◆ WheelCount()

proto native int Transport::WheelCount ( )
private

How many wheel can be attached to a car (hubs only)

◆ WheelCountPresent()

proto native int Transport::WheelCountPresent ( )
private

Number of actually attached wheels (hubs only)

◆ WheelIsAnyLocked()

proto native bool Transport::WheelIsAnyLocked ( )
private

Returns true if any of the wheels are locked in terms of its movement.

◆ WheelIsLocked()

proto native bool Transport::WheelIsLocked ( int wheelIdx)
private

Returns true if given wheel is locked in terms of its movement.

Parameters
[in]wheelIdxindex of the wheel, they are counted from left-front to rear-right

The documentation for this class was generated from the following file: