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

◆ RegisterTransportHit()

void Entity::RegisterTransportHit ( Transport transport)
inlineprotected

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

4087 {
4089 {
4092 Car car;
4093 Boat boat;
4094 float damage;
4095 vector impulse;
4096
4097 // a different attempt to solve hits from "standing" car to the players
4098 if (Car.CastTo(car, transport))
4099 {
4100 if (car.GetSpeedometerAbsolute() > 2 )
4101 {
4102 damage = m_TransportHitVelocity.Length();
4103 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4104 }
4105 else
4106 {
4108 }
4109
4110 // compute impulse and apply only if the body dies
4111 if (IsDamageDestroyed() && car.GetSpeedometerAbsolute() > 3)
4112 {
4113 impulse = 40 * m_TransportHitVelocity;
4114 impulse[1] = 40 * 1.5;
4115 dBodyApplyImpulse(this, impulse);
4116 }
4117 }
4118 else if (Boat.CastTo(boat, transport))
4119 {
4120 Human player = Human.Cast(this);
4121 if (player && player.PhysicsGetLinkedEntity() == boat) // standing on boat
4122 {
4124 return;
4125 }
4126
4127 if (m_TransportHitVelocity.Normalize() > 5) // 5 m/s
4128 {
4129 damage = m_TransportHitVelocity.Length() * 0.5;
4130 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4131 }
4132 else
4134 }
4135 else //old solution just in case if somebody use it
4136 {
4137 // avoid damage because of small movements
4138 if (m_TransportHitVelocity.Length() > 0.1)
4139 {
4140 damage = m_TransportHitVelocity.Length();
4141 ProcessDirectDamage(DT_CUSTOM, transport, "", "TransportHit", "0 0 0", damage);
4142 }
4143 else
4144 {
4146 }
4147
4148 // compute impulse and apply only if the body dies
4149 if (IsDamageDestroyed() && m_TransportHitVelocity.Length() > 0.3)
4150 {
4151 impulse = 40 * m_TransportHitVelocity;
4152 impulse[1] = 40 * 1.5;
4153 dBodyApplyImpulse(this, impulse);
4154 }
4155 }
4156 }
4157 }
bool m_TransportHitRegistered
vector m_TransportHitVelocity
proto native IEntity PhysicsGetLinkedEntity()
entity we are linked to (not valid when IEntity.GetParent() returns some entity)
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 и Human::PhysicsGetLinkedEntity().