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

Method Contact

ogsr_engine/xrGame/ExplosiveRocket.cpp:46–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void CExplosiveRocket::Contact(const Fvector& pos, const Fvector& normal)
47{
48 if (eCollide == m_eState)
49 return;
50
51 bool safe_to_explode = true;
52 if (m_bLaunched)
53 {
54 if (m_pOwner)
55 {
56 float dist = m_pOwner->Position().distance_to(pos);
57 if (dist < m_safe_dist_to_explode)
58 {
59 safe_to_explode = false;
60 CActor* pActor = smart_cast<CActor*>(m_pOwner);
61 if (pActor)
62 {
63 u32 lvid = UsedAI_Locations() ? ai_location().level_vertex_id() : ai().level_graph().nearest_vertex_id(pos);
64 CSE_Abstract* object = Level().spawn_item(real_grenade_name.c_str(), pos, lvid, 0xffff, true);
65
66 CSE_ALifeItemAmmo* ammo = smart_cast<CSE_ALifeItemAmmo*>(object);
67 ammo->m_boxSize = 1;
68
69 NET_Packet P;
70 object->Spawn_Write(P, TRUE);
71 Level().Send(P, net_flags(TRUE));
72 F_entity_Destroy(object);
73 }
74 DestroyObject();
75 }
76 }
77 if (safe_to_explode)
78 CExplosive::GenExplodeEvent(pos, normal);
79 }
80
81 inherited::Contact(pos, normal);
82}
83
84void CExplosiveRocket::net_Destroy()
85{

Callers

nothing calls this directly

Calls 10

net_flagsFunction · 0.85
F_entity_DestroyFunction · 0.85
PositionMethod · 0.80
nearest_vertex_idMethod · 0.80
Spawn_WriteMethod · 0.80
distance_toMethod · 0.45
level_vertex_idMethod · 0.45
spawn_itemMethod · 0.45
c_strMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected