MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Destroy

Method Destroy

ogsr_engine/xrGame/DestroyablePhysicsObject.cpp:99–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 }
98}
99void 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}
136void CDestroyablePhysicsObject::InitServerObject(CSE_Abstract* D)
137{
138 CSE_PHSkeleton* ps = smart_cast<CSE_PHSkeleton*>(D);

Callers

nothing calls this directly

Calls 15

callbackClass · 0.85
DestroyFunction · 0.85
IDFunction · 0.85
fsimilarFunction · 0.85
initiatorMethod · 0.80
lua_game_objectMethod · 0.80
_handleMethod · 0.80
directionMethod · 0.80
random_dirMethod · 0.80
_absFunction · 0.50
play_at_posMethod · 0.45
identityMethod · 0.45

Tested by

no test coverage detected