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

Method Hit

ogsr_engine/xrGame/PHCollisionDamageReceiver.cpp:80–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79const static float hit_threthhold = 5.f;
80void CPHCollisionDamageReceiver::Hit(u16 source_id, u16 bone_id, float power, const Fvector& dir, Fvector& pos)
81{
82 DAMAGE_BONES_I i = FindBone(bone_id);
83 if (i == m_controled_bones.end())
84 return;
85 power *= i->second;
86 if (power < hit_threthhold)
87 return;
88
89 NET_Packet P;
90 CPhysicsShellHolder* ph = PPhysicsShellHolder();
91 SHit HS;
92
93 HS.GenHeader(GE_HIT, ph->ID()); // ph->u_EventGen(P,GE_HIT,ph->ID());
94 HS.whoID = ph->ID(); // P.w_u16 (ph->ID());
95 HS.weaponID = source_id; // P.w_u16 (source_id);
96 HS.dir = dir; // P.w_dir (dir);
97 HS.power = power; // P.w_float (power);
98 HS.boneID = s16(bone_id); // P.w_s16 (s16(bone_id));
99 HS.p_in_bone_space = pos; // P.w_vec3 (pos);
100 HS.impulse = 0.f; // P.w_float (0.f);
101 HS.hit_type = (ALife::eHitTypeStrike); // P.w_u16 (ALife::eHitTypeStrike);
102 HS.Write_Packet(P);
103
104 ph->u_EventSend(P);
105}
106
107void CPHCollisionDamageReceiver::Clear()
108{

Callers 1

CollisionCallbackMethod · 0.45

Calls 5

GenHeaderMethod · 0.80
Write_PacketMethod · 0.80
PPhysicsShellHolderFunction · 0.70
endMethod · 0.45
u_EventSendMethod · 0.45

Tested by

no test coverage detected