fix "Could not determine Jupiter's position" warning

This commit is contained in:
yuni 2024-09-15 02:13:25 +02:00
parent 75b20976de
commit 9769658bfd
3 changed files with 9 additions and 9 deletions

View file

@ -1,6 +1,6 @@
# git development version # git development version
- Upgrade to Rust 1.80 - Upgrade to Rust 1.81
- Add "`" (backtick) key to fast-forward conversations - Add "`" (backtick) key to fast-forward conversations
- Replace all "non-free" game assets with "free" variants - Replace all "non-free" game assets with "free" variants
- Fix dialogs - Fix dialogs

View file

@ -17,7 +17,7 @@ repository = "https://codeberg.org/outfly/outfly"
categories = ["game", "aerospace", "simulation"] categories = ["game", "aerospace", "simulation"]
keywords = ["game", "space", "3d"] keywords = ["game", "space", "3d"]
license = "GPL-3.0-only" license = "GPL-3.0-only"
rust-version = "1.80.0" rust-version = "1.81.0"
[dependencies] [dependencies]
# For parsing the game definition file, src/data/defs.txt # For parsing the game definition file, src/data/defs.txt

View file

@ -818,12 +818,6 @@ fn spawn_entities(
settings: Res<var::Settings>, settings: Res<var::Settings>,
) { ) {
for state_wrapper in er_spawn.read() { 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 state = &state_wrapper.0;
let mut rotation = state.rotation; let mut rotation = state.rotation;
@ -863,8 +857,14 @@ fn spawn_entities(
1.0 1.0
} * state.model_scale, } * 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 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; let coords = absolute_pos - jupiter_pos;
state.velocity + nature::orbital_velocity(coords, nature::JUPITER_MASS) state.velocity + nature::orbital_velocity(coords, nature::JUPITER_MASS)
} else { } else {