//------------------------------------------------------------------------ void CMelee::NetShootEx(const Vec3 &pos, const Vec3 &dir, const Vec3 &vel, const Vec3 &hit, float extra, int ph) { CActor *pActor = m_pWeapon->GetOwnerActor(); if(!pActor) return; IMovementController * pMC = pActor->GetMovementController(); if (!pMC) return; float strength = 1.0f;//pActor->GetActorStrength(); if (pActor->GetActorClass() == CPlayer::GetActorClassType()) { CPlayer *pPlayer = (CPlayer *)pActor; if (CNanoSuit *pSuit = pPlayer->GetNanoSuit()) { ENanoMode curMode = pSuit->GetMode(); if (curMode == NANOMODE_STRENGTH) { strength = pActor->GetActorStrength(); strength = strength * (1.0f + 2.0f * pSuit->GetSlotValue(NANOSLOT_STRENGTH)*STRENGTH_MULT); } } } if (!PerformRayTest(pos, dir, strength, true)) if(!PerformCylinderTest(pos, dir, strength, true)) ApplyCameraShake(false); m_ignoredEntity = 0; m_meleeScale = 1.0f; }
float CMelee::GetOwnerStrength() const { CActor *pActor = m_pWeapon->GetOwnerActor(); if(!pActor) return 1.0f; IMovementController * pMC = pActor->GetMovementController(); if (!pMC) return 1.0f; float strength = 1.0f;//pActor->GetActorStrength(); if (pActor->GetActorClass() == CPlayer::GetActorClassType()) { CPlayer *pPlayer = (CPlayer *)pActor; if (CNanoSuit *pSuit = pPlayer->GetNanoSuit()) { ENanoMode curMode = pSuit->GetMode(); if (curMode == NANOMODE_STRENGTH) { strength = pActor->GetActorStrength(); strength = strength * (1.0f + 2.0f * pSuit->GetSlotValue(NANOSLOT_STRENGTH)*STRENGTH_MULT); } } } return strength; }
//------------------------------------------------------------------------ void CMelee::Update(float frameTime, uint frameId) { FUNCTION_PROFILER( GetISystem(), PROFILE_GAME ); bool requireUpdate = false; if (m_attacking) { requireUpdate = true; if (m_delayTimer>0.0f) { m_delayTimer-=frameTime; if (m_delayTimer<=0.0f) m_delayTimer=0.0f; } else { if (!m_attacked) { m_attacked = true; CActor *pActor = m_pWeapon->GetOwnerActor(); if(!pActor) return; Vec3 pos(ZERO); Vec3 dir(ZERO); IMovementController * pMC = pActor->GetMovementController(); if (!pMC) return; float strength = 1.0f;//pActor->GetActorStrength(); if (pActor->GetActorClass() == CPlayer::GetActorClassType()) { CPlayer *pPlayer = (CPlayer *)pActor; if (CNanoSuit *pSuit = pPlayer->GetNanoSuit()) { ENanoMode curMode = pSuit->GetMode(); if (curMode == NANOMODE_STRENGTH) { strength = pActor->GetActorStrength(); strength = strength * (1.0f + 2.0f * pSuit->GetSlotValue(NANOSLOT_STRENGTH)* STRENGTH_MULT); if(!pPlayer->IsPlayer() && g_pGameCVars->g_difficultyLevel < 4) strength *= g_pGameCVars->g_AiSuitStrengthMeleeMult; } } } SMovementState info; pMC->GetMovementState(info); pos = info.eyePosition; dir = info.eyeDirection; if (!PerformRayTest(pos, dir, strength, false)) if(!PerformCylinderTest(pos, dir, strength, false)) ApplyCameraShake(false); m_ignoredEntity = 0; m_meleeScale = 1.0f; m_pWeapon->RequestMeleeAttack(m_pWeapon->GetMeleeFireMode()==this, pos, dir); } } } if (requireUpdate) m_pWeapon->RequireUpdate(eIUS_FireMode); }