From 9769658bfd654c534df9d509d1c47ea6fc8e64ec Mon Sep 17 00:00:00 2001 From: yuni Date: Sun, 15 Sep 2024 02:13:25 +0200 Subject: [PATCH] fix "Could not determine Jupiter's position" warning --- CHANGELOG.md | 2 +- Cargo.toml | 2 +- src/cmd.rs | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eba640e..023929d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # git development version -- Upgrade to Rust 1.80 +- Upgrade to Rust 1.81 - Add "`" (backtick) key to fast-forward conversations - Replace all "non-free" game assets with "free" variants - Fix dialogs diff --git a/Cargo.toml b/Cargo.toml index 4498532..306907f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ repository = "https://codeberg.org/outfly/outfly" categories = ["game", "aerospace", "simulation"] keywords = ["game", "space", "3d"] license = "GPL-3.0-only" -rust-version = "1.80.0" +rust-version = "1.81.0" [dependencies] # For parsing the game definition file, src/data/defs.txt diff --git a/src/cmd.rs b/src/cmd.rs index 6482f64..d76b9e9 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -818,12 +818,6 @@ fn spawn_entities( settings: Res, ) { for state_wrapper in er_spawn.read() { - let jupiter_pos: DVec3 = if let Some(jupiter_pos) = id2pos.0.get(ID_JUPITER) { - *jupiter_pos - } else { - warn!("Could not determine Jupiter's position"); - DVec3::ZERO - }; let state = &state_wrapper.0; let mut rotation = state.rotation; @@ -863,8 +857,14 @@ fn spawn_entities( 1.0 } * state.model_scale, ); - let orbits_jupiter = state.id != ID_JUPITER; + let orbits_jupiter = state.has_physics && state.id != ID_JUPITER; let velocity = if orbits_jupiter { + let jupiter_pos: DVec3 = if let Some(jupiter_pos) = id2pos.0.get(ID_JUPITER) { + *jupiter_pos + } else { + warn!("Could not determine Jupiter's position"); + DVec3::ZERO + }; let coords = absolute_pos - jupiter_pos; state.velocity + nature::orbital_velocity(coords, nature::JUPITER_MASS) } else {