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

◆ RegisterTransportHit()

void Entity::RegisterTransportHit ( Transport transport)
inlineprotected

См. определение в файле 3_Game/Entities/EntityAI.c строка 4034

4035 {
4037 {
4040 Car car;
4041 Boat boat;
4042 float damage;
4043 vector impulse;
4044
4045 // a different attempt to solve hits from "standing" car to the players
4046 if (Car.CastTo(car, transport))
4047 {
4048 if (car.GetSpeedometerAbsolute() > 2 )
4049 {
4050 damage = m_TransportHitVelocity.Length();
4051 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4052 }
4053 else
4054 {
4056 }
4057
4058 // compute impulse and apply only if the body dies
4059 if (IsDamageDestroyed() && car.GetSpeedometerAbsolute() > 3)
4060 {
4061 impulse = 40 * m_TransportHitVelocity;
4062 impulse[1] = 40 * 1.5;
4063 dBodyApplyImpulse(this, impulse);
4064 }
4065 }
4066 else if (Boat.CastTo(boat, transport))
4067 {
4068 Human player = Human.Cast(this);
4069 if (player && player.PhysicsGetLinkedEntity() == boat) // standing on boat
4070 {
4072 return;
4073 }
4074
4075 if (m_TransportHitVelocity.Normalize() > 5) // 5 m/s
4076 {
4077 damage = m_TransportHitVelocity.Length() * 0.5;
4078 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4079 }
4080 else
4082 }
4083 else //old solution just in case if somebody use it
4084 {
4085 // avoid damage because of small movements
4086 if (m_TransportHitVelocity.Length() > 0.1)
4087 {
4088 damage = m_TransportHitVelocity.Length();
4089 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4090 }
4091 else
4092 {
4094 }
4095
4096 // compute impulse and apply only if the body dies
4097 if (IsDamageDestroyed() && m_TransportHitVelocity.Length() > 0.3)
4098 {
4099 impulse = 40 * m_TransportHitVelocity;
4100 impulse[1] = 40 * 1.5;
4101 dBodyApplyImpulse(this, impulse);
4102 }
4103 }
4104 }
4105 }
bool m_TransportHitRegistered
Определения 3_Game/Entities/EntityAI.c:138
vector m_TransportHitVelocity
Определения 3_Game/Entities/EntityAI.c:139
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)

Перекрестные ссылки dBodyApplyImpulse(), GetVelocity(), m_TransportHitRegistered и m_TransportHitVelocity.