mark solar system planets (and pluto) the same way as moons

This commit is contained in:
yuni 2024-05-01 17:55:05 +02:00
parent 90e4f36fff
commit 2cb9f10f4b
3 changed files with 88 additions and 54 deletions

View file

@ -289,6 +289,9 @@ pub fn load_defs(
["moon", "yes"] => { ["moon", "yes"] => {
state.is_moon = true; state.is_moon = true;
} }
["planet", "yes"] => {
state.is_moon = true;
}
["sun", "yes"] => { ["sun", "yes"] => {
state.is_sun = true; state.is_sun = true;
} }
@ -541,6 +544,7 @@ fn spawn_entities(
if let Some(id) = &state.orbit_object_id { if let Some(id) = &state.orbit_object_id {
let mass = match id.as_str() { let mass = match id.as_str() {
"jupiter" => nature::JUPITER_MASS, "jupiter" => nature::JUPITER_MASS,
"sol" => nature::JUPITER_MASS,
_ => { _ => {
error!("Found no mass for object `{id}`"); error!("Found no mass for object `{id}`");
continue; continue;
@ -548,7 +552,8 @@ fn spawn_entities(
}; };
let orbital_period = nature::simple_orbital_period(mass, r); let orbital_period = nature::simple_orbital_period(mass, r);
phase_radians += if let Ok(epoch) = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { phase_radians += if let Ok(epoch) = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
PI64 * 2.0 * (epoch.as_secs_f64() % orbital_period) / orbital_period let now = epoch.as_secs_f64() + 614533234154.0; // random
PI64 * 2.0 * (now % orbital_period) / orbital_period
} else { } else {
error!("Can't determine current time `{id}`"); error!("Can't determine current time `{id}`");
0.0 0.0

View file

@ -5,53 +5,80 @@ actor 0 0 0
sphere yes sphere yes
sun yes sun yes
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 57.91e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 57.91e9 scale 57.91e9
rotationz 0.0353 rotationz 0.0353
only_in_map_at_dist 1e10 jupiter only_in_map_at_dist 1e10 jupiter
clickable no clickable no
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 108.21e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 108.21e9 scale 108.21e9
rotationz 0.0119 rotationz 0.0119
only_in_map_at_dist 1e10 jupiter only_in_map_at_dist 1e10 jupiter
clickable no clickable no
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 149.598023e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 149.598023e9 scale 149.598023e9
rotationz 0.0088 rotationz 0.0088
only_in_map_at_dist 1e10 jupiter only_in_map_at_dist 1e10 jupiter
clickable no clickable no
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 227.939366e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 227.939366e9 scale 227.939366e9
rotationz 0.0091 rotationz 0.0091
only_in_map_at_dist 1e10 jupiter only_in_map_at_dist 1e10 jupiter
clickable no clickable no
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 778.479e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 778.479e9 scale 778.479e9
only_in_map_at_dist 1e10 jupiter only_in_map_at_dist 1e10 jupiter
clickable no clickable no
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 1433.53e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 1433.53e9 scale 1433.53e9
rotationz 0.0052 rotationz 0.0052
only_in_map_at_dist 1e10 jupiter only_in_map_at_dist 1e10 jupiter
clickable no clickable no
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 2870.972e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 2870.972e9 scale 2870.972e9
rotationz 0.0055 rotationz 0.0055
only_in_map_at_dist 1e10 jupiter only_in_map_at_dist 1e10 jupiter
clickable no clickable no
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 4500e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 4500e9 scale 4500e9
rotationz 0.0041 rotationz 0.0041
only_in_map_at_dist 1e10 jupiter only_in_map_at_dist 1e10 jupiter
clickable no clickable no
physics off physics off
actor 0 0 0
planet yes
orbitaround sol 5906.38e9
actor 0 0 0 orbitring actor 0 0 0 orbitring
scale 5906.38e9 scale 5906.38e9
rotationz 0.0953 rotationz 0.0953

View file

@ -28,6 +28,8 @@ pub const G: f64 = 6.6743015e-11; // Gravitational constant in Nm²/kg²
pub const SOL_RADIUS: f64 = 696_300_000.0; pub const SOL_RADIUS: f64 = 696_300_000.0;
pub const JUPITER_RADIUS: f64 = 71_492_000.0; pub const JUPITER_RADIUS: f64 = 71_492_000.0;
pub const JUPITER_RING_RADIUS: f64 = 229_000_000.0; pub const JUPITER_RING_RADIUS: f64 = 229_000_000.0;
pub const SOL_MASS: f64 = 1.9885e30;
pub const JUPITER_MASS: f64 = 1.8982e27; pub const JUPITER_MASS: f64 = 1.8982e27;
// Each star's values: (x, y, z, magnitude, color index, distance, name) // Each star's values: (x, y, z, magnitude, color index, distance, name)