Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
car.c
Go to the documentation of this file.
1 
4 {
5  // simulation
7  RPM,
8  SPEED,
9 
10  // miscellaneous
13 };
14 
15 
16 
19 {
21  OIL,
24 
29 };
30 
31 
32 
35 {
38 }
39 
40 
41 
43 enum CarGear
44 {
45  REVERSE,
46  NEUTRAL,
47  FIRST,
48  SECOND,
49  THIRD,
50  FOURTH,
51  FIFTH,
52  SIXTH,
53  SEVENTH,
54  EIGTH,
55  NINTH,
56  TENTH,
57  ELEVENTH,
58  TWELFTH,
59  THIRTEENTH,
60  FOURTEENTH,
61  FIFTEENTH,
62  SIXTEENTH
63 };
64 
65 
66 
69 {
70  P,
71  R,
72  N,
73  D
74 };
75 
76 
77 
79 class Car extends Transport
80 {
82  proto native CarController GetController();
83 
85  proto native float GetSpeedometer();
86 
88  float GetSpeedometerAbsolute()
89  {
90  return Math.AbsFloat(GetSpeedometer());
91  }
92 
93  override bool IsAreaAtDoorFree( int currentSeat, float maxAllowedObjHeight = 0.5, float horizontalExtents = 0.5, float playerHeight = 1.7 )
94  {
95  vector transform[4];
96 
97  vector extents;
98 
99  extents[0] = horizontalExtents;
100  extents[1] = playerHeight;
101  extents[2] = horizontalExtents;
102 
103  float speed = GetSpeedometerAbsolute();
104  if (speed > 8)
105  extents[2] = extents[2] * 6;
106  if (speed > 8)
107  extents[0] = 2;
108 
109  return IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform );
110  }
111 
112  override Shape DebugFreeAreaAtDoor( int currentSeat, float maxAllowedObjHeight = 0.5, float horizontalExtents = 0.5, float playerHeight = 1.7 )
113  {
114  int color = ARGB(20, 0, 255, 0);
115 
116  vector transform[4];
117 
118  vector extents;
119 
120  extents[0] = horizontalExtents;
121  extents[1] = playerHeight;
122  extents[2] = horizontalExtents;
123 
124  float speed = GetSpeedometerAbsolute();
125  if (speed > 8)
126  extents[2] = extents[2] * 6;
127  if (speed > 8)
128  extents[0] = 2;
129 
130  if (!IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform ))
131  {
132  color = ARGB(20, 255, 0, 0);
133  }
134 
135  Shape shape = Debug.DrawBox(-extents * 0.5, extents * 0.5, color);
136  shape.SetMatrix(transform);
137  return shape;
138  }
139 
140  override int GetHideIconMask()
141  {
142  return EInventoryIconVisibility.HIDE_VICINITY;
143  }
144 
145 //-----------------------------------------------------------------------------
146 // controls
147 
149  proto native float GetSteering();
156  proto native void SetSteering( float in, bool analog = false );
157 
159  proto native float GetThrustTurbo();
161  proto native float GetThrustGentle();
163  proto native float GetThrust();
171  proto native void SetThrust( float in, float gentle = 0, float turbo = 0 );
172 
174  proto native float GetBrake();
181  proto native void SetBrake( float in, float panic = 0, bool gentle = false );
182 
184  proto native float GetHandbrake();
190  proto native void SetHandbrake( float in );
191 
195  proto native void SetBrakesActivateWithoutDriver( bool activate = true );
196 
198  proto native float GetClutch();
202  proto native void SetClutchState( bool in );
203 
205  proto native int GetGear();
206 
207  proto native void ShiftUp();
208  proto native void ShiftTo( CarGear gear );
209  proto native void ShiftDown();
210 
211 //-----------------------------------------------------------------------------
212 
213 //-----------------------------------------------------------------------------
214 // fluids
215 
221  proto native float GetFluidCapacity( CarFluid fluid );
222 
229  proto native float GetFluidFraction( CarFluid fluid );
230 
232  proto native void Leak( CarFluid fluid, float amount );
233 
235  proto native void LeakAll( CarFluid fluid );
236 
238  proto native void Fill( CarFluid fluid, float amount );
239 
248  void OnFluidChanged( CarFluid fluid, float newValue, float oldValue ) {}
249 //-----------------------------------------------------------------------------
250 
251 
252 //-----------------------------------------------------------------------------
253 // engine
254 
256  proto native float EngineGetRPMMin();
257 
259  proto native float EngineGetRPMIdle();
260 
262  proto native float EngineGetRPMMax();
263 
265  proto native float EngineGetRPMRedline();
266 
268  proto native float EngineGetRPM();
269 
271  proto native bool EngineIsOn();
272 
274  proto native void EngineStart();
275 
281  bool OnBeforeEngineStart()
282  {
283  // engine can start by default
284  return true;
285  }
286 
288  void OnEngineStart() {}
289 
291  proto native void EngineStop();
292 
294  void OnEngineStop() {}
295 
297  proto native vector GetEnginePos();
299  proto native void SetEnginePos(vector pos);
300 
301 //-----------------------------------------------------------------------------
302 
303 
304 //-----------------------------------------------------------------------------
305 // gearbox
306 
308  proto native int GetGearsCount();
309 
311  proto native CarGearboxType GearboxGetType();
312 
314  proto native CarAutomaticGearboxMode GearboxGetMode();
315 
322  void OnGearChanged( int newGear, int oldGear )
323  {
324  }
325 //-----------------------------------------------------------------------------
326 
327 
328 //-----------------------------------------------------------------------------
329 // wheels
330 
332  proto native bool WheelIsAnyLocked();
338  proto native bool WheelIsLocked( int wheelIdx );
339 
341  proto native int WheelCount();
342 
344  proto native int WheelCountPresent();
345 
346 //-----------------------------------------------------------------------------
347 
348 
349 //-----------------------------------------------------------------------------
350 // events
351 
360  void OnContact( string zoneName, vector localPos, IEntity other, Contact data ) {}
361 
370  float OnSound( CarSoundCtrl ctrl, float oldValue )
371  {
372  // just use the computed value by the game code
373  return oldValue;
374  }
375 
384  void OnInput( float dt ) {}
385 
390  void OnUpdate( float dt ) {}
391 //-----------------------------------------------------------------------------
392 
393 
394  // implemented only in internal configuration
395  proto native void ForcePosition( vector pos );
396  // implemented only in internal configuration
397  proto native void ForceDirection( vector dir );
398 };
399 
400 
401 
404 {
405  private void CarController() {}
406  private void ~CarController() {}
407 
409  proto float GetSteering();
416  proto void SetSteering( float in, bool analog = false );
417 
419  proto float GetThrustTurbo();
421  proto float GetThrustGentle();
423  proto float GetThrust();
431  proto void SetThrust( float in, float gentle = 0, float turbo = 0 );
432 
434  proto float GetBrake();
441  proto void SetBrake( float in, float panic = 0 );
442 
444  proto int GetGear();
445 
446  proto void ShiftUp();
447  proto void ShiftTo( CarGear gear );
448  proto void ShiftDown();
449 };
OnFluidChanged
override void OnFluidChanged(CarFluid fluid, float newValue, float oldValue)
Definition: carscript.c:1519
THIRTEENTH
enum CarGearboxType THIRTEENTH
OnSound
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Definition: carscript.c:1301
GetHideIconMask
override int GetHideIconMask()
Definition: basebuildingbase.c:87
FIRST
enum CarGearboxType FIRST
Definition: pluginrecipesmanagerbase.c:3
FUEL
@ FUEL
Definition: car.c:20
OnEngineStart
override void OnEngineStart()
Gets called everytime the engine starts.
Definition: carscript.c:1612
ELEVENTH
enum CarGearboxType ELEVENTH
N
@ N
neutral
Definition: car.c:72
USER4
@ USER4
reserved for user / modding support
Definition: car.c:28
OnBeforeEngineStart
override bool OnBeforeEngineStart()
Definition: carscript.c:1547
USER3
@ USER3
reserved for user / modding support
Definition: car.c:27
gear
< h scale="0.8">< image set="dayz_gui" name="icon_pin"/> Welcome to the DayZ Stress Test Branch</h >< h scale="0.6"> This branch serves for time limited development tests that are open to the community Our goal in each of these tests is to gather performance and stability data from servers under heavy load</h ></br >< h scale="0.8">< image set="dayz_gui" name="icon_pin"/> Stress test Schedule</h >< h scale="0.6"> We ll only run the Stress Tests when our development team needs data and or specific feedback Stress Tests will be announced on our Twitter and and will usually run for a couple of hours</h ></br >< h scale="0.8">< image set="dayz_gui" name="icon_pin"/> Current Stress Test</h >< h scale="0.6"> In the first bunch of Stress we ll mostly focus on watching server performance under heavy PvP gameplay load For detailed information about an ongoing Stress please visit dayz com dev hub</h ></br >< h scale="0.8">< image set="dayz_gui" name="icon_pin"/> Important Note</h >< h scale="0.6"> Stress Tests do not represent a typical DayZ gameplay experience Spawn starting gear
Definition: news_feed.txt:26
OnContact
override void OnContact(string zoneName, vector localPos, IEntity other, Contact data)
WARNING: Can be called very frequently in one frame, use with caution.
Definition: carscript.c:1110
TENTH
enum CarGearboxType TENTH
CarController
DEPRECATED class left for backwards compatibility, methods are available on car itself now.
Definition: car.c:403
NINTH
enum CarGearboxType NINTH
RPM
@ RPM
engine's RPM
Definition: car.c:7
CarSoundCtrl
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition: car.c:3
THIRD
enum CarGearboxType THIRD
IEntity
Definition: enentity.c:164
AUTOMATIC
@ AUTOMATIC
automatic transmission with torque converter between engine and gearbox
Definition: car.c:37
SEVENTH
enum CarGearboxType SEVENTH
CarGearboxType
CarGearboxType
Enumerated gearbox types. (native, do not change or extend)
Definition: car.c:34
CarFluid
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Definition: car.c:18
vector
Definition: enconvert.c:105
SIXTEENTH
enum CarGearboxType SIXTEENTH
NEUTRAL
enum CarGearboxType NEUTRAL
BRAKE
@ BRAKE
Definition: car.c:22
ENGINE
@ ENGINE
indicates if engine is ON
Definition: car.c:6
R
@ R
reverse
Definition: car.c:71
SECOND
enum CarGearboxType SECOND
Definition: pluginrecipesmanagerbase.c:4
OnUpdate
proto native void OnUpdate()
Definition: tools.c:349
USER1
@ USER1
reserved for user / modding support
Definition: car.c:25
Transport
Base native class for all motorized wheeled vehicles.
Definition: car.c:79
OnGearChanged
override void OnGearChanged(int newGear, int oldGear)
Definition: carscript.c:1605
Contact
Definition: enphysics.c:300
SIXTH
enum CarGearboxType SIXTH
FIFTH
enum CarGearboxType FIFTH
P
@ P
park
Definition: car.c:70
FOURTEENTH
enum CarGearboxType FOURTEENTH
TWELFTH
enum CarGearboxType TWELFTH
COOLANT
@ COOLANT
Definition: car.c:23
MANUAL
@ MANUAL
classic manual transmission with friction plates between engine and gearbox
Definition: car.c:36
USER2
@ USER2
reserved for user / modding support
Definition: car.c:26
OIL
@ OIL
Definition: car.c:21
PLAYER
@ PLAYER
indicates if driver is controlled by player
Definition: car.c:12
DOORS
@ DOORS
indicates if doors are open
Definition: car.c:11
Debug
Definition: debug.c:13
FIFTEENTH
enum CarGearboxType FIFTEENTH
SPEED
@ SPEED
speed of the car in km/h
Definition: car.c:8
EIGTH
enum CarGearboxType EIGTH
Math
Definition: enmath.c:6
FOURTH
enum CarGearboxType FOURTH
ARGB
int ARGB(int a, int r, int g, int b)
Definition: proto.c:322
Shape
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
CarAutomaticGearboxMode
CarAutomaticGearboxMode
Enumerated automatic gearbox modes. (native, do not change or extend)
Definition: car.c:68
D
@ D
drive
Definition: car.c:73
OnEngineStop
override void OnEngineStop()
Gets called everytime the engine stops.
Definition: carscript.c:1628
REVERSE
enum CarGearboxType REVERSE
Enumerated vehicle's gears. (native, do not change or extend)