use bevy::prelude::*; use crate::state::AppState; pub mod components; pub mod input; pub mod kinematic; pub mod orbit; pub struct MovementPlugin; impl Plugin for MovementPlugin { fn build(&self, app: &mut App) { app.add_event::() // Orbital motion is scene-wide (used by the galaxy inspection scene // too), so it runs in every state. .add_systems(Update, orbit::update_orbits) // Flight steering chain: order → track approach → steer → integrate. // Gated to InGame — these only do something while entities with the // flight-physics components exist. Right-click input additionally // requires the player to be in flight, not docked. .add_systems( Update, ( input::right_click_to_move.run_if(input::when_in_flight), kinematic::track_approach_target, kinematic::steer_to_target, kinematic::integrate_velocity, ) .chain() .run_if(in_state(AppState::InGame)), ); } }