From 94bf21b34027e5646f2c6c1f0e6bb83b97f25d33 Mon Sep 17 00:00:00 2001 From: yuni Date: Sat, 16 Nov 2024 22:29:19 +0100 Subject: [PATCH] WIP crisper camera controls (play engine sound) --- src/actor.rs | 92 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 8 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 17964a9..a567401 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -40,7 +40,7 @@ impl Plugin for ActorPlugin { update_power.run_if(game_running), handle_gravity.run_if(game_running), handle_wants_rotation.run_if(game_running), - handle_wants_acceleration.run_if(game_running), + handle_wants_acceleration.run_if(game_running).run_if(alive), handle_wants_maxrotation.run_if(game_running), handle_wants_maxvelocity .run_if(game_running) @@ -231,7 +231,7 @@ pub enum EngineType { Ion, } -#[derive(Component)] +#[derive(Component, Copy, Clone)] pub struct Engine { pub thrust_forward: f32, pub thrust_back: f32, @@ -588,7 +588,9 @@ pub fn handle_vehicle_enter_exit( commands.entity(driver).remove::(); commands.entity(driver).remove::(); commands.entity(driver).insert(JustNowEnteredVehicle); - commands.entity(vehicle).insert(WantsAcceleration::default()); + commands + .entity(vehicle) + .insert(WantsAcceleration::default()); commands.entity(vehicle).remove::(); commands.entity(vehicle).insert(PlayerCamera); commands.entity(vehicle).insert(PlayerDrivesThis); @@ -722,23 +724,29 @@ fn handle_wants_rotation(mut q_actor: Query<(&mut Rotation, &WantsRotation)>) { } fn handle_wants_acceleration( + time: Res