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