DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Car.c
См. документацию.
1
4{
5 // simulation
9
10 // miscellaneous
13};
14
15
16
30
31
32
39
40
41
43enum CarGear
44{
47 FIRST,
48 SECOND,
63};
64
65
66
75
76
84
85
86
88class Car extends Transport
89{
92
94 proto native float GetSpeedometer();
95
98 {
100 }
101
102 override bool IsAreaAtDoorFree( int currentSeat, float maxAllowedObjHeight = 0.5, float horizontalExtents = 0.5, float playerHeight = 1.7 )
103 {
104 vector transform[4];
105
106 vector extents;
107
108 extents[0] = horizontalExtents;
109 extents[1] = playerHeight;
110 extents[2] = horizontalExtents;
111
112 float speed = GetSpeedometerAbsolute();
113 if (speed > 8)
114 extents[2] = extents[2] * 6;
115 if (speed > 8)
116 extents[0] = 2;
117
118 return IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform );
119 }
120
121 override Shape DebugFreeAreaAtDoor( int currentSeat, float maxAllowedObjHeight = 0.5, float horizontalExtents = 0.5, float playerHeight = 1.7 )
122 {
123 int color = ARGB(20, 0, 255, 0);
124
125 vector transform[4];
126
127 vector extents;
128
129 extents[0] = horizontalExtents;
130 extents[1] = playerHeight;
131 extents[2] = horizontalExtents;
132
133 float speed = GetSpeedometerAbsolute();
134 if (speed > 8)
135 extents[2] = extents[2] * 6;
136 if (speed > 8)
137 extents[0] = 2;
138
139 if (!IsAreaAtDoorFree( currentSeat, maxAllowedObjHeight, extents, transform ))
140 {
141 color = ARGB(20, 255, 0, 0);
142 }
143
144 Shape shape = Debug.DrawBox(-extents * 0.5, extents * 0.5, color);
145 shape.SetMatrix(transform);
146 return shape;
147 }
148
149 protected bool DetectFlippedUsingWheels(VehicleFlippedContext ctx, bool disallowSide)
150 {
151 if (disallowSide && (vector.Dot(GetDirectionUp(), vector.Up) < 0.7))
152 {
153 // return as "flipped", vehicle isn't pointing enough up to be reasonably certain
154 return true;
155 }
156
157 int wheelCount = WheelCount();
158
159 for (int wheelIdx = 0; wheelIdx < wheelCount; wheelIdx++)
160 {
161 if (!WheelHasContact(wheelIdx))
162 {
163 // wheel not in contact, then we could be flipped, we assume there exist other predicates
164 return true;
165 }
166 }
167
168 // all wheels in contact (or zero registered wheels), then we are in contact
169 return false;
170 }
171
172//-----------------------------------------------------------------------------
173// controls
174
176 proto native float GetSteering();
183 proto native void SetSteering( float in, bool analog = false );
184
186 proto native float GetThrustTurbo();
188 proto native float GetThrustGentle();
190 proto native float GetThrust();
198 proto native void SetThrust( float in, float gentle = 0, float turbo = 0 );
199
201 proto native float GetBrake();
208 proto native void SetBrake( float in, float panic = 0, bool gentle = false );
209
211 proto native float GetHandbrake();
217 proto native void SetHandbrake( float in );
218
222 proto native void SetBrakesActivateWithoutDriver( bool activate = true );
223
225 proto native float GetClutch();
229 proto native void SetClutchState( bool in );
230
232 proto native int GetGear();
233
234 proto native void ShiftUp();
235 proto native void ShiftTo( CarGear gear );
236 proto native void ShiftDown();
237
238//-----------------------------------------------------------------------------
239
240//-----------------------------------------------------------------------------
241// fluids
242
248 proto native float GetFluidCapacity( CarFluid fluid );
249
256 proto native float GetFluidFraction( CarFluid fluid );
257
259 proto native void Leak( CarFluid fluid, float amount );
260
262 proto native void LeakAll( CarFluid fluid );
263
265 proto native void Fill( CarFluid fluid, float amount );
266
275 void OnFluidChanged( CarFluid fluid, float newValue, float oldValue ) {}
276//-----------------------------------------------------------------------------
277
278
279//-----------------------------------------------------------------------------
280// engine
281
283 proto native float EngineGetRPMMin();
284
286 proto native float EngineGetRPMIdle();
287
289 proto native float EngineGetRPMMax();
290
292 proto native float EngineGetRPMRedline();
293
295 proto native float EngineGetRPM();
296
298 proto native bool EngineIsOn();
299
301 proto native void EngineStart();
302
309 {
310 // engine can start by default
311 return true;
312 }
313
316
318 proto native void EngineStop();
319
321 void OnEngineStop() {}
322
324 proto native vector GetEnginePos();
326 proto native void SetEnginePos(vector pos);
327
328//-----------------------------------------------------------------------------
329
330
331//-----------------------------------------------------------------------------
332// gearbox
333
335 proto native int GetGearsCount();
336
339
342
349 void OnGearChanged( int newGear, int oldGear )
350 {
351 }
352//-----------------------------------------------------------------------------
353
354
355//-----------------------------------------------------------------------------
356// wheels
357
359 proto native bool WheelIsAnyLocked();
365 proto native float WheelGetAngularVelocity( int wheelIdx );
371 proto native bool WheelHasContact( int wheelIdx );
377 proto native vector WheelGetContactPosition( int wheelIdx );
383 proto native vector WheelGetContactNormal( int wheelIdx );
389 proto native vector WheelGetDirection( int wheelIdx );
395 proto native SurfaceInfo WheelGetSurface( int wheelIdx );
401 proto native CarWheelWaterState WheelGetWaterState( int wheelIdx );
407 proto native EntityAI WheelGetEntity( int wheelIdx );
413 proto native bool WheelIsLocked( int wheelIdx );
414
416 proto native int WheelCount();
417
419 proto native int WheelCountPresent();
420
421//-----------------------------------------------------------------------------
422
423
424//-----------------------------------------------------------------------------
425// events
426
435 void OnContact( string zoneName, vector localPos, IEntity other, Contact data ) {}
436
445 float OnSound( CarSoundCtrl ctrl, float oldValue )
446 {
447 // just use the computed value by the game code
448 return oldValue;
449 }
450
459 void OnInput( float dt ) {}
460
465 void OnUpdate( float dt ) {}
466//-----------------------------------------------------------------------------
467
468
469 // implemented only in internal configuration
470 proto native void ForcePosition( vector pos );
471 // implemented only in internal configuration
472 proto native void ForceDirection( vector dir );
473};
474
475
476
479{
480 private void CarController() {}
481 private void ~CarController() {}
482
484 proto float GetSteering();
491 proto void SetSteering( float in, bool analog = false );
492
494 proto float GetThrustTurbo();
496 proto float GetThrustGentle();
498 proto float GetThrust();
506 proto void SetThrust( float in, float gentle = 0, float turbo = 0 );
507
509 proto float GetBrake();
516 proto void SetBrake( float in, float panic = 0 );
517
519 proto int GetGear();
520
521 proto void ShiftUp();
522 proto void ShiftTo( CarGear gear );
523 proto void ShiftDown();
524};
@ SPEED
speed of the boat in km/h
Определения Boat.c:6
@ ENGINE
indicates if engine is ON
Определения Boat.c:5
@ PLAYER
indicates if driver is controlled by player
Определения Boat.c:9
@ FUEL
Определения Boat.c:15
enum CarGearboxType ELEVENTH
CarAutomaticGearboxMode
Enumerated automatic gearbox modes. (native, do not change or extend)
Определения Car.c:69
@ R
reverse
Определения Car.c:71
@ N
neutral
Определения Car.c:72
@ D
drive
Определения Car.c:73
@ P
park
Определения Car.c:70
enum CarGearboxType THIRTEENTH
enum CarGearboxType EIGTH
enum CarGearboxType SECOND
Определения PluginRecipesManagerBase.c:4
enum CarGearboxType FOURTH
enum CarGearboxType NINTH
enum CarGearboxType SIXTEENTH
enum CarGearboxType FIFTH
enum CarGearboxType FIFTEENTH
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Определения Car.c:4
@ RPM
engine's RPM
Определения Car.c:7
@ DOORS
indicates if doors are open
Определения Car.c:11
CarWheelWaterState
Enumerated car wheel water state. (native, do not change or extend)
Определения Car.c:79
@ ON_LAND
if the wheel is on or above land
Определения Car.c:80
@ UNDER_WATER
if the wheel is under a water plane
Определения Car.c:82
@ IN_WATER
if the wheel is partially within some water plane
Определения Car.c:81
enum CarGearboxType SEVENTH
enum CarGearboxType SIXTH
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
Определения Car.c:19
@ OIL
Определения Car.c:21
@ BRAKE
Определения Car.c:22
@ COOLANT
Определения Car.c:23
enum CarGearboxType THIRD
enum CarGearboxType REVERSE
Enumerated vehicle's gears. (native, do not change or extend)
CarGearboxType
Enumerated gearbox types. (native, do not change or extend)
Определения Car.c:35
@ AUTOMATIC
automatic transmission with torque converter between engine and gearbox
Определения Car.c:37
@ MANUAL
classic manual transmission with friction plates between engine and gearbox
Определения Car.c:36
enum CarGearboxType FIRST
Определения PluginRecipesManagerBase.c:3
enum CarGearboxType TENTH
enum CarGearboxType TWELFTH
enum CarGearboxType FOURTEENTH
enum CarGearboxType NEUTRAL
proto float GetThrust()
Returns the current thrust value in range <0, 1>.
proto float GetSteering()
Returns the current steering value in range <-1, 1>.
proto void ShiftUp()
proto void ShiftDown()
proto float GetThrustTurbo()
Returns the current thrust turbo modifier value in range <0, 1>.
proto void SetSteering(float in, bool analog=false)
void ~CarController()
Определения Car.c:481
proto float GetBrake()
Returns the current brake value in range <0, 1>.
proto void SetThrust(float in, float gentle=0, float turbo=0)
proto void ShiftTo(CarGear gear)
proto float GetThrustGentle()
Returns the current thrust gentle modifier value in range <0, 1>.
proto int GetGear()
Returns index of the current gear.
proto void SetBrake(float in, float panic=0)
void CarController()
Определения Car.c:480
DEPRECATED class left for backwards compatibility, methods are available on car itself now.
Определения Car.c:479
Определения EnPhysics.c:305
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Определения Debug.c:286
Определения Debug.c:2
Определения Building.c:6
Определения EnEntity.c:165
Определения EnMath.c:7
Определения SurfaceInfo.c:9
proto native void SetThrust(float in, float gentle=0, float turbo=0)
float OnSound(CarSoundCtrl ctrl, float oldValue)
Определения Car.c:445
proto native float GetHandbrake()
Returns the current handbrake value in range <0, 1>.
void OnInput(float dt)
Определения Car.c:459
proto native vector WheelGetContactNormal(int wheelIdx)
proto native void ShiftTo(CarGear gear)
proto native void ShiftUp()
void OnUpdate(float dt)
Определения Car.c:465
proto native bool WheelHasContact(int wheelIdx)
proto native void SetEnginePos(vector pos)
Override the position of engine (model space)
void OnEngineStop()
Is called every time the engine stops.
Определения Car.c:321
proto native void Fill(CarFluid fluid, float amount)
Adds to the specified fluid the specified amount.
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 EngineGetRPM()
Returns engine's rpm value.
proto native void ShiftDown()
proto native float WheelGetAngularVelocity(int wheelIdx)
proto native CarWheelWaterState WheelGetWaterState(int wheelIdx)
float GetSpeedometerAbsolute()
Returns the current speed of the vehicle in km/h. Value is absolute.
Определения Car.c:97
proto native void Leak(CarFluid fluid, float amount)
Removes from the specified fluid the specified amount.
proto native float EngineGetRPMIdle()
Returns engine's idle rpm before engine stalls.
proto native int WheelCountPresent()
Number of actually attached wheels (hubs only)
proto native void SetHandbrake(float in)
proto native bool EngineIsOn()
Returns true when engine is running, false otherwise.
proto native void SetBrake(float in, float panic=0, bool gentle=false)
proto native EntityAI WheelGetEntity(int wheelIdx)
proto native CarAutomaticGearboxMode GearboxGetMode()
Returns gearbox mode. This is useful when car has automatic gearbox.
proto native int WheelCount()
How many wheel can be attached to a car (hubs only)
proto native void EngineStart()
Starts the engine.
proto native float EngineGetRPMMin()
Returns engine's min operating rpm.
proto native bool WheelIsAnyLocked()
Returns true if any of the wheels are locked in terms of its movement.
proto native CarController GetController()
DEPRECATED, left for backwards compatibility, the methods of this class are now directly accessible o...
proto native void ForceDirection(vector dir)
proto native void EngineStop()
Stops the engine.
proto native float GetBrake()
Returns the current brake value in range <0, 1>.
proto native void SetSteering(float in, bool analog=false)
proto native float GetThrust()
Returns the current thrust value in range <0, 1>.
proto native float GetClutch()
Returns the current clutch value in range <0, 1>.
proto native vector WheelGetDirection(int wheelIdx)
proto native bool WheelIsLocked(int wheelIdx)
override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Определения Car.c:102
void OnContact(string zoneName, vector localPos, IEntity other, Contact data)
Определения Car.c:435
proto native void LeakAll(CarFluid fluid)
Removes all the specified fluid from vehicle.
proto native float GetSpeedometer()
Returns the current speed of the vehicle in km/h.
proto native float GetFluidFraction(CarFluid fluid)
proto native vector WheelGetContactPosition(int wheelIdx)
proto native SurfaceInfo WheelGetSurface(int wheelIdx)
proto native int GetGear()
Returns index of the current gear.
proto native CarGearboxType GearboxGetType()
Returns gearbox type. See CarGearboxType enum for more info.
bool DetectFlippedUsingWheels(VehicleFlippedContext ctx, bool disallowSide)
Определения Car.c:149
proto native float GetFluidCapacity(CarFluid fluid)
proto native float EngineGetRPMMax()
Returns engine's max rpm before engine blows up.
proto native void ForcePosition(vector pos)
proto native void SetBrakesActivateWithoutDriver(bool activate=true)
void OnGearChanged(int newGear, int oldGear)
Определения Car.c:349
override Shape DebugFreeAreaAtDoor(int currentSeat, float maxAllowedObjHeight=0.5, float horizontalExtents=0.5, float playerHeight=1.7)
Определения Car.c:121
bool OnBeforeEngineStart()
Определения Car.c:308
proto native float EngineGetRPMRedline()
Returns engine's maximal working rpm without damaging the engine.
proto native float GetSteering()
Returns the current steering value in range <-1, 1>.
void OnEngineStart()
Is called every time the engine starts.
Определения Car.c:315
proto native vector GetEnginePos()
Get actual position of engine (model space)
proto native int GetGearsCount()
Returns total number of gears.
proto native void SetClutchState(bool in)
void OnFluidChanged(CarFluid fluid, float newValue, float oldValue)
Определения Car.c:275
Base native class for all motorized wheeled vehicles.
Определения Boat.c:28
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Определения EnConvert.c:271
static const vector Up
Определения EnConvert.c:107
Определения EnConvert.c:106
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
@ USER4
Определения EnEntity.c:156
@ USER1
Flags for custom usage and filterings.
Определения EnEntity.c:153
@ USER2
Определения EnEntity.c:154
@ USER3
Определения EnEntity.c:155
static proto float AbsFloat(float f)
Returns absolute value.
int ARGB(int a, int r, int g, int b)
Определения proto.c:322