//------------------------------------------------------------------------ void CGameRulesCommonDamageHandling::ClProcessHit(Vec3 dir, EntityId shooterId, EntityId weaponId, float damage, uint16 projectileClassId, uint8 hitTypeId) { const char* hit = g_pGame->GetGameRules()->GetHitType(hitTypeId); if(hit) { IActor *pClientActor = gEnv->pGame->GetIGameFramework()->GetClientActor(); string hitSound; hitSound.Format("ClientDamage%s", hit); float maxHealth = pClientActor->GetMaxHealth(); float normalizedDamage = SATURATE(maxHealth > 0.0f ? damage / maxHealth : 0.0f); CAudioSignalPlayer::JustPlay(hitSound.c_str(), pClientActor->GetEntityId(), "damage", normalizedDamage); } }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { switch (event) { case eFE_Activate: if (IsPortActive(pActInfo, INP_TRIGGER)) { IActor * pActor = GetAIActor(pActInfo); if (pActor) { int damage = GetPortInt(pActInfo, INP_DAMAGE); if (damage==0) damage = ( GetPortInt( pActInfo, INP_RELATIVEDAMAGE ) * int(pActor->GetMaxHealth()) ) / 100; SendFlowHitToEntity( pActor->GetEntityId(), pActor->GetEntityId(), damage, GetPortVec3(pActInfo, INP_POSITION) ); } } break; } }