cargo fmt

This commit is contained in:
yuni 2024-10-03 06:08:51 +02:00
parent 212f62fbc6
commit 26ec38e9ce
4 changed files with 36 additions and 15 deletions

View file

@ -345,7 +345,14 @@ pub fn update_physics_lifeforms(
time: Res<Time>, time: Res<Time>,
settings: Res<Settings>, settings: Res<Settings>,
id2pos: Res<game::Id2Pos>, id2pos: Res<game::Id2Pos>,
mut query: Query<(&mut LifeForm, &mut HitPoints, &mut Suit, &LinearVelocity, &Position, Option<&Player>)>, mut query: Query<(
&mut LifeForm,
&mut HitPoints,
&mut Suit,
&LinearVelocity,
&Position,
Option<&Player>,
)>,
) { ) {
let d = time.delta_seconds(); let d = time.delta_seconds();
for (mut lifeform, mut hp, mut suit, velocity, pos, player) in query.iter_mut() { for (mut lifeform, mut hp, mut suit, velocity, pos, player) in query.iter_mut() {

View file

@ -691,7 +691,12 @@ pub fn apply_input_to_player(
actor::EngineType::Monopropellant, actor::EngineType::Monopropellant,
sinks.get(&audio::Sfx::Thruster), sinks.get(&audio::Sfx::Thruster),
), ),
(1.0, 1.0, actor::EngineType::Ion, sinks.get(&audio::Sfx::Ion)), (
1.0,
1.0,
actor::EngineType::Ion,
sinks.get(&audio::Sfx::Ion),
),
]; ];
let seconds_to_max_vol = 0.05; let seconds_to_max_vol = 0.05;
let seconds_to_min_vol = 0.05; let seconds_to_min_vol = 0.05;

View file

@ -488,8 +488,16 @@ pub fn update_menu(
} }
MenuAction::ToggleAR => { MenuAction::ToggleAR => {
let onoff = bool2string(settings.hud_active); let onoff = bool2string(settings.hud_active);
let p = if settings.hud_active { actor::POWER_DRAIN_AR } else { 0.0 }; let p = if settings.hud_active {
let w = if p > 0.0 { format!(" ({p}W)") } else { String::from("") }; actor::POWER_DRAIN_AR
} else {
0.0
};
let w = if p > 0.0 {
format!(" ({p}W)")
} else {
String::from("")
};
text.sections[i].value = format!("Augmented Reality: {onoff}{w} [TAB]\n"); text.sections[i].value = format!("Augmented Reality: {onoff}{w} [TAB]\n");
} }
MenuAction::ModLightAmp => { MenuAction::ModLightAmp => {
@ -508,7 +516,11 @@ pub fn update_menu(
_ => "ERROR", _ => "ERROR",
}; };
let p = actor::POWER_DRAIN_THRUSTER[prefs.thruster_boost]; let p = actor::POWER_DRAIN_THRUSTER[prefs.thruster_boost];
let w = if p > 0.0 { format!(" ({p}W)") } else { String::from("") }; let w = if p > 0.0 {
format!(" ({p}W)")
} else {
String::from("")
};
text.sections[i].value = format!("Thruster Boost: {state}{w}\n"); text.sections[i].value = format!("Thruster Boost: {state}{w}\n");
} }
MenuAction::ModReactor => { MenuAction::ModReactor => {
@ -519,7 +531,11 @@ pub fn update_menu(
_ => "ERROR", _ => "ERROR",
}; };
let p = actor::POWER_GAIN_REACTOR[settings.reactor_state]; let p = actor::POWER_GAIN_REACTOR[settings.reactor_state];
let w = if p > 0.0 { format!(" (+{p}W)") } else { String::from("") }; let w = if p > 0.0 {
format!(" (+{p}W)")
} else {
String::from("")
};
text.sections[i].value = format!("Reactor: {state}{w}\n"); text.sections[i].value = format!("Reactor: {state}{w}\n");
} }
MenuAction::ChangeARAvatar => { MenuAction::ChangeARAvatar => {
@ -541,11 +557,7 @@ pub fn update_menu(
text.sections[i].value = format!("\nCamera: {onoff} [C]\n"); text.sections[i].value = format!("\nCamera: {onoff} [C]\n");
} }
MenuAction::ToggleShadows => { MenuAction::ToggleShadows => {
let onoff = if settings.shadows_sun { let onoff = if settings.shadows_sun { "High" } else { "Low" };
"High"
} else {
"Low"
};
text.sections[i].value = format!("Shadows: {onoff}\n"); text.sections[i].value = format!("Shadows: {onoff}\n");
} }
_ => {} _ => {}

View file

@ -232,10 +232,7 @@ pub fn pos_offset_for_orbiting_body(
} }
/// Assumes the "front" (as seen in blender) is pointing at the orbited mass /// Assumes the "front" (as seen in blender) is pointing at the orbited mass
pub fn rotation_for_orbiting_body( pub fn rotation_for_orbiting_body(orbit_distance: f64, mass: f64) -> f64 {
orbit_distance: f64,
mass: f64,
) -> f64 {
if let Ok(epoch) = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { if let Ok(epoch) = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
let orbital_period = nature::simple_orbital_period(mass, orbit_distance); let orbital_period = nature::simple_orbital_period(mass, orbit_distance);
let now = epoch.as_secs_f64() + ORBIT_TIME_OFFSET; let now = epoch.as_secs_f64() + ORBIT_TIME_OFFSET;