diff --git a/src/actor.rs b/src/actor.rs index 7baef30..ed94544 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -44,6 +44,7 @@ impl Plugin for ActorPlugin { app.add_systems( Update, ( + handle_gravity, handle_input.run_if(in_control), handle_collisions, handle_damage, @@ -51,9 +52,16 @@ impl Plugin for ActorPlugin { ); app.add_systems(PostUpdate, (handle_vehicle_enter_exit,)); app.add_event::(); + app.insert_resource(GravityUpdateTimer(Timer::from_seconds( + 1.0, + TimerMode::Repeating, + ))); } } +#[derive(Resource)] +pub struct GravityUpdateTimer(Timer); + #[derive(Copy, Clone)] pub enum DamageType { Unknown, @@ -157,6 +165,8 @@ pub struct WantsMaxVelocity(pub f64); pub struct WantsToLookAt(pub String); #[derive(Component)] pub struct Identifier(pub String); +#[derive(Component)] +pub struct OrbitsJupiter; #[derive(Component)] pub struct LifeForm { @@ -632,3 +642,27 @@ fn handle_gforce( } } } + +fn handle_gravity( + time: Res