hide Size/Mass in HUD for stars (other than sol)
This commit is contained in:
parent
1344392a92
commit
ed75c225e4
25
src/hud.rs
25
src/hud.rs
|
@ -265,6 +265,7 @@ pub struct IsClickable {
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub pronoun: Option<String>,
|
pub pronoun: Option<String>,
|
||||||
pub displayed_mass: Option<f64>,
|
pub displayed_mass: Option<f64>,
|
||||||
|
pub hide_size: bool,
|
||||||
pub distance: Option<f64>,
|
pub distance: Option<f64>,
|
||||||
pub disable_in_map: bool,
|
pub disable_in_map: bool,
|
||||||
}
|
}
|
||||||
|
@ -1056,16 +1057,24 @@ fn update_hud(
|
||||||
} else {
|
} else {
|
||||||
"".to_string()
|
"".to_string()
|
||||||
};
|
};
|
||||||
let size = nature::readable_si(trans.scale.x as f64 * 2.0);
|
let size = if clickable.hide_size {
|
||||||
let mass = if let Some(mass) = clickable.displayed_mass {
|
"".to_string()
|
||||||
nature::readable_mass(mass)
|
|
||||||
} else if let Some(mass) = mass {
|
|
||||||
nature::readable_mass(mass.0)
|
|
||||||
} else {
|
} else {
|
||||||
String::from("?")
|
format!(
|
||||||
|
"Size: {}m\n",
|
||||||
|
nature::readable_si(trans.scale.x as f64 * 2.0)
|
||||||
|
)
|
||||||
};
|
};
|
||||||
text.sections[0].value =
|
let mass = if let Some(mass) = clickable.displayed_mass {
|
||||||
format!("Target: {target_name}\n{pronoun}Distance: {distance}\nSize: {size}m\nMass: {mass}\n\n");
|
format!("Mass: {}\n", nature::readable_mass(mass))
|
||||||
|
} else if let Some(mass) = mass {
|
||||||
|
format!("Mass: {}\n", nature::readable_mass(mass.0))
|
||||||
|
} else {
|
||||||
|
String::from("")
|
||||||
|
};
|
||||||
|
text.sections[0].value = format!(
|
||||||
|
"Target: {target_name}\n{pronoun}Distance: {distance}\n{size}{mass}\n"
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
text.sections[0].value = "".to_string();
|
text.sections[0].value = "".to_string();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,7 @@ pub fn setup(
|
||||||
name: Some(name),
|
name: Some(name),
|
||||||
distance,
|
distance,
|
||||||
disable_in_map: true,
|
disable_in_map: true,
|
||||||
|
hide_size: true,
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
PbrBundle {
|
PbrBundle {
|
||||||
|
|
Loading…
Reference in a new issue