//------------------------------------------------------------------------ void CVehicleMountedWeapon::Update( SEntityUpdateContext& ctx, int update) { CHeavyMountedWeapon::Update(ctx, update); if(update==eIUS_General) { if (m_fm && m_fm->IsFiring()) { m_dtWaterLevelCheck -= ctx.fFrameTime; if (m_dtWaterLevelCheck <= 0.f) { if (!CheckWaterLevel()) StopFire(); m_dtWaterLevelCheck = 2.0f; } } // Perform position sync if necessary if(IsRippingOff() && gEnv->bMultiplayer) { CorrectRipperEntityPosition(ctx.fFrameTime); } } m_usedThisFrame = false; }
//------------------------------------------------------------------------ void CVehicleMountedWeapon::StartFire() { if (!CheckWaterLevel()) return; CWeapon::StartFire(); }
//------------------------------------------------------------------------ void CVehicleWeapon::Update( SEntityUpdateContext& ctx, int update) { CWeapon::Update(ctx, update); if(update==eIUS_General) { if (m_fm && m_fm->IsFiring()) { m_dtWaterLevelCheck -= ctx.fFrameTime; if (m_dtWaterLevelCheck <= 0.f) { if (!CheckWaterLevel()) StopFire(); m_dtWaterLevelCheck = 2.0f; } } if (m_stats.mounted) { UpdateMounted(ctx.fFrameTime); } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- bool CPropJeep::CheckWater( void ) { bool bInWater = false; // Check all four wheels. for ( int iWheel = 0; iWheel < JEEP_WHEEL_COUNT; ++iWheel ) { // Get the current wheel and get its contact point. IPhysicsObject *pWheel = m_VehiclePhysics.GetWheel( iWheel ); if ( !pWheel ) continue; // Check to see if we hit water. if ( pWheel->GetContactPoint( &m_WaterData.m_vecWheelContactPoints[iWheel], NULL ) ) { m_WaterData.m_bWheelInWater[iWheel] = ( UTIL_PointContents( m_WaterData.m_vecWheelContactPoints[iWheel] ) & MASK_WATER ) ? true : false; if ( m_WaterData.m_bWheelInWater[iWheel] ) { bInWater = true; } } } // Check the body and the BONNET. int iEngine = LookupAttachment( "vehicle_engine" ); Vector vecEnginePoint; QAngle vecEngineAngles; GetAttachment( iEngine, vecEnginePoint, vecEngineAngles ); m_WaterData.m_bBodyInWater = ( UTIL_PointContents( vecEnginePoint ) & MASK_WATER ) ? true : false; if ( m_WaterData.m_bBodyInWater ) { if ( m_bHasPoop ) { RemoveAllDecals(); m_bHasPoop = false; } if ( !m_VehiclePhysics.IsEngineDisabled() ) { m_VehiclePhysics.SetDisableEngine( true ); } } else { if ( m_VehiclePhysics.IsEngineDisabled() ) { m_VehiclePhysics.SetDisableEngine( false ); } } if ( bInWater ) { // Check the player's water level. CheckWaterLevel(); } return bInWater; }
//------------------------------------------------------------------------ void CVehicleWeapon::StartFire() { if (!CheckWaterLevel()) return; if(!CanFire()) return; CWeapon::StartFire(); }
//------------------------------------------------------------------------ void CVehicleWeapon::Update(SEntityUpdateContext &ctx, int update) { CWeapon::Update(ctx, update); if(update==eIUS_General) { if(m_fm && m_fm->IsFiring()) { m_dtWaterLevelCheck -= ctx.fFrameTime; if(m_dtWaterLevelCheck <= 0.f) { if(!CheckWaterLevel()) StopFire(); m_dtWaterLevelCheck = 2.0f; } } CheckForFriendlyAI(ctx.fFrameTime); CheckForFriendlyPlayers(ctx.fFrameTime); } }