808 {
810
812 {
813 #ifdef DIAG_DEVELOPER
814 if (DEBUG_OUTPUT_TYPE & EVehicleDebugOutputType.CONTACT)
815 {
816 if (m_ContactCalled)
817 {
818 Debug.Log(
"Momentum delta: " + (GetMomentum() - m_MomentumPrevTick));
819 Debug.Log(
"--------------------------------------------------------------------");
820 m_ContactCalled = false;
821 }
822 }
823 #endif
824
825
828 m_MomentumPrevTick = GetMomentum();
829 #ifdef DIAG_DEVELOPER
830 m_DebugMessageCleanTime += timeSlice;
831 if (m_DebugMessageCleanTime >= DEBUG_MESSAGE_CLEAN_TIME_SECONDS)
832 {
833 m_DebugMessageCleanTime = 0;
834 m_DebugContactDamageMessage = "";
835 }
836 #endif
837 }
838
839 if (
m_Time >= GameConstants.CARS_FLUIDS_TICK)
840 {
842
844
846
847
849 {
852
853 CheckVitalItemCallback(
IsVitalSparkPlug(), SparkPlug.SLOT_ID,
this,
"EngineStop");
854 CheckVitalItemCallback(
IsVitalGlowPlug(), GlowPlug.SLOT_ID,
this,
"EngineStop");
855 }
856
858 {
859 if (IsVitalFuelTank())
860 {
862 {
863 SetHealth("Engine", "Health", GameConstants.DAMAGE_RUINED_VALUE);
864 }
865 }
866 }
867
870 {
872 {
873 float dmg;
874
876 {
878 AddHealth( "Engine", "Health", -GetMaxHealth("Engine", "") * 0.05 );
879
880
881 dmg =
EngineGetRPM() * 0.001 * Math.RandomFloat( 0.02, 1.0 );
882 ProcessDirectDamage(
DamageType.CUSTOM, null,
"Engine",
"EnviroDmg", vector.Zero, dmg);
883 SetEngineZoneReceivedHit(true);
884 }
885 else
886 {
887 SetEngineZoneReceivedHit(false);
888 }
889 }
890
891 if (isServerOrOwner)
892 {
895 {
898 }
899
902
905
908
911 }
912
914 {
916 {
918 {
919
921 AddHealth( "Engine", "Health", -dmg );
922 SetEngineZoneReceivedHit(true);
923 }
924 }
925 }
926 }
927 }
928 }
bool IsDamageDestroyed(ActionTarget target)
CarFluid
Type of vehicle's fluid. (native, do not change or extend)
DamageType
exposed from C++ (do not change)
proto native float EngineGetRPMRedline()
Returns engine's maximal working rpm without damaging the engine.
proto native void EngineStop()
Stops the engine.
proto native bool EngineIsOn()
Returns true when engine is running, false otherwise.
proto native float EngineGetRPM()
Returns engine's rpm value.
proto native float GetFluidFraction(MotorbikeFluid fluid)
proto native float EngineGetRPMMax()
Returns engine's max rpm before engine blows up.
override bool IsVitalGlowPlug()
override bool IsVitalSparkPlug()
void LeakFluid(CarFluid fluid)
void CheckContactCache()
Responsible for damaging the car according to contact events from OnContact.
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.