| 59 | } |
| 60 | |
| 61 | void CHairsZone::Affect(SZoneObjectInfo* O) |
| 62 | { |
| 63 | CPhysicsShellHolder* pGameObject = smart_cast<CPhysicsShellHolder*>(O->object); |
| 64 | if (!pGameObject) |
| 65 | return; |
| 66 | |
| 67 | if (O->zone_ignore) |
| 68 | return; |
| 69 | |
| 70 | Fvector P; |
| 71 | XFORM().transform_tiny(P, CFORM()->getSphere().P); |
| 72 | |
| 73 | #ifdef DEBUG |
| 74 | if (bDebug) |
| 75 | { |
| 76 | char l_pow[255]; |
| 77 | sprintf_s(l_pow, "zone hit. %.1f", Power(pGameObject->Position().distance_to(P))); |
| 78 | Msg("%s %s", *pGameObject->cName(), l_pow); |
| 79 | } |
| 80 | #endif |
| 81 | |
| 82 | Fvector hit_dir; |
| 83 | hit_dir.set(::Random.randF(-.5f, .5f), ::Random.randF(.0f, 1.f), ::Random.randF(-.5f, .5f)); |
| 84 | hit_dir.normalize(); |
| 85 | |
| 86 | Fvector position_in_bone_space; |
| 87 | |
| 88 | P.y = pGameObject->Position().y; |
| 89 | float power = Power(pGameObject->Position().distance_to(P)); |
| 90 | float impulse = m_fHitImpulseScale * power * pGameObject->GetMass(); |
| 91 | |
| 92 | //статистика по объекту |
| 93 | O->total_damage += power; |
| 94 | O->hit_num++; |
| 95 | |
| 96 | if (power > 0.01f) |
| 97 | { |
| 98 | m_dwDeltaTime = 0; |
| 99 | position_in_bone_space.set(0.f, 0.f, 0.f); |
| 100 | |
| 101 | CreateHit(pGameObject->ID(), ID(), hit_dir, power, 0, position_in_bone_space, impulse, m_eHitTypeBlowout); |
| 102 | |
| 103 | PlayHitParticles(pGameObject); |
| 104 | } |
| 105 | } |
nothing calls this directly
no test coverage detected