DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
MotorbikeScript.c
См. документацию.
6
7enum MotorbikeRearLightType
8{
9 NONE,
12 BRAKES_AND_REVERSE
13}
14
15enum EMotorbikeOperationalState
16{
17 OK = 0,
18 RUINED = 1,
21}
22
23class MotorbikeScriptOwnerState : MotorbikeOwnerState
24{
25};
26
27class MotorbikeScriptMove : MotorbikeMove
28{
29};
30
31#ifdef DIAG_DEVELOPER
32enum EMotorbikeDebugMode
33{
34 NONE,
35 FORWARD_10,
36 FORWARD_50,
37};
38
39MotorbikeScript _motorbike;
40#endif
41
52
53class MotorbikeScript : Motorbike
54{
55 protected static float DROWN_ENGINE_THRESHOLD = 0.5;
56 protected static float DROWN_ENGINE_DAMAGE = 150.0;
57 protected static float WATER_DEPTH_PLAYER_EJECT = 1.2;
58
59 // TODO(kumarjac): VERY VERY VERY TEMPORARY, REMOVE THIS!
61
62 protected float m_Time;
63
64 protected float m_EngineHealth;
65 protected float m_FuelTankHealth;
66 protected float m_BatteryHealth;
67 protected float m_PlugHealth;
68
69 protected static string m_HeadLightPoint = "light_1_1";
70 protected static string m_HeadLightTargetPoint = "light_1_1_dir";
71 protected static string m_RearLightPoint = "light_1_2_reverse";
73
77
79 protected float m_DrownTime;
80 protected static vector m_DrownEnginePos;
81
82 protected float m_HeatComfortOverride;
83
86
88 protected string m_EngineStarting = "";
89 protected string m_EngineStartOK = "";
90 protected string m_EngineStartBattery = "";
91 protected string m_EngineStartPlug = "";
92 protected string m_EngineStartFuel = "";
93 protected string m_EngineStop = "";
94 protected string m_EngineStopFuel = "";
96
97#ifdef DIAG_DEVELOPER
98 EMotorbikeDebugMode m_DebugMode;
99
100 private const int DEBUG_MESSAGE_CLEAN_TIME_SECONDS = 10;
101 private float m_DebugMessageCleanTime;
102 private string m_DebugContactDamageMessage;
103#endif
104
106 {
107 #ifdef DIAG_DEVELOPER
108 _motorbike = this;
109 #endif
110
111 SetEventMask(EntityEvent.POSTSIMULATE|EntityEvent.POSTFRAME);
112
114 m_LightsComponent.RegisterSelection("FrontOn", {new VehicleLightSelectionData(0, "frontReflectorMatOn")});
115 m_LightsComponent.RegisterSelection("FrontOff", {new VehicleLightSelectionData(0, "frontReflectorMatOff")});
116 m_LightsComponent.RegisterSelection("BrakeOn", {new VehicleLightSelectionData(1, "brakeReflectorMatOn")});
117 m_LightsComponent.RegisterSelection("BrakeOff", {new VehicleLightSelectionData(1, "brakeReflectorMatOff")});
118 m_LightsComponent.RegisterSelection("TailOn", {new VehicleLightSelectionData(2, "TailReflectorMatOn")});
119 m_LightsComponent.RegisterSelection("TailOff", {new VehicleLightSelectionData(2, "TailReflectorMatOff")});
120
121 m_LightsComponent.RegisterSelection("DashboardOn", {new VehicleLightSelectionData(3, "dashboardMatOn")});
122 m_LightsComponent.RegisterSelection("DashboardOff", {new VehicleLightSelectionData(3, "dashboardMatOff")});
123
124 m_LightsComponent.RegisterLight("Front", new VehicleLightData(new VehicleLightProfileFront()));
125 m_LightsComponent.RegisterLight("Rear", new VehicleLightData(new VehicleLightProfileRear()));
126
129
130 m_EngineHealth = 1;
132 m_BatteryHealth = -1;
133 m_PlugHealth = -1;
134
136
138
140
141 SetKickstand(1);
142
143 RegisterNetSyncVariableBool("m_BrakesArePressed");
144 RegisterNetSyncVariableBoolSignal("m_PlayCrashSoundLight");
145 RegisterNetSyncVariableBoolSignal("m_PlayCrashSoundHeavy");
146
147 RegisterNetSyncVariableInt("m_HornComponent.m_Mode", VehicleHornMode.OFF, VehicleHornMode.COUNT);
148 }
149
151 {
152 #ifndef SERVER
154 #endif
155 }
156
157 override void EEDelete(EntityAI parent)
158 {
159 #ifndef SERVER
161 #endif
162 }
163
165 {
167 }
168
170 {
171 return false;
172 }
173
174 protected void InitializeParticles()
175 {
176 if (g_Game.IsDedicatedServer())
177 return;
178
180
181 m_DrownEnginePos = m_VFXComponent.ConvertMemPointToPosition("engine");
182
183 vector exhaustPosition = m_VFXComponent.ConvertMemPointToPosition("ptcExhaust_end");
184 vector exhaustDirection;
185 if (exhaustPosition != vector.Zero)
186 {
187 vector exhaustStart = m_VFXComponent.ConvertMemPointToPosition("ptcExhaust_start");
188 vector tempOri = vector.Direction(exhaustStart, exhaustPosition);
189
190 exhaustDirection[0] = -tempOri[2];
191 exhaustDirection[1] = tempOri[1];
192 exhaustDirection[2] = tempOri[0];
193
194 exhaustDirection = exhaustDirection.Normalized().VectorToAngles();
195 }
196 else
197 exhaustDirection = "1 1 1";
198
199 m_VFXComponent.RegisterEffect(EVehicleVFXEffect.DUST_BEHIND, EffVehicleDust, new VehicleVFXDataParams(m_VFXComponent.ConvertMemPointToPosition("ptcDustPos")));
200 m_VFXComponent.RegisterEffect(EVehicleVFXEffect.ENGINE_SMOKE, EffEngineSmoke, new VehicleVFXDataParams(m_VFXComponent.ConvertMemPointToPosition("ptcEnginePos")));
201 m_VFXComponent.RegisterEffect(EVehicleVFXEffect.EXHAUST_SMOKE, EffExhaustSmoke, new VehicleVFXDataParams(exhaustPosition, exhaustDirection));
202
203 m_VFXComponent.RegisterEffectGroup(EVehicleVFXEffectGroup.WHEEL_SMOKE, EffWheelSmoke, WheelCount(), new VehicleVFXDataParams(vector.Zero, "0 1 -1", 5.0));
204 m_VFXComponent.RegisterEffectGroup(EVehicleVFXEffectGroup.WHEEL_CONTACT, EffWheelContact, WheelCount(), new VehicleVFXDataParams(vector.Zero, vector.Up, 5.0));
205 }
206
208 {
209 return vector.Zero;
210 }
211
216
217 override void OnDriverExit(Human player)
218 {
219 super.OnDriverExit(player);
220
221 if (GetGear() != GetNeutralGear())
222 EngineStop();
223 }
224
225 override bool CanGetIn()
226 {
227 if (!super.CanGetIn())
228 return false;
229
230 return !IsFallen();
231 }
232
233 override void OnStabilityStart()
234 {
235 super.OnStabilityStart();
236 }
237
238 override void OnStabilityStop()
239 {
240 super.OnStabilityStop();
241 }
242
243 override int GetFluidCapacityScript(ETransportFluid fluidType)
244 {
245 return GetFluidCapacity(fluidType);
246 }
247
248 override float GetFluidFractionScript(ETransportFluid fluidType)
249 {
250 return GetFluidFraction(fluidType);
251 }
252
253 override void FillScript(ETransportFluid fluidType, float amount)
254 {
255 Fill(fluidType, amount);
256 }
257
263 override float OnSound(MotorbikeSoundCtrl ctrl, float oldValue)
264 {
265 switch (ctrl)
266 {
267 case MotorbikeSoundCtrl.ENGINE:
268 if (!m_EngineStarted)
269 return 0.0;
270
271 break;
272 }
273
274 return oldValue;
275 }
276
277 override protected EffectSound CreateSoundForAnimationSource(string animSource)
278 {
280 int pivotIndex = -1;
281
282 string selectionName = GetSelectionFromAnimSource(animSource);
283 if (selectionName != "")
284 {
285 position = GetSelectionBasePositionLS(selectionName);
286
287 int level = GetViewGeometryLevel();
288
289 array<int> pivots = new array<int>();
290
291 pivots.Clear();
292 GetBonePivotsForAnimationSource(level, animSource, pivots);
293
294 if (pivots.Count())
295 {
296 pivotIndex = pivots[0];
297 }
298 }
299
300 WaveKind waveKind = WaveKind.WAVEEFFECTEX;
301 EffectSound sound = new EffectSound();
302
303 sound.SetAutodestroy(true);
304 sound.SetParent(this, pivotIndex);
305 sound.SetPosition(ModelToWorld(position));
306 sound.SetLocalPosition(position);
307 sound.SetSoundWaveKind(waveKind);
308
309 return sound;
310 }
311
314 private bool m_ActionsInitialized;
315
316 override string GetVehicleType()
317 {
318 return "VehicleTypeMotorbike";
319 }
320
322 {
323 return false;
324 }
325
327 {
328 return false;
329 }
330
332 {
333 return ModelToWorld(m_DrownEnginePos);
334 }
335
337 {
338 return null;
339 }
340
342 {
344 if (!m_InputActionMap)
345 {
347 m_InputActionMap = iam;
348 SetActions();
349 m_MotorbikeTypeActionsMap.Insert(this.Type(), m_InputActionMap);
350 }
351 }
352
353 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
354 {
356 {
359 }
360
361 actions = m_InputActionMap.Get(action_input_type);
362 }
363
372
373 void AddAction(typename actionName)
374 {
375 ActionBase action = ActionManagerBase.GetAction(actionName);
376
377 if (!action)
378 {
379 Debug.LogError("Action " + actionName + " doesn't exist!");
380 return;
381 }
382
383 typename ai = action.GetInputType();
384 if (!ai)
385 {
386 m_ActionsInitialized = false;
387 return;
388 }
389
390 array<ActionBase_Basic> actionArray = m_InputActionMap.Get(ai);
391
392 if (!actionArray)
393 {
394 actionArray = new array<ActionBase_Basic>;
395 m_InputActionMap.Insert(ai, actionArray);
396 }
397
399 {
400 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action" );
401 }
402
403 actionArray.Insert(action);
404 }
405
406 void RemoveAction(typename actionName)
407 {
408 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
409 ActionBase action = player.GetActionManager().GetAction(actionName);
410 typename ai = action.GetInputType();
411 array<ActionBase_Basic> actionArray = m_InputActionMap.Get(ai);
412
413 if (actionArray)
414 {
415 actionArray.RemoveItem(action);
416 }
417 }
418
419 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
420 {
421 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
422
423 if (newLevel == GameConstants.STATE_RUINED && oldLevel != newLevel)
424 {
425 switch (zone)
426 {
427 case "Engine":
428 #ifndef SERVER
429 if (g_Game.GetWaterDepth(GetEnginePosWS()) <= 0)
430 {
431 m_VFXComponent.PlayEffect(EVehicleVFXEffect.ENGINE_SMOKE);
433 }
434 #endif
435 break;
436 }
437 }
438 }
439
440 override void EEOnCECreate()
441 {
442
443 float maxVolume = GetFluidCapacity( MotorbikeFluid.FUEL );
444 float amount = Math.RandomFloat(0.0, maxVolume * 0.35 );
445
446 Fill( MotorbikeFluid.FUEL, amount );
447 }
448
449 override int GetSeatAnimationType(int posIdx)
450 {
451 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
452 }
453
458
459 override bool CrewCanEject(int posIdx)
460 {
461 return true;
462 }
463
464 override bool CrewShouldEject(int posIdx)
465 {
466 return IsFallen();
467 }
468
469 override bool CrewCanGetThrough(int posIdx)
470 {
471 return true;
472 }
473
474 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
475 {
476 return true;
477 }
478
479 override bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance = 1.0)
480 {
482 if (pSeatSelection.Length() > 0)
483 {
484 if (MemoryPointExists(pSeatSelection))
485 {
486 vector conditionPointMS = GetMemoryPointPos(pSeatSelection);
487 vector conditionPointWS = ModelToWorld(conditionPointMS);
488
490 conditionPointWS[1] = 0;
491 pFromPos[1] = 0;
492
493 if (vector.Distance(pFromPos, conditionPointWS) <= pDistance)
494 return true;
495 }
496 }
497
498 return false;
499 }
500
501 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
502 {
503 return true;
504 }
505
507 {
508 super.OnVariablesSynchronized();
509
510 if (GetCrashHeavySound())
511 PlayCrashHeavySound();
512 else if (GetCrashLightSound())
513 PlayCrashLightSound();
514
517
518 m_HornComponent.HandleSound();
519
520 UpdateLights();
521 }
522
523 override void EEItemAttached(EntityAI item, string slot_name)
524 {
525 super.EEItemAttached(item, slot_name);
526
527 switch (slot_name)
528 {
529 case "Reflector_1_1":
530 if (g_Game.IsServer())
531 {
532 SetHealth("Reflector_1_1", "Health", item.GetHealth());
533 }
534 break;
535 case "CarBattery":
536 case "TruckBattery":
537 if (g_Game.IsServer())
538 {
539 m_BatteryHealth = item.GetHealth01();
540 }
541 break;
542 case "SparkPlug":
543 case "GlowPlug":
544 if (g_Game.IsServer())
545 {
546 m_PlugHealth = item.GetHealth01();
547 }
548 break;
549 }
550
551 if (g_Game.IsServer())
552 {
553 HandleHeatComfortOverrides(slot_name, item);
554 Synchronize();
555 }
556
558 UpdateLights();
559 }
560
561 override void EEItemDetached(EntityAI item, string slot_name)
562 {
563 super.EEItemDetached(item, slot_name);
564
565 switch (slot_name)
566 {
567 case "CarBattery":
568 case "TruckBattery":
569 m_BatteryHealth = -1;
570 if (g_Game.IsServer())
571 {
572 if (EngineIsOn())
573 EngineStop();
574 }
575
576 if (g_Game.IsServer())
577 {
578 LightOff();
579
580 UpdateBattery(ItemBase.Cast(item));
581 }
582
583 break;
584
585 case "SparkPlug":
586 case "GlowPlug":
587 m_PlugHealth = -1;
588 if (g_Game.IsServer() && EngineIsOn())
589 EngineStop();
590
591 break;
592 }
593
594 if (g_Game.IsServer())
595 {
596 HandleHeatComfortOverrides(slot_name, item, true);
597 Synchronize();
598 }
599
601 UpdateLights();
602 }
603
604 override void OnAttachmentRuined(EntityAI attachment)
605 {
606 super.OnAttachmentRuined(attachment);
607
609 UpdateLights();
610 }
611
612 override void EOnPostFrame(IEntity other, int extra)
613 {
614 if (!g_Game.IsDedicatedServer())
615 {
616 float motorbikeSpeed = GetVelocity(this).Length();
617 ParticleParamsOverrideData particleParamsData;
618
619 if (EngineIsOn())
620 {
621 if (!m_VFXComponent.IsEffectPlayed(EVehicleVFXEffect.EXHAUST_SMOKE))
622 {
623 particleParamsData = m_VFXComponent.GetParticleParamsOverrideData(EVehicleVFXEffect.EXHAUST_SMOKE);
624 particleParamsData.m_FloatModifiers.InsertAt(motorbikeSpeed, 0);
625 m_VFXComponent.PlayEffect(EVehicleVFXEffect.EXHAUST_SMOKE);
626 m_VFXComponent.SetEffectParticleState(EVehicleVFXEffect.EXHAUST_SMOKE, ParticleList.HATCHBACK_EXHAUST_SMOKE);
627 }
628 }
629 else
630 {
631 if (!g_Game.IsDedicatedServer())
632 m_VFXComponent.StopEffect(EVehicleVFXEffect.EXHAUST_SMOKE);
633 }
634
636 {
637 string surface;
638
639 if (motorbikeSpeed > EffVehicleDust.WHEEL_DUST_THRESHOLD)
640 {
641 if (particleParamsData)
642 {
643 particleParamsData.ClearAll();
644 particleParamsData = m_VFXComponent.GetParticleParamsOverrideData(EVehicleVFXEffect.DUST_BEHIND);
645 particleParamsData.m_FloatModifiers.InsertAt(motorbikeSpeed, 0);
646 particleParamsData.m_FloatModifiers.InsertAt(GetWeightCoef(), 1);
647 m_VFXComponent.PlayEffect(EVehicleVFXEffect.DUST_BEHIND);
648 }
649 }
650 else
651 m_VFXComponent.StopEffect(EVehicleVFXEffect.DUST_BEHIND);
652
653
654 int wheelCount = WheelCount();
655 TVectorArray wheelsPosition = new TVectorArray();
656
657 int i;
658 for (i = 0; i < wheelCount; ++i)
659 wheelsPosition.InsertAt(Vector(-1, -1, -1), i);
660
661 for (i = 0; i < wheelCount; ++i)
662 {
663 CarWheel wheel = CarWheel.Cast(WheelGetEntity(i));
664 if (!wheel)
665 break;
666
667 vector wheelPos;
668 if (m_VFXComponent.CanPlayEffectGroup(EVehicleVFXEffectGroup.WHEEL_SMOKE))
669 {
670 if (WheelHasContact(i))
671 {
672 float wheelSpeed = WheelGetAngularVelocity(i) * wheel.GetRadius();
673 wheelPos = WheelGetContactPosition(i);
674 wheelPos = WorldToModel(wheelPos);
675 wheelsPosition.Set(i, wheelPos);
676
677 vector wheelVel = dBodyGetVelocityAt(this, wheelPos);
678
679 vector transform[3];
680 transform[2] = WheelGetDirection(i);
681 transform[1] = vector.Up;
682 transform[0] = transform[2] * transform[1];
683
684 wheelVel = wheelVel.InvMultiply3(transform);
685
686 float bodySpeed = wheelVel[2];
687
688 bool applyWheelSmokeEffect = false;
689
690 if ((wheelSpeed > 0 && bodySpeed > 0) || (wheelSpeed < 0 && bodySpeed < 0))
691 applyWheelSmokeEffect = Math.AbsFloat(wheelSpeed) > Math.AbsFloat(bodySpeed) + EffWheelSmoke.WHEEL_SMOKE_THRESHOLD;
692 else
693 applyWheelSmokeEffect = Math.AbsFloat(wheelSpeed) > EffWheelSmoke.WHEEL_SMOKE_THRESHOLD;
694
695 if (applyWheelSmokeEffect)
696 {
697 m_VFXComponent.SetEffectGroupPositions(EVehicleVFXEffectGroup.WHEEL_SMOKE, wheelsPosition);
698 m_VFXComponent.PlayEffectGroup(EVehicleVFXEffectGroup.WHEEL_SMOKE);
699 }
700 else
701 m_VFXComponent.StopEffectGroup(EVehicleVFXEffectGroup.WHEEL_SMOKE);
702 }
703 }
704
705 // actual wheel position
706 wheelPos = WheelGetPositionLS(i);
707 wheelsPosition.Set(i, wheelPos);
708
710 {
711 if (m_VFXComponent.CanPlayEffectGroup(EVehicleVFXEffectGroup.WHEEL_CONTACT))
712 {
713 bool applyWheelContactEffect = Math.AbsFloat(wheelSpeed) > EffWheelContact.SPEED_THRESHOLD;
714 if (wheel && applyWheelContactEffect)
715 {
716 particleParamsData = m_VFXComponent.GetEffectGroupParticleParamsOverrideData(EVehicleVFXEffectGroup.WHEEL_CONTACT);
717 if (particleParamsData)
718 {
719 particleParamsData.m_FloatModifiers.InsertAt(motorbikeSpeed, 0);
720 particleParamsData.m_FloatModifiers.InsertAt(GetWeightCoef(), 1);
721
722 m_VFXComponent.SetSurfaceInfo(WheelGetSurface(i));
723 m_VFXComponent.SetEffectGroupPositions(EVehicleVFXEffectGroup.WHEEL_CONTACT, wheelsPosition);
724
725 m_VFXComponent.PlayEffectGroup(EVehicleVFXEffectGroup.WHEEL_CONTACT);
726 }
727 }
728 else
729 m_VFXComponent.StopEffectGroup(EVehicleVFXEffectGroup.WHEEL_CONTACT);
730 }
731 }
732
733
734 }
735 }
736 }
737 }
738
739 override void EOnPostSimulate(IEntity other, float timeSlice)
740 {
741 m_Time += timeSlice;
742
743 if (g_Game.IsServer())
744 {
745 #ifdef DIAG_DEVELOPER
746 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.CONTACT)
747 {
748 if (m_ContactCalled)
749 {
750 Debug.Log("Momentum delta: " + (GetMomentum() - m_MomentumPrevTick));
751 Debug.Log("--------------------------------------------------------------------");
752 m_ContactCalled = false;
753 }
754 }
755 #endif
756
757
759 m_VelocityPrevTick = GetVelocity(this);
760 m_MomentumPrevTick = GetMomentum();
761 #ifdef DIAG_DEVELOPER
762 m_DebugMessageCleanTime += timeSlice;
763 if (m_DebugMessageCleanTime >= DEBUG_MESSAGE_CLEAN_TIME_SECONDS)
764 {
765 m_DebugMessageCleanTime = 0;
766 m_DebugContactDamageMessage = "";
767 }
768 #endif
769 }
770
772 {
773 m_Time = 0;
774
776
777 if (EngineIsOn())
778 {
779 bool isServerOrOwner = IsServerOrOwner();
780
781 if (g_Game.IsServer())
782 {
784 if (IsDamageDestroyed() || GetFluidFraction(MotorbikeFluid.FUEL) <= 0.0 || m_EngineHealth <= 0.0)
785 EngineStop();
786
787 float engineRPM = EngineGetRPM();
789 {
790 if (engineRPM > EngineGetRPMMax())
791 AddHealth( "Engine", "Health", -GetMaxHealth("Engine", "") * 0.05 );
792
793 // only called on server, don't use deterministic RandomFloat
794 float dmg = engineRPM * 0.001 * Math.RandomFloat(0.02, 1.0);
795 ProcessDirectDamage(DamageType.CUSTOM, null, "Engine", "EnviroDmg", vector.Zero, dmg);
796 SetEngineZoneReceivedHit(true);
797 }
798 else
799 SetEngineZoneReceivedHit(false);
800 }
801
802 if (isServerOrOwner)
803 {
804 CheckVitalItemCallback(IsVitalSparkPlug(), SparkPlug.SLOT_ID, this, "EngineStop");
805
807 {
808 float amount = (1 - m_FuelTankHealth) * RandomFloat(0.02, 0.05);
809 Leak(MotorbikeFluid.FUEL, amount);
810 }
811 }
812 }
813
814 if (g_Game.IsServer())
815 {
816 if (IsVitalFuelTank())
817 {
819 {
820 SetHealth("Engine", "Health", GameConstants.DAMAGE_RUINED_VALUE);
821 }
822 }
823 }
824 }
825 }
826
827 protected void OnBrakesPressed()
828 {
829 UpdateLights();
830 }
831
832 protected void OnBrakesReleased()
833 {
834 UpdateLights();
835 }
836
837 override void OnInput(float dt)
838 {
839 super.OnInput(dt);
840
841#ifdef DIAG_DEVELOPER
842 if (m_DebugMode == EMotorbikeDebugMode.NONE)
843 return;
844
845 float currentRPM = EngineGetRPM();
846 if (currentRPM < EngineGetRPMIdle())
847 {
848 if (currentRPM < 1.0 && EngineIsOn())
849 {
851 EngineStop();
852 }
853 else if (!EngineIsOn())
854 {
855 EngineStart();
856 }
857
858 return;
859 }
860
861 float speed = GetSpeedometerAbsolute();
862
863 float thrustWanted = 0.0;
864 float steeringWanted = 0.0;
865
866 bool attemptSpeed = false;
867 float speedWanted = 0;
868
869 switch (m_DebugMode)
870 {
871 case EMotorbikeDebugMode.FORWARD_10:
872 attemptSpeed = true;
873 speedWanted = 10;
874 break;
875 case EMotorbikeDebugMode.FORWARD_50:
876 attemptSpeed = true;
877 speedWanted = 50;
878 break;
879 }
880
881 if (attemptSpeed)
882 {
883 // very basic and doesn't actually work
884 thrustWanted = Math.Clamp(1.0 - Math.InverseLerp(0, speedWanted, speed), 0, 1);
885 }
886
887 bool isManual = GearboxGetType() == CarGearboxType.MANUAL;
888 bool isReverse = GetGear() == CarGear.REVERSE;
889
890 if (isManual)
891 {
892 float thrustWantedAbs = Math.AbsFloat(thrustWanted);
893
894 if (currentRPM > EngineGetRPMRedline() * 0.8)
895 {
896 if (thrustWantedAbs > 0.1)
897 {
898 ShiftUp();
899 }
900 }
901 else if (GetGear() > CarGear.FIRST && thrustWantedAbs < 0.1)
902 {
903 ShiftDown();
904 }
905 else if (GetGear() < CarGear.FIRST || (thrustWanted > 0.0 && speed < 5.0))
906 {
907 ShiftTo(CarGear.FIRST);
908 }
909 }
910
911 SetThrottle(thrustWanted);
912 SetSteering(steeringWanted);
913 SetBrake(0.0);
914 SetHandbrake(0.0);
915 SetKickstand(0.0);
916#endif
917 }
918
919 override void OnUpdate(float dt)
920 {
921 Human driver = CrewDriver();
922 if (driver && !driver.IsControllingVehicle())
923 {
924 // likely unconscious
925 if (driver.IsAlive())
926 {
927 SetBrake(0.5);
928 }
929 }
930
931 if (g_Game.IsServer())
932 {
934 {
936 if (battery)
937 {
938 /*
939 m_BatteryTimer += dt;
940 if (m_BatteryTimer >= BATTERY_UPDATE_DELAY)
941 {
942 UpdateBattery(battery);
943 }
944 */
945 }
946 }
947 }
948
949 float waterDepth = g_Game.GetWaterDepth(GetEnginePosWS());
950 if (waterDepth > 0.0)
951 {
952 TIntArray crewPresenceIndices = new TIntArray();
953 if (IsAnyCrewPresent(crewPresenceIndices))
954 {
955 if (waterDepth >= WATER_DEPTH_PLAYER_EJECT)
956 {
957 int crewCount = crewPresenceIndices.Count();
958 for (int crewPositionIndex = 0; crewPositionIndex < crewCount; ++crewPositionIndex)
959 CrewMember(crewPositionIndex).GetCommand_Vehicle().GetOutVehicle();
960 }
961 }
962
963 if (g_Game.IsServer())
964 {
965 m_DrownTime += dt;
967 {
968 AddHealth( "Engine", "Health", -DROWN_ENGINE_DAMAGE * dt);
969 SetEngineZoneReceivedHit(true);
970 }
971 }
972 }
973 else
974 {
975 if (g_Game.IsServer())
976 m_DrownTime = 0;
977
978 }
979
980 // For visualisation of brake lights for all players
981 float brakeCoef = GetBrake();
982 if (brakeCoef > 0)
983 {
985 {
986 m_BrakesArePressed = true;
987 SetSynchDirty();
989 }
990 }
991 else
992 {
994 {
995 m_BrakesArePressed = false;
996 SetSynchDirty();
998 }
999 }
1000 }
1001
1003 override void OnEngineStart()
1004 {
1006 {
1008 if (g_Game.IsServer() && battery)
1009 {
1011 /*
1012 float batteryConsume = GetBatteryConsumption();
1013 battery.GetCompEM().ConsumeEnergy(batteryConsume);
1014
1015 UpdateBattery(battery);
1016 */
1017 }
1018 }
1019
1021 UpdateLights();
1022
1024 }
1025
1027 override void OnEngineStop()
1028 {
1030 {
1032 if (g_Game.IsServer() && battery)
1033 UpdateBattery(battery);
1034 }
1035
1037 UpdateLights();
1038
1040 if (GetFluidFraction(MotorbikeFluid.FUEL) <= 0)
1041 stopSoundState = MotorbikeEngineSoundState.STOP_NO_FUEL;
1042
1043 HandleEngineSound(stopSoundState);
1044
1045 SetEngineZoneReceivedHit(false);
1046 }
1047
1048 // Updates state of attached headlight bulbs for faster access
1049 protected void UpdateHeadlightState()
1050 {
1052 {
1053 m_HeadlightsState = MotorbikeHeadlightState.NONE;
1054 return;
1055 }
1056
1057 EntityAI bulb = FindAttachmentBySlotName("Reflector_1_1");
1058
1059 if (bulb && !bulb.IsRuined())
1060 m_HeadlightsState = MotorbikeHeadlightState.MAIN;
1061 else if ((!bulb || bulb.IsRuined()))
1062 m_HeadlightsState = MotorbikeHeadlightState.NONE;
1063 }
1064
1065 override bool OnBeforeLightOn()
1066 {
1067 /*
1068 ItemBase neededItem = GetBattery();
1069
1070 if (neededItem && !neededItem.IsRuined())
1071 {
1072 return neededItem.GetCompEM() && neededItem.GetCompEM().GetEnergy() > 0.0;
1073 }
1074
1075 return false;
1076 */
1077 return true;
1078 }
1079
1080 override void UpdateLights(int new_gear = -1)
1081 {
1082 #ifndef SERVER
1083 UpdateLightsClient(new_gear);
1084 #endif
1085 UpdateLightsServer(new_gear);
1086 }
1087
1088 protected void UpdateLightsClient(int newGear = -1)
1089 {
1090 int gear;
1091
1092 if (newGear == -1)
1093 gear = GetGear();
1094 else
1095 gear = newGear;
1096
1097 if (LightIsOn())
1098 {
1099 if (!m_LightsComponent.LightExist("Front") && m_HeadlightsState != MotorbikeHeadlightState.NONE)
1100 m_LightsComponent.EnableLight("Front");
1101
1102 if (m_LightsComponent.LightExist("Front"))
1103 {
1104 switch (m_HeadlightsState)
1105 {
1106 case MotorbikeHeadlightState.MAIN:
1107 int driveWheelIndex = GetBoneIndex("drivewheel");
1108 //m_LightsComponent.AttachLightOnPoint("Front", m_HeadLightPoint, m_HeadLightTargetPoint, VehicleLightMode.SEGREGATED);
1109 m_LightsComponent.AttachLightOnObject("Front", GetMemoryPointPos(m_HeadLightPoint), vector.Zero, VehicleLightMode.SEGREGATED, driveWheelIndex);
1110 break;
1111
1112 default:
1113 m_LightsComponent.DisableLight("Front");
1114 }
1115 }
1116 }
1117 else
1118 {
1119 if (m_LightsComponent.LightExist("Front"))
1120 m_LightsComponent.DisableLight("Front");
1121 }
1122
1123 // brakes & reverse
1124 switch (gear)
1125 {
1127 m_RearLightType = MotorbikeRearLightType.BRAKES_ONLY;
1128 else
1129 m_RearLightType = MotorbikeRearLightType.NONE;
1130 }
1131
1132 //Debug.Log(string.Format("m_BrakesArePressed=%1, m_RearLightType=%2", m_BrakesArePressed.ToString(), EnumTools.EnumToString(MotorbikeRearLightType, m_RearLightType)));
1133
1134 if (!m_LightsComponent.LightExist("Rear") && m_RearLightType != MotorbikeRearLightType.NONE && m_HeadlightsState != MotorbikeHeadlightState.NONE)
1135 {
1136 if (EngineIsOn() || m_RearLightType == MotorbikeRearLightType.BRAKES_ONLY)
1137 {
1138 m_LightsComponent.EnableLight("Rear");
1139 if (MemoryPointExists(m_RearLightPoint))
1140 m_LightsComponent.AttachLightOnObject("Rear", GetMemoryPointPos(m_RearLightPoint), "180 0 0", VehicleLightMode.SEGREGATED);
1141 #ifdef DIAG_DEVELOPER
1142 else
1143 ErrorEx(string.Format("Missing '%1' memory point, check memory LOD", m_RearLightPoint), ErrorExSeverity.INFO);
1144 #endif
1145 }
1146 }
1147
1148 // rear lights
1149 if (m_LightsComponent.LightExist("Rear") && m_RearLightType != MotorbikeRearLightType.NONE && m_HeadlightsState != MotorbikeHeadlightState.NONE)
1150 {
1151 switch (m_RearLightType)
1152 {
1153 case MotorbikeRearLightType.BRAKES_ONLY:
1154 m_LightsComponent.SetLightTypeAndMode("Rear", VehicleLightType.BRAKE, VehicleLightMode.SEGREGATED);
1155 break;
1156
1157 default:
1158 m_LightsComponent.DisableLight("Rear");
1159 }
1160 }
1161 else
1162 {
1163 if (m_LightsComponent.LightExist("Rear"))
1164 m_LightsComponent.DisableLight("Rear");
1165 }
1166 }
1167
1168 protected void UpdateLightsServer(int newGear = -1)
1169 {
1170 int gear;
1171
1172 if (newGear == -1)
1173 {
1174 gear = GetGear();
1175 if (GearboxGetType() == CarGearboxType.AUTOMATIC)
1176 gear = GearboxGetMode();
1177 }
1178 else
1179 {
1180 gear = newGear;
1181 }
1182
1183 if (LightIsOn())
1184 {
1185 m_LightsComponent.SetSelectionMaterial("DashboardOn");
1186 m_LightsComponent.SetSelectionMaterial("TailOn");
1187
1188 switch (m_HeadlightsState)
1189 {
1190 case MotorbikeHeadlightState.MAIN:
1191 m_LightsComponent.SetSelectionMaterial("FrontOn");
1192
1193 break;
1194
1195 default:
1196 m_LightsComponent.SetSelectionMaterial("FrontOff");
1197 }
1198
1199 //Debug.Log(string.Format("LightIsOn=%1, m_HeadlightsState=%2", LightIsOn().ToString(), EnumTools.EnumToString(CarHeadlightBulbsState, m_HeadlightsState)));
1200 }
1201 else
1202 {
1203 m_LightsComponent.SetSelectionMaterial("TailOff");
1204 m_LightsComponent.SetSelectionMaterial("DashboardOff");
1205 m_LightsComponent.SetSelectionMaterial("FrontOff");
1206 }
1207
1208
1209 // brakes & reverse
1210 switch (gear)
1211 {
1213 m_RearLightType = MotorbikeRearLightType.BRAKES_ONLY;
1214 else
1215 m_RearLightType = MotorbikeRearLightType.NONE;
1216 }
1217
1218 //Debug.Log(string.Format("m_BrakesArePressed=%1, m_RearLightType=%2", m_BrakesArePressed.ToString(), EnumTools.EnumToString(MotorbikeRearLightType, m_RearLightType)));
1219
1220
1221 // rear lights
1222 if (m_RearLightType != MotorbikeRearLightType.NONE && m_HeadlightsState != CarHeadlightBulbsState.NONE)
1223 {
1224 switch (m_RearLightType)
1225 {
1226 case MotorbikeRearLightType.BRAKES_ONLY:
1227 m_LightsComponent.SetSelectionMaterial("BrakeOn");
1228
1229 break;
1230
1231 default:
1233 m_LightsComponent.SetSelectionMaterial("BrakesOff");
1234 }
1235 }
1236 else
1237 {
1239 m_LightsComponent.SetSelectionMaterial("BrakeOff");
1240 }
1241 }
1242
1243 override protected void PartsHealthCheck()
1244 {
1245 int engineHealthLevel = GetHealthLevel("Engine");
1246 m_EngineHealth = GetHealthLevelValue(engineHealthLevel, "Engine");
1247
1248 int fuelTankHealthLevel = GetHealthLevel("FuelTank");
1249 m_FuelTankHealth = GetHealthLevelValue(fuelTankHealthLevel, "FuelTank");
1250 }
1251
1252 protected void CheckContactCache()
1253 {
1254 int contactZonesCount = m_ContactCache.Count();
1255 if (contactZonesCount == 0)
1256 return;
1257
1258 for (int i = 0; i < contactZonesCount; ++i)
1259 {
1260 string zoneName = m_ContactCache.GetKey(i);
1261 array<ref VehicleContactData> data = m_ContactCache[zoneName];
1262
1263 float dmg = Math.AbsInt(data[0].m_Impulse * m_VehicleContactDamageCoef);
1264 float crewDmgBase = Math.AbsInt((data[0].m_Impulse / dBodyGetMass(this)) * 500 * m_CrewContactDamageCoef);// calculates damage as if the object's weight was 500kg instead of its actual weight
1265
1266 #ifdef DIAG_DEVELOPER
1267 CrashDebugData.m_CrashDataPoint = new CrashDebugData();
1268 CrashDebugData.m_CrashDataPoint.m_VehicleType = GetDisplayName();
1269 CrashDebugData.m_CrashDataPoint.m_Damage = dmg;
1270 CrashDebugData.m_CrashDataPoint.m_Zone = zoneName;
1271 CrashDebugData.m_CrashDataPoint.m_MomentumCurr = GetMomentum();
1272 CrashDebugData.m_CrashDataPoint.m_MomentumPrev = m_MomentumPrevTick;
1273 CrashDebugData.m_CrashDataPoint.m_MomentumDelta = data[0].m_Impulse;
1274 CrashDebugData.m_CrashDataPoint.m_SpeedWorld = GetVelocity(this).Length() * 3.6;
1275 CrashDebugData.m_CrashDataPoint.m_SpeedWorldPrev = m_VelocityPrevTick.Length() * 3.6;
1276 CrashDebugData.m_CrashDataPoint.m_SpeedWorldDelta = (m_VelocityPrevTick.Length() - GetVelocity(this).Length()) * 3.6;
1277 CrashDebugData.m_CrashDataPoint.m_VelocityCur = GetVelocity(this);
1278 CrashDebugData.m_CrashDataPoint.m_VelocityPrev = m_VelocityPrevTick;
1279 CrashDebugData.m_CrashDataPoint.m_VelocityDot = vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized());
1280 CrashDebugData.m_CrashDataPoint.m_Time = g_Game.GetTime();
1281
1282 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_CONSIDERED)
1283 {
1284 Debug.Log("--------------------------------------------------");
1285 Debug.Log("Vehicle:" + GetDisplayName());
1286 Debug.Log("DMG: " + dmg);
1287 Debug.Log("zoneName : "+ zoneName);
1288 Debug.Log("momentumCurr : "+ GetMomentum());
1289 Debug.Log("momentumPrev : "+ m_MomentumPrevTick);
1290 Debug.Log("momentumDelta : "+ data[0].m_Impulse);
1291 Debug.Log("speed(km/h): "+ GetVelocity(this).Length() * 3.6);
1292 Debug.Log("speedPrev(km/h): "+ m_VelocityPrevTick.Length() * 3.6);
1293 Debug.Log("speedDelta(km/h) : "+ (m_VelocityPrevTick.Length() - GetVelocity(this).Length()) * 3.6);
1294 Debug.Log("velocityCur.): "+ GetVelocity(this));
1295 Debug.Log("velocityPrev.): "+ m_VelocityPrevTick);
1296 Debug.Log("velocityDot): "+ vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized()));
1297 Debug.Log("g_Game.GetTime(): "+ g_Game.GetTime());
1298 Debug.Log("--------------------------------------------------");
1299 }
1300 #endif
1302 continue;
1303
1304 int pddfFlags;
1305 #ifdef DIAG_DEVELOPER
1306 CrashDebugData.m_CrashData.Insert(CrashDebugData.m_CrashDataPoint);
1307 CrashDebugData.m_CrashDataPoint.m_Speedometer = GetSpeedometer();
1308 //Print("Crash data recorded");
1309 #endif
1311 {
1312 #ifdef DIAG_DEVELOPER
1313 CrashDebugData.m_CrashDataPoint.m_DamageType = "Small";
1314 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1315 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is SMALL (threshold: %3), SPEEDOMETER: %4, TIME: %5", dmg, zoneName, GameConstants.MOTORBIKES_CONTACT_DMG_MIN, GetSpeedometer(), g_Game.GetTime() ));
1316 #endif
1317
1318 SynchCrashLightSound(true);
1319 pddfFlags = ProcessDirectDamageFlags.NO_TRANSFER;
1320 }
1322 {
1323 #ifdef DIAG_DEVELOPER
1324 CrashDebugData.m_CrashDataPoint.m_DamageType = "Medium";
1325 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1326 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is SMALL (threshold: %3), SPEEDOMETER: %4, TIME: %5", dmg, zoneName, GameConstants.MOTORBIKES_CONTACT_DMG_MIN, GetSpeedometer(), g_Game.GetTime() ));
1327 #endif
1328
1329 FallOver();
1330 SynchCrashLightSound(true);
1331 }
1332 else
1333 {
1334 #ifdef DIAG_DEVELOPER
1335 CrashDebugData.m_CrashDataPoint.m_DamageType = "Big";
1336 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1337 Debug.Log(string.Format("[Vehiles:Damage]:: DMG %1 to the %2 zone is BIG (threshold: %3), SPEED: %4, TIME: %5", dmg, zoneName, GameConstants.MOTORBIKES_CONTACT_DMG_MIN, GetSpeedometer(), g_Game.GetTime() ));
1338 #endif
1339
1340 DamageCrew(crewDmgBase);
1341 FallOver();
1342 SynchCrashHeavySound(true);
1343 pddfFlags = 0;
1344 }
1345
1346 #ifdef DEVELOPER
1347 m_DebugContactDamageMessage += string.Format("%1: %2\n", zoneName, dmg);
1348 #endif
1349
1350 ProcessDirectDamage(DamageType.CUSTOM, null, zoneName, "EnviroDmg", "0 0 0", dmg, pddfFlags);
1351 }
1352
1354 UpdateLights();
1355
1356 m_ContactCache.Clear();
1357 }
1358
1360 protected void DamageCrew(float dmg)
1361 {
1362 int crewSize = CrewSize();
1363 for (int c = 0; c < crewSize; ++c)
1364 {
1365 Human crew = CrewMember(c);
1366 if (!crew)
1367 continue;
1368
1370 {
1371 #ifdef DIAG_DEVELOPER
1372 CrashDebugData.m_CrashDataPoint.m_CrewDamageBase = dmg;
1373 CrashDebugData.m_CrashDataPoint.m_DMGHealth = -100;
1374 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1375 {
1376 Debug.Log("--------------------------------------------------");
1377 Debug.Log("Killing the player");
1378 Debug.Log("Crew DMG Base: " + dmg);
1379 Debug.Log("--------------------------------------------------");
1380
1381 }
1382 #endif
1383 crew.SetHealth(0.0);
1384 }
1385 else
1386 {
1388 shockTemp = Math.Clamp(shockTemp,0,1);
1389 float shock = Math.Lerp(50, 150, shockTemp);
1390 float hp = Math.Lerp(2, 100, shockTemp);
1391
1392 #ifdef DIAG_DEVELOPER
1393 CrashDebugData.m_CrashDataPoint.m_CrewDamageBase = dmg;
1394 CrashDebugData.m_CrashDataPoint.m_ShockTemp = shockTemp;
1395 CrashDebugData.m_CrashDataPoint.m_DMGHealth = hp;
1396 CrashDebugData.m_CrashDataPoint.m_DMGShock = shock;
1397 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.DAMAGE_APPLIED)
1398 {
1399 Debug.Log("--------------------------------------------------");
1400 Debug.Log("Crew DMG Base: " + dmg);
1401 Debug.Log("Crew shockTemp: " + shockTemp);
1402 Debug.Log("Crew DMG Health: " + hp);
1403 Debug.Log("Crew DMG Shock: " + shock);
1404 Debug.Log("--------------------------------------------------");
1405 }
1406 #endif
1407
1408 crew.AddHealth("", "Shock", -shock);
1409 crew.AddHealth("", "Health", -hp);
1410 }
1411 }
1412 }
1413
1414 override void CleanupEffects()
1415 {
1416 super.CleanupEffects();
1417
1419 {
1420 m_LightsComponent.DestroyLight("Front");
1421 m_LightsComponent.DestroyLight("Rear");
1422 }
1423 }
1424
1425 protected void SpawnUniversalParts()
1426 {
1427 GetInventory().CreateInInventory("HeadlightH7");
1428
1430 GetInventory().CreateInInventory(GetElectricitySourceDeviceType());
1431
1432 if (IsVitalSparkPlug())
1433 {
1434 GetInventory().CreateInInventory("SparkPlug");
1435 GetInventory().CreateInInventory("SparkPlug");
1436 }
1437 }
1438
1439 protected override event typename GetOwnerStateType()
1440 {
1441 return MotorbikeScriptOwnerState;
1442 }
1443
1444 protected override event typename GetMoveType()
1445 {
1446 return MotorbikeScriptMove;
1447 }
1448
1449 protected void SetEngineStarted(bool started)
1450 {
1451 m_EngineStarted = started;
1452 }
1453
1454 // Only used for sound states which happen before engine start
1456 {
1457 m_EngineSoundState = pState;
1458 SetSynchDirty();
1459 }
1460
1462 {
1463 SetEngineSoundState(state);
1464 m_EngineLastSoundState = state;
1465
1466 #ifndef SERVER
1467 #ifndef NO_GUI
1468 PlayerBase player = null;
1469 EffectSound sound = null;
1470 WaveKind waveKind = WaveKind.WAVEEFFECTEX;
1471
1472 bool doInside = false;
1473
1474 m_EngineLastSoundState = state;
1475
1476 switch (state)
1477 {
1478 case MotorbikeEngineSoundState.STARTING:
1479 sound = new EffectSound();
1481 sound.SetSoundFadeOut(0.15);
1482
1483 m_PreStartSound = sound;
1484 break;
1485 case MotorbikeEngineSoundState.START_OK:
1486 doInside = true;
1487
1488 sound = new EffectSound();
1490 sound.SetAutodestroy(true);
1491
1493 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(SetEngineStarted, 1000, false, true);
1494 break;
1495
1496 case MotorbikeEngineSoundState.START_NO_FUEL:
1497 sound = new EffectSound();
1499 sound.SetAutodestroy(true);
1500 break;
1501
1502 case MotorbikeEngineSoundState.START_NO_SPARKPLUG:
1503 sound = new EffectSound();
1505 sound.SetAutodestroy(true);
1506 break;
1507
1508 case MotorbikeEngineSoundState.STOP_OK:
1509 doInside = true;
1510
1511 sound = new EffectSound();
1513 sound.SetAutodestroy(true);
1514 break;
1515 case MotorbikeEngineSoundState.STOP_NO_FUEL:
1516 doInside = true;
1517
1518 sound = new EffectSound();
1520 sound.SetAutodestroy(true);
1521 break;
1522
1523 default:
1524 break;
1525 }
1526
1527 // play different sound based on selected camera
1528 if (doInside && Class.CastTo(player, g_Game.GetPlayer()))
1529 {
1530 if (player.IsCameraInsideVehicle())
1531 {
1532 waveKind = WaveKind.WAVEEFFECT;
1533 }
1534 }
1535
1536 if (sound)
1537 {
1538 vector enginePos = GetEnginePos();
1539
1540 sound.SetParent(this);
1541 sound.SetPosition(ModelToWorld(enginePos));
1542 sound.SetLocalPosition(enginePos);
1543 sound.SetSoundWaveKind(waveKind);
1545
1546 sound.SoundPlay();
1547 }
1548
1549 #endif
1550 #endif
1551 }
1552
1558 override bool OnBeforeEngineStart()
1559 {
1561
1562 EMotorbikeOperationalState state = CheckOperationalRequirements();
1563 return state == EMotorbikeOperationalState.OK;
1564 }
1565
1566 // Whether the car engine can be started
1568 {
1569 int state = EMotorbikeOperationalState.OK;
1570
1571 EntityAI item = null;
1572
1573 if (IsDamageDestroyed() || GetHealthLevel("Engine") >= GameConstants.STATE_RUINED)
1574 {
1575 state |= EMotorbikeOperationalState.RUINED;
1576 }
1577
1578 if (GetFluidFraction(MotorbikeFluid.FUEL) <= 0)
1579 {
1580 state |= EMotorbikeOperationalState.NO_FUEL;
1581 }
1582
1583 if (IsVitalSparkPlug())
1584 {
1585 item = FindAttachmentBySlotName("SparkPlug");
1586 if (!item || (item && item.IsRuined()))
1587 state |= EMotorbikeOperationalState.NO_IGNITER;
1588 }
1589
1590 return state;
1591 }
1592
1594 {
1595 return CheckOperationalRequirements() == EMotorbikeOperationalState.OK;
1596 }
1597
1599 {
1600 EMotorbikeOperationalState state = CheckOperationalRequirements();
1601
1602 if (state == EMotorbikeOperationalState.RUINED)
1603 {
1604 return;
1605 }
1606
1607 if (state & EMotorbikeOperationalState.NO_IGNITER)
1608 {
1609 HandleEngineSound(MotorbikeEngineSoundState.START_NO_SPARKPLUG);
1610 return;
1611 }
1612
1613 if (state & EMotorbikeOperationalState.NO_FUEL)
1614 {
1616 return;
1617 }
1618
1620 }
1621
1622 private bool IsServerOrOwner()
1623 {
1624 return g_Game.IsServer() || IsOwner();
1625 }
1626
1627 protected void HandleHeatComfortOverrides(string slotName, notnull EntityAI item, bool detach = false);
1628
1629 #ifdef DIAG_DEVELOPER
1630 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
1631 {
1632 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.VEHICLE_HORN_START_LONG, "Horn Start Short", FadeColors.LIGHT_GREY));
1633 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.VEHICLE_HORN_START_SHORT, "Horn Start Long", FadeColors.LIGHT_GREY));
1634 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.VEHICLE_HORN_STOP, "Horn Stop", FadeColors.LIGHT_GREY));
1635 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
1636
1637 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "Fuel", FadeColors.RED));
1638 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.VEHICLE_FUEL_FULL, "Full", FadeColors.LIGHT_GREY));
1639 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.VEHICLE_FUEL_EMPTY, "Empty", FadeColors.LIGHT_GREY));
1640 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.VEHICLE_FUEL_INCREASE, "10% increase", FadeColors.LIGHT_GREY));
1641 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.VEHICLE_FUEL_DECREASE, "10% decrease", FadeColors.LIGHT_GREY));
1642 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
1643
1644 typename e = EMotorbikeDebugMode;
1645
1646 int i;
1647
1648 int cnt = e.GetVariableCount();
1649 int val;
1650
1651 for (i = 0; i < cnt; i++)
1652 {
1653 if (!e.GetVariableValue(null, i, val))
1654 continue;
1655
1656 val = val + EActions.PLAYER_BOT_INTERNAL_START;
1657
1658 string name = e.GetVariableName(i);
1659
1660 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, val, name, FadeColors.LIGHT_GREY));
1661 }
1662
1663 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
1664
1665 super.GetDebugActions(outputList);
1666 }
1667
1668 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
1669 {
1670 if (super.OnAction(action_id, player, ctx))
1671 return true;
1672
1673 if (!g_Game.IsServer())
1674 {
1675 return false;
1676 }
1677
1678 switch (action_id)
1679 {
1680 case EActions.VEHICLE_HORN_START_SHORT:
1681 m_HornComponent.SetMode(VehicleHornMode.SHORT);
1682 return true;
1683 case EActions.VEHICLE_HORN_START_LONG:
1684 m_HornComponent.SetMode(VehicleHornMode.LONG);
1685 return true;
1686 case EActions.VEHICLE_HORN_STOP:
1687 m_HornComponent.SetMode(VehicleHornMode.OFF);
1688 return true;
1689
1690 case EActions.VEHICLE_FUEL_FULL:
1692 return true;
1693 case EActions.VEHICLE_FUEL_EMPTY:
1694 LeakAll(MotorbikeFluid.FUEL);
1695 return true;
1696 case EActions.VEHICLE_FUEL_INCREASE:
1698 return true;
1699 case EActions.VEHICLE_FUEL_DECREASE:
1701 return true;
1702 }
1703
1704 typename e = EMotorbikeDebugMode;
1705
1706 int i;
1707
1708 int cnt = e.GetVariableCount();
1709 int val;
1710
1711 for (i = 0; i < cnt; i++)
1712 {
1713 if (!e.GetVariableValue(null, i, val))
1714 continue;
1715
1716 if ((val + EActions.PLAYER_BOT_INTERNAL_START) == action_id)
1717 {
1718 m_DebugMode = val;
1719 dBodyActive(this, ActiveState.ACTIVE);
1720 }
1721 }
1722
1723 return false;
1724 }
1725
1726 override protected string GetDebugText()
1727 {
1728 string debug_output = super.GetDebugText();
1729 if (g_Game.IsServer())
1730 {
1731 debug_output += m_DebugContactDamageMessage + "\n";
1732 }
1733 debug_output += "Entity momentum: " + GetMomentum();
1734 int capacity = GetFluidCapacity(MotorbikeFluid.FUEL);
1735 debug_output += string.Format("\nFuel:%1/%2", capacity * GetFluidFraction(MotorbikeFluid.FUEL), capacity);
1736 debug_output += "\nIsEngineON: " + EngineIsOn();
1737 debug_output += "\nHeatComfort override: " + GetHeatComfortOverride();
1738
1739 return debug_output;
1740 }
1741
1742 override void FixEntity()
1743 {
1744 super.FixEntity();
1745
1746 if (g_Game.IsServer())
1747 {
1749
1750 for (int i = 5; i > 0; i--)//there is a problem with wheels when performed only once, this solves it
1751 super.FixEntity();
1752 if (!g_Game.IsMultiplayer())
1753 {
1754 //single
1756 }
1757 }
1758 else
1759 {
1760 //MP client
1762 }
1763 }
1764 #endif
1765}
Param4< int, int, string, int > TSelectableActionInfoWithColor
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
float GetHeatComfortOverride()
bool IsDamageDestroyed(ActionTarget target)
Определения ActionBase.c:1275
void ActionBase()
Определения ActionBase.c:82
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
VehicleHornActionData ActionData ActionVehicleHornShort()
Определения ActionVehicleHorn.c:62
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
@ OK
0 - No error. Can be returned from any call.
Определения BIOSErrorModule.c:9
override void EEItemDetached(EntityAI item, string slot_name)
Определения BaseBuildingBase.c:1812
override void EEItemAttached(EntityAI item, string slot_name)
Определения BaseBuildingBase.c:1803
enum EBoatEffects STOP_OK
enum EBoatEffects NO_FUEL
enum EBoatEffects NO_IGNITER
enum EBoatEffects START_NO_FUEL
enum EBoatEffects START_OK
CarGearboxType
Enumerated gearbox types. (native, do not change or extend)
Определения Car.c:24
enum CarDoorState STARTING
enum CarDoorState REVERSE_ONLY
enum CarDoorState BRAKES_ONLY
enum CarDoorState START_NO_SPARKPLUG
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
void Synchronize()
Определения CombinationLock.c:205
override void EEDelete(EntityAI parent)
Определения ContaminatedArea.c:61
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
override void OnVariablesSynchronized()
Определения ContaminatedArea_Dynamic.c:94
map
Определения ControlsXboxNew.c:4
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения DayZAnimal.c:136
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения DayZAnimal.c:125
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
EActions
Определения EActions.c:2
EVehicleVFXEffect
Identifiers of individual vehicle VFX effects.
Определения EVehicleVFXTypes.c:3
override void OnAttachmentRuined(EntityAI attachment)
Определения FireplaceBase.c:387
bool IsOwner()
Определения Hand_Events.c:60
@ RUINED
Определения InjuryHandler.c:24
string Type
Определения JsonDataContaminatedArea.c:11
enum EUndegroundEntranceState MAIN
override void EOnPostSimulate(IEntity other, float timeSlice)
static string GetDisplayName(int liquid_type)
Определения Liquid.c:383
string GetDebugText()
Определения ModifierBase.c:71
proto native void ShiftTo(int gear)
Shifts the future gear to selected gear, triggering gearbox simulation.
MotorbikeFluid
Type of vehicle's fluid. (native, do not change or extend)
Определения Motorbike.c:14
proto native vector GetEnginePos()
Get actual position of engine (model space)
proto native void SetThrottle(float value)
Sets the future throttle value.
void OnStabilityStart()
Определения Motorbike.c:363
proto native float EngineGetRPMRedline()
Returns engine's maximal working rpm without damaging the engine.
proto native void Leak(MotorbikeFluid fluid, float amount)
Removes from the specified fluid the specified amount.
proto native vector WheelGetPositionLS(int wheelIdx)
proto native void SetHandbrake(float value)
Sets the future front brake value.
proto native CarGearboxType GearboxGetType()
Returns gearbox type. See CarGearboxType enum for more info.
proto native void SetKickstand(float value)
Sets the future kickstand value.
proto native EntityAI WheelGetEntity(int wheelIdx)
proto native int GetNeutralGear()
Returns the index of the neutral gear.
proto native int WheelCount()
How many wheel can be attached to a motorbike (hubs only)
proto native void EngineStop()
Stops the engine.
proto native CarAutomaticGearboxMode GearboxGetMode()
Returns gearbox mode. This is useful when motorbike has automatic gearbox.
proto native bool WheelHasContact(int wheelIdx)
proto native void SetBrake(float value)
Sets the future rear brake value.
proto native void Fill(MotorbikeFluid fluid, float amount)
Adds to the specified fluid the specified amount.
proto native bool EngineIsOn()
Returns true when engine is running, false otherwise.
proto native float EngineGetRPMIdle()
Returns engine's idle rpm before engine stalls.
void OnStabilityStop()
Определения Motorbike.c:368
proto native void ShiftDown()
Shifts the future gear down, triggering gearbox simulation.
proto native void ShiftUp()
Shifts the future gear up, triggering gearbox simulation.
bool OnBeforeEngineStart()
Определения Motorbike.c:312
proto native vector WheelGetDirection(int wheelIdx)
proto native void EngineStart()
Starts the engine.
proto native float EngineGetRPM()
Returns engine's rpm value.
void OnEngineStart()
Определения Motorbike.c:321
float GetSpeedometer()
Returns the current speed of the vehicle in km/h.
Определения Motorbike.c:45
float OnSound(MotorbikeSoundCtrl ctrl, float oldValue)
Определения Motorbike.c:354
MotorbikeSoundCtrl
Motorbike's sound controller list. (native, do not change or extend)
Определения Motorbike.c:3
proto native void SetSteering(float value)
Sets the future steering value.
MotorbikeOwnerState TransportOwnerState GetOwnerStateType()
Native class for motorbikes - handles physics simulation.
Определения Motorbike.c:33
override event GetMoveType()
Определения Motorbike.c:39
proto native float GetFluidFraction(MotorbikeFluid fluid)
void OnEngineStop()
Определения Motorbike.c:326
proto native bool FallOver()
Forcibly topple over the motorbike, ejects the player.
proto native int GetGear()
Returns the index of the future gear, -1 if there is no engine.
proto native void LeakAll(MotorbikeFluid fluid)
Removes all the specified fluid from vehicle.
proto native vector WheelGetContactPosition(int wheelIdx)
proto native float GetFluidCapacity(MotorbikeFluid fluid)
float GetSpeedometerAbsolute()
Returns the current speed of the vehicle in km/h. Value is absolute.
Определения Motorbike.c:55
proto native bool IsFallen()
Returns if the bike is fallen over.
proto native SurfaceInfo WheelGetSurface(int wheelIdx)
proto native float GetBrake()
Returns the current rear brake value in range <0, 1>.
proto native float EngineGetRPMMax()
Returns engine's max rpm before engine blows up.
proto native float WheelGetAngularVelocity(int wheelIdx)
override void UpdateLights(int new_gear=-1)
Определения MotorbikeScript.c:1080
void SetEngineStarted(bool started)
Определения MotorbikeScript.c:1449
void OnBrakesPressed()
Определения MotorbikeScript.c:827
void SpawnUniversalParts()
Определения MotorbikeScript.c:1425
override bool CanGetIn()
Определения MotorbikeScript.c:225
override void OnDriverExit(Human player)
Определения MotorbikeScript.c:217
void PartsHealthCheck()
Определения MotorbikeScript.c:1243
void InitializeParticles()
Определения MotorbikeScript.c:174
static string m_HeadLightPoint
Определения MotorbikeScript.c:69
string m_EngineStartOK
Определения MotorbikeScript.c:89
float m_FuelTankHealth
Определения MotorbikeScript.c:65
vector GetEnginePosWS()
Определения MotorbikeScript.c:331
override int Get3rdPersonCameraType()
Определения MotorbikeScript.c:454
override void EOnPostFrame(IEntity other, int extra)
Определения MotorbikeScript.c:612
void UpdateLightsServer(int newGear=-1)
Определения MotorbikeScript.c:1168
float m_BatteryHealth
Определения MotorbikeScript.c:66
static string m_HeadLightTargetPoint
Определения MotorbikeScript.c:70
void DamageCrew(float dmg)
Responsible for damaging crew in a car crash.
Определения MotorbikeScript.c:1360
override bool CrewShouldEject(int posIdx)
Определения MotorbikeScript.c:464
override int GetFluidCapacityScript(ETransportFluid fluidType)
Определения MotorbikeScript.c:243
string m_EngineStartBattery
Определения MotorbikeScript.c:90
override bool OnBeforeLightOn()
Определения MotorbikeScript.c:1065
bool m_ActionsInitialized
Определения MotorbikeScript.c:314
float m_EngineHealth
Определения MotorbikeScript.c:64
float m_DrownTime
Определения MotorbikeScript.c:79
void HandleEngineSound(MotorbikeEngineSoundState state)
Определения MotorbikeScript.c:1461
static ref map< typename, ref TInputActionMap > m_MotorbikeTypeActionsMap
Определения MotorbikeScript.c:312
void CheckContactCache()
Определения MotorbikeScript.c:1252
static float DROWN_ENGINE_DAMAGE
Определения MotorbikeScript.c:56
string m_EngineStarting
Sounds.
Определения MotorbikeScript.c:88
string m_EngineStartPlug
Определения MotorbikeScript.c:91
enum MotorbikeEngineSoundState DROWN_ENGINE_THRESHOLD
ref VehicleVFXComponent m_VFXComponent
Определения MotorbikeScript.c:76
override void CleanupEffects()
Определения MotorbikeScript.c:1414
ref EffectSound m_PreStartSound
Определения MotorbikeScript.c:95
static float WATER_DEPTH_PLAYER_EJECT
Определения MotorbikeScript.c:57
bool m_BrakesArePressed
Определения MotorbikeScript.c:60
override vector GetDefaultHitPosition()
Определения MotorbikeScript.c:207
void UpdateLightsClient(int newGear=-1)
Определения MotorbikeScript.c:1088
override void FillScript(ETransportFluid fluidType, float amount)
Определения MotorbikeScript.c:253
void OnIgnition()
Определения MotorbikeScript.c:1598
string m_EngineStartFuel
Определения MotorbikeScript.c:92
MotorbikeEngineSoundState m_EngineSoundState
Определения MotorbikeScript.c:84
override VehicleHornComponent GetVehicleHornComponent()
Определения MotorbikeScript.c:212
MotorbikeEngineSoundState
Определения MotorbikeScript.c:43
@ STOP_NO_FUEL
Определения MotorbikeScript.c:50
int CheckOperationalRequirements()
Определения MotorbikeScript.c:1567
bool IsServerOrOwner()
Определения MotorbikeScript.c:1622
bool HasRadiator()
Определения MotorbikeScript.c:326
override bool CrewCanEject(int posIdx)
Определения MotorbikeScript.c:459
ref VehicleHornComponent m_HornComponent
Определения MotorbikeScript.c:75
override string GetVehicleType()
Определения MotorbikeScript.c:316
void ~MotorbikeScript()
Определения MotorbikeScript.c:150
EffectSound CreateSoundForAnimationSource(string animSource)
Определения MotorbikeScript.c:277
MotorbikeHeadlightState
Определения MotorbikeScript.c:2
float m_HeatComfortOverride
Определения MotorbikeScript.c:82
MotorbikeEngineSoundState m_EngineLastSoundState
Определения MotorbikeScript.c:85
override bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance=1.0)
Определения MotorbikeScript.c:479
void MotorbikeScript()
Определения MotorbikeScript.c:105
static string m_RearLightPoint
Определения MotorbikeScript.c:71
bool CheckOperationalState()
Определения MotorbikeScript.c:1593
string m_EngineStopFuel
Определения MotorbikeScript.c:94
ref VehicleLightsComponent m_LightsComponent
Определения MotorbikeScript.c:74
void OnBrakesReleased()
Определения MotorbikeScript.c:832
void HandleHeatComfortOverrides(string slotName, notnull EntityAI item, bool detach=false)
float m_PlugHealth
Определения MotorbikeScript.c:67
EntityAI GetRadiator()
Определения MotorbikeScript.c:336
void UpdateHeadlightState()
Определения MotorbikeScript.c:1049
void SetEngineSoundState(MotorbikeEngineSoundState pState)
Определения MotorbikeScript.c:1455
override void OnInput(float dt)
Определения MotorbikeScript.c:837
override float GetFluidFractionScript(ETransportFluid fluidType)
Определения MotorbikeScript.c:248
static vector m_DrownEnginePos
Определения MotorbikeScript.c:80
string m_EngineStop
Определения MotorbikeScript.c:93
ProcessDirectDamageFlags
Определения Object.c:2
WaveKind
Определения Sound.c:2
void VehicleHornComponent(notnull EntityAI parent)
Определения VehicleHornComponent.c:24
void VehicleLightProfileRear()
Определения VehicleLightProfileBase.c:77
class VehicleLightProfileBase VehicleLightProfileFront()
Определения VehicleLightProfileBase.c:34
void VehicleLightData(VehicleLightProfileBase profile)
Определения VehicleLightsComponent.c:21
void VehicleVFXDataParams(vector position=vector.Zero, vector orientation=vector.Up, float cooldownSec=0.0)
Определения VehicleVFXComponent.c:88
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
override int GetSeatAnimationType(int posIdx)
override EntityAI GetElectricitySourceDevice()
override bool CrewCanGetThrough(int posIdx)
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
override bool NeedElectricitySourceDevice()
override string GetElectricitySourceDeviceType()
override bool IsVitalRadiator()
override bool IsVitalSparkPlug()
override bool HasGangedTailAndBrakeLights()
override float GetWeightCoef()
float m_Time
Определения WoundInfection.c:22
Super root of all classes in Enforce script.
Определения EnScript.c:11
static const int DAYZCAMERA_3RD_VEHICLE_MOTORBIKE
motorbike 3rd person
Определения DayZPlayerCameras.c:20
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Определения 3_Game/DayZ/tools/Debug.c:318
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Определения 3_Game/DayZ/tools/Debug.c:183
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения 3_Game/DayZ/tools/Debug.c:188
Определения 3_Game/DayZ/tools/Debug.c:2
Определения EngineSmoke.c:2
Определения ExhaustSmoke.c:2
const float WHEEL_DUST_THRESHOLD
Определения VehicleDust.c:3
Определения VehicleDust.c:2
const float SPEED_THRESHOLD
Определения EffWheelContact.c:3
Определения EffWheelContact.c:2
const float WHEEL_SMOKE_THRESHOLD
Определения WheelSmoke.c:3
Определения WheelSmoke.c:2
void SetSoundSet(string snd)
Set soundset for the sound.
Определения EffectSound.c:798
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:607
void SetSoundWaveKind(WaveKind wave_kind)
Set WaveKind for the sound.
Определения EffectSound.c:788
void SetSoundFadeOut(float fade_out)
Set the sound fade out duration.
Определения EffectSound.c:908
override void SetParent(Object parent_obj, int pivot)
Set parent for the sound to follow.
Определения EffectSound.c:658
bool SoundPlay()
Plays sound.
Определения EffectSound.c:199
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
proto native bool IsControllingVehicle()
Определения human.c:1360
Определения EnEntity.c:165
static bool IsActionLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:749
Определения EnMath.c:7
Определения Motorbike.c:21
static const int HATCHBACK_COOLANT_OVERHEATED
Определения ParticleList.c:296
static const int HATCHBACK_EXHAUST_SMOKE
Определения ParticleList.c:299
Определения ParticleList.c:12
Определения PlayerBaseClient.c:2
static int EffectRegister(Effect effect)
Registers Effect in SEffectManager.
Определения EffectManager.c:331
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
const int OFF
Определения VehicleHornComponent.c:3
const int COUNT
Определения VehicleHornComponent.c:7
const int BRAKE
Определения VehicleLightsComponent.c:30
void StopEffect(EVehicleVFXEffect effectId)
Определения VehicleVFXComponent.c:282
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения Transport.c:70
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
proto native float Length()
Returns length of vector (magnitude)
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Определения EnConvert.c:305
static const vector Zero
Определения EnConvert.c:123
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
Определения EnConvert.c:254
proto vector InvMultiply3(vector mat[3])
Invert-transforms vector.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static const vector Up
Определения EnConvert.c:120
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
Определения EnConvert.c:119
Keffiyeh_LightBlue SetActions
Определения consumables.c:149
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
Serializer ParamsReadContext
Определения gameplay.c:15
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< vector > TVectorArray
Определения EnScript.c:738
array< int > TIntArray
Определения EnScript.c:733
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
const float DAMAGE_RUINED_VALUE
Определения 3_Game/DayZ/constants.c:925
const float DAMAGE_DAMAGED_VALUE
Определения 3_Game/DayZ/constants.c:923
const int STATE_RUINED
Определения 3_Game/DayZ/constants.c:909
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto int AbsInt(int i)
Returns absolute value.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float AbsFloat(float f)
Returns absolute value.
const float MOTORBIKES_CONTACT_DMG_THRESHOLD_SMALL
Определения 3_Game/DayZ/constants.c:898
const float MOTORBIKES_CONTACT_DMG_KILLCREW
Определения 3_Game/DayZ/constants.c:901
const float MOTORBIKES_CONTACT_DMG_MIN
Определения 3_Game/DayZ/constants.c:900
const float MOTORBIKES_CONTACT_DMG_THRESHOLD_MID
Определения 3_Game/DayZ/constants.c:899
@ NONE
body is not in simulation, nor in collision world
Определения SimulationState.c:15
ActiveState
Определения ActiveState.c:10
proto native vector dBodyGetVelocityAt(notnull IEntity body, vector globalpos)
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto native void dBodyActive(notnull IEntity ent, ActiveState activeState)
proto native float dBodyGetMass(notnull IEntity ent)
const int SAT_DEBUG_ACTION
Определения 3_Game/DayZ/constants.c:486
proto native int Length()
Returns length of string.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/DayZ/tools/tools.c:10
proto native void OnUpdate()
Определения 3_Game/DayZ/tools/tools.c:349
const int VEHICLE_FLUIDS_TICK
Определения 3_Game/DayZ/constants.c:866