From 2d185a810b74d5bf08ea46b997734e881e4b3168 Mon Sep 17 00:00:00 2001 From: yuni Date: Wed, 27 Nov 2024 02:33:02 +0100 Subject: [PATCH] WIP jupiter atmosphere --- src/actor.rs | 68 ++++++++++++++++++++++++++++++++++++++++++----- src/cmd.rs | 25 +++++++++++++++++ src/data/defs.txt | 1 + src/nature.rs | 2 ++ 4 files changed, 90 insertions(+), 6 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index f213544..3297b10 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -58,12 +58,20 @@ impl Plugin for ActorPlugin { app.add_systems( PostUpdate, - handle_gforce - .run_if(game_running) - .run_if(alive) - .after(PhysicsSet::Sync) - .after(sync::position_to_transform) - .after(handle_wants_acceleration), + ( + handle_gforce + .run_if(game_running) + .run_if(alive) + .after(PhysicsSet::Sync) + .after(sync::position_to_transform) + .after(handle_wants_acceleration), + handle_atmosphere + .run_if(game_running) + .run_if(alive) + .after(PhysicsSet::Sync) + .after(sync::position_to_transform) + .before(handle_gforce), + ), ); app.add_systems( Update, @@ -205,6 +213,13 @@ pub struct WantsMatchVelocityWith(pub String); pub struct Identifier(pub String); #[derive(Component)] pub struct OrbitsJupiter; +#[derive(Component)] +pub struct ExperiencesAtmosphere; +#[derive(Component, Debug)] +pub struct HasAtmosphere { + pub r_inner: f64, + pub r_outer: f64, +} #[derive(Component)] pub struct LifeForm { @@ -1109,3 +1124,44 @@ fn handle_gravity( v.0 += accel; } } + +fn handle_atmosphere( + time: Res