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

◆ RegisterTransportHit()

void Entity::RegisterTransportHit ( Transport transport)
inlineprotected

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

4030 {
4032 {
4035 Car car;
4036 Boat boat;
4037 float damage;
4038 vector impulse;
4039
4040 // a different attempt to solve hits from "standing" car to the players
4041 if (Car.CastTo(car, transport))
4042 {
4043 if (car.GetSpeedometerAbsolute() > 2 )
4044 {
4045 damage = m_TransportHitVelocity.Length();
4046 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4047 }
4048 else
4049 {
4051 }
4052
4053 // compute impulse and apply only if the body dies
4054 if (IsDamageDestroyed() && car.GetSpeedometerAbsolute() > 3)
4055 {
4056 impulse = 40 * m_TransportHitVelocity;
4057 impulse[1] = 40 * 1.5;
4058 dBodyApplyImpulse(this, impulse);
4059 }
4060 }
4061 else if (Boat.CastTo(boat, transport))
4062 {
4063 Human player = Human.Cast(this);
4064 if (player && player.PhysicsGetLinkedEntity() == boat) // standing on boat
4065 {
4067 return;
4068 }
4069
4070 if (m_TransportHitVelocity.Normalize() > 5) // 5 m/s
4071 {
4072 damage = m_TransportHitVelocity.Length() * 0.5;
4073 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4074 }
4075 else
4077 }
4078 else //old solution just in case if somebody use it
4079 {
4080 // avoid damage because of small movements
4081 if (m_TransportHitVelocity.Length() > 0.1)
4082 {
4083 damage = m_TransportHitVelocity.Length();
4084 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4085 }
4086 else
4087 {
4089 }
4090
4091 // compute impulse and apply only if the body dies
4092 if (IsDamageDestroyed() && m_TransportHitVelocity.Length() > 0.3)
4093 {
4094 impulse = 40 * m_TransportHitVelocity;
4095 impulse[1] = 40 * 1.5;
4096 dBodyApplyImpulse(this, impulse);
4097 }
4098 }
4099 }
4100 }
bool m_TransportHitRegistered
Определения EntityAI.c:138
vector m_TransportHitVelocity
Определения 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.