DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ EOnPostSimulate()

override void EOnPostSimulate ( IEntity other,
float timeSlice )
protected

Vehicle should stop the engine as first thing

См. определение в файле MotorbikeScript.c строка 739

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 }
bool IsDamageDestroyed(ActionTarget target)
Определения ActionBase.c:1275
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:4074
MotorbikeFluid
Type of vehicle's fluid. (native, do not change or extend)
Определения Motorbike.c:14
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 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.
void PartsHealthCheck()
Определения MotorbikeScript.c:1243
float m_FuelTankHealth
Определения MotorbikeScript.c:65
float m_EngineHealth
Определения MotorbikeScript.c:64
void CheckContactCache()
Определения MotorbikeScript.c:1252
bool IsServerOrOwner()
Определения MotorbikeScript.c:1622
override bool IsVitalSparkPlug()
float m_Time
Определения WoundInfection.c:22
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
Определения 3_Game/DayZ/tools/Debug.c:2
Определения EnMath.c:7
static const vector Zero
Определения EnConvert.c:123
Определения EnConvert.c:119
const float DAMAGE_RUINED_VALUE
Определения 3_Game/DayZ/constants.c:925
const float DAMAGE_DAMAGED_VALUE
Определения 3_Game/DayZ/constants.c:923
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
const int VEHICLE_FLUIDS_TICK
Определения 3_Game/DayZ/constants.c:866

Перекрестные ссылки CheckContactCache(), GameConstants::DAMAGE_DAMAGED_VALUE, GameConstants::DAMAGE_RUINED_VALUE, EngineGetRPM(), EngineGetRPMMax(), EngineGetRPMRedline(), EngineIsOn(), EngineStop(), g_Game, GetFluidFraction(), GetVelocity(), IsDamageDestroyed(), IsServerOrOwner(), IsVitalSparkPlug(), Leak(), Debug::Log(), m_EngineHealth, m_FuelTankHealth, m_Time, PartsHealthCheck(), Math::RandomFloat(), GameConstants::VEHICLE_FLUIDS_TICK и vector::Zero.