| 97 | } |
| 98 | } |
| 99 | void CDestroyablePhysicsObject::Destroy() |
| 100 | { |
| 101 | VERIFY(!ph_world->Processing()); |
| 102 | const CGameObject* who_object = smart_cast<const CGameObject*>(FatalHit().initiator()); |
| 103 | callback(GameObject::eDeath)(lua_game_object(), |
| 104 | who_object ? who_object->lua_game_object() : 0); // https://github.com/OpenXRay/xray-16/commit/32005e8e253ff084469ca19e405de2b2a35c4c90 |
| 105 | CPHDestroyable::Destroy(ID(), "physic_destroyable_object"); |
| 106 | if (m_destroy_sound._handle()) |
| 107 | { |
| 108 | m_destroy_sound.play_at_pos(this, Position()); |
| 109 | } |
| 110 | if (*m_destroy_particles) |
| 111 | { |
| 112 | // Fvector dir;dir.set(0,1,0); |
| 113 | Fmatrix m; |
| 114 | m.identity(); |
| 115 | ///////////////////////////////////////////////// |
| 116 | m.j.set(0, 1.f, 0); |
| 117 | /////////////////////////////////////////////// |
| 118 | |
| 119 | Fvector hdir; |
| 120 | hdir.set(CPHDestroyable::FatalHit().direction()); |
| 121 | |
| 122 | if (fsimilar(_abs(m.j.dotproduct(hdir)), 1.f, EPS_L)) |
| 123 | { |
| 124 | do |
| 125 | { |
| 126 | hdir.random_dir(); |
| 127 | } while (fsimilar(_abs(m.j.dotproduct(hdir)), 1.f, EPS_L)); |
| 128 | } |
| 129 | m.i.crossproduct(m.j, hdir); |
| 130 | m.i.normalize(); |
| 131 | m.k.crossproduct(m.i, m.j); |
| 132 | StartParticles(m_destroy_particles, m, ID()); |
| 133 | } |
| 134 | SheduleRegister(); |
| 135 | } |
| 136 | void CDestroyablePhysicsObject::InitServerObject(CSE_Abstract* D) |
| 137 | { |
| 138 | CSE_PHSkeleton* ps = smart_cast<CSE_PHSkeleton*>(D); |
nothing calls this directly
no test coverage detected