WIP crisper camera controls (fix match velocity in vehicles)

This commit is contained in:
yuni 2024-11-17 01:54:47 +01:00
parent 0ea4c00151
commit d4c8ca231a

View file

@ -180,6 +180,8 @@ pub struct ActorEnteringVehicle;
#[derive(Component)]
pub struct ActorVehicleBeingEntered;
#[derive(Component)]
pub struct HiddenInsideVehicle;
#[derive(Component)]
pub struct MessageOnVehicleEntry(pub String);
#[derive(Component)]
pub struct PlayersFlashLight;
@ -597,6 +599,7 @@ pub fn handle_vehicle_enter_exit(
commands.entity(driver).remove::<Collider>();
commands.entity(driver).remove::<WantsAcceleration>();
commands.entity(driver).insert(JustNowEnteredVehicle);
commands.entity(driver).insert(HiddenInsideVehicle);
commands
.entity(vehicle)
.insert(WantsAcceleration::default());
@ -623,6 +626,7 @@ pub fn handle_vehicle_enter_exit(
Quat::from_rotation_y(180f32.to_radians());
flashlight_trans.translation = Vec3::new(0.0, 0.0, 1.0);
}
commands.entity(driver).remove::<HiddenInsideVehicle>();
commands.entity(driver).insert(WantsAcceleration::default());
commands.entity(driver).insert(RigidBody::Dynamic);
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::ExitVehicle));
@ -771,7 +775,7 @@ fn handle_wants_acceleration(
Option<&hud::IsTargeted>,
Option<&PlayerCamera>,
),
Without<visual::IsEffect>,
(Without<visual::IsEffect>, Without<HiddenInsideVehicle>),
>,
mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
) {