disable jupiter orbital clock when not in orbit around jupiter
This commit is contained in:
parent
11dfbad5af
commit
324659e041
19
src/menu.rs
19
src/menu.rs
|
@ -481,12 +481,21 @@ pub fn update_menu(
|
||||||
id2pos.0.get(cmd::ID_PLAYER),
|
id2pos.0.get(cmd::ID_PLAYER),
|
||||||
id2pos.0.get(cmd::ID_JUPITER),
|
id2pos.0.get(cmd::ID_JUPITER),
|
||||||
) {
|
) {
|
||||||
let (clock_max, clock_current) =
|
let clock = if player_pos.y.abs() < 1e7 && player_pos.distance(*jupiter_pos) < 1e10
|
||||||
nature::pos_to_orbit_time(*player_pos, *jupiter_pos, nature::JUPITER_MASS);
|
{
|
||||||
|
let (clock_max, clock_current) =
|
||||||
|
nature::pos_to_orbit_time(*player_pos, *jupiter_pos, nature::JUPITER_MASS);
|
||||||
|
format!(
|
||||||
|
"{} of {}",
|
||||||
|
nature::format_seconds_to_hour_min(clock_current),
|
||||||
|
nature::format_seconds_to_hour_min(clock_max)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
String::from("ERROR: Not in orbit around Jupiter.")
|
||||||
|
};
|
||||||
text.sections[0].value = format!(
|
text.sections[0].value = format!(
|
||||||
"Orbital Clock:\n{} of {}\n{} {}",
|
"Orbital Clock:\n{}\n{} {}",
|
||||||
nature::format_seconds_to_hour_min(clock_current),
|
clock,
|
||||||
nature::format_seconds_to_hour_min(clock_max),
|
|
||||||
GAME_NAME,
|
GAME_NAME,
|
||||||
settings.version.as_str()
|
settings.version.as_str()
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue