diff --git a/src/commands.rs b/src/commands.rs index ff45a34..0cddf8c 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -289,6 +289,9 @@ pub fn load_defs( ["moon", "yes"] => { state.is_moon = true; } + ["planet", "yes"] => { + state.is_moon = true; + } ["sun", "yes"] => { state.is_sun = true; } @@ -541,6 +544,7 @@ fn spawn_entities( if let Some(id) = &state.orbit_object_id { let mass = match id.as_str() { "jupiter" => nature::JUPITER_MASS, + "sol" => nature::JUPITER_MASS, _ => { error!("Found no mass for object `{id}`"); continue; @@ -548,7 +552,8 @@ fn spawn_entities( }; let orbital_period = nature::simple_orbital_period(mass, r); 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 { error!("Can't determine current time `{id}`"); 0.0 diff --git a/src/data/defs.txt b/src/data/defs.txt index 885937a..896640b 100644 --- a/src/data/defs.txt +++ b/src/data/defs.txt @@ -5,59 +5,86 @@ actor 0 0 0 sphere yes sun yes physics off - actor 0 0 0 orbitring - scale 57.91e9 - rotationz 0.0353 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off - actor 0 0 0 orbitring - scale 108.21e9 - rotationz 0.0119 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off - actor 0 0 0 orbitring - scale 149.598023e9 - rotationz 0.0088 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off - actor 0 0 0 orbitring - scale 227.939366e9 - rotationz 0.0091 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off - actor 0 0 0 orbitring - scale 778.479e9 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off - actor 0 0 0 orbitring - scale 1433.53e9 - rotationz 0.0052 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off - actor 0 0 0 orbitring - scale 2870.972e9 - rotationz 0.0055 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off - actor 0 0 0 orbitring - scale 4500e9 - rotationz 0.0041 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off - actor 0 0 0 orbitring - scale 5906.38e9 - rotationz 0.0953 - only_in_map_at_dist 1e10 jupiter - clickable no - physics off + actor 0 0 0 + planet yes + orbitaround sol 57.91e9 + actor 0 0 0 orbitring + scale 57.91e9 + rotationz 0.0353 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off + actor 0 0 0 + planet yes + orbitaround sol 108.21e9 + actor 0 0 0 orbitring + scale 108.21e9 + rotationz 0.0119 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off + actor 0 0 0 + planet yes + orbitaround sol 149.598023e9 + actor 0 0 0 orbitring + scale 149.598023e9 + rotationz 0.0088 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off + actor 0 0 0 + planet yes + orbitaround sol 227.939366e9 + actor 0 0 0 orbitring + scale 227.939366e9 + rotationz 0.0091 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off + actor 0 0 0 + planet yes + orbitaround sol 778.479e9 + actor 0 0 0 orbitring + scale 778.479e9 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off + actor 0 0 0 + planet yes + orbitaround sol 1433.53e9 + actor 0 0 0 orbitring + scale 1433.53e9 + rotationz 0.0052 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off + actor 0 0 0 + planet yes + orbitaround sol 2870.972e9 + actor 0 0 0 orbitring + scale 2870.972e9 + rotationz 0.0055 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off + actor 0 0 0 + planet yes + orbitaround sol 4500e9 + actor 0 0 0 orbitring + scale 4500e9 + rotationz 0.0041 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off + actor 0 0 0 + planet yes + orbitaround sol 5906.38e9 + actor 0 0 0 orbitring + scale 5906.38e9 + rotationz 0.0953 + only_in_map_at_dist 1e10 jupiter + clickable no + physics off actor 0 0 0 jupiter relativeto sol diff --git a/src/nature.rs b/src/nature.rs index 3aab695..80f7164 100644 --- a/src/nature.rs +++ b/src/nature.rs @@ -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 JUPITER_RADIUS: f64 = 71_492_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; // Each star's values: (x, y, z, magnitude, color index, distance, name)