don't update HUD if it's turned off
This commit is contained in:
parent
1140e1eaca
commit
f79b5deb04
10
src/hud.rs
10
src/hud.rs
|
@ -612,7 +612,7 @@ fn update_dashboard(
|
||||||
mut q_flashlight: Query<&mut Visibility, With<DashboardFlashlight>>,
|
mut q_flashlight: Query<&mut Visibility, With<DashboardFlashlight>>,
|
||||||
settings: Res<var::Settings>,
|
settings: Res<var::Settings>,
|
||||||
) {
|
) {
|
||||||
if !timer.0.just_finished() {
|
if !settings.hud_active || !timer.0.just_finished() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for mut vis in &mut q_flashlight {
|
for mut vis in &mut q_flashlight {
|
||||||
|
@ -622,6 +622,7 @@ fn update_dashboard(
|
||||||
|
|
||||||
fn update_speedometer(
|
fn update_speedometer(
|
||||||
timer: ResMut<FPSUpdateTimer>,
|
timer: ResMut<FPSUpdateTimer>,
|
||||||
|
settings: Res<var::Settings>,
|
||||||
q_camera: Query<&LinearVelocity, With<actor::PlayerCamera>>,
|
q_camera: Query<&LinearVelocity, With<actor::PlayerCamera>>,
|
||||||
q_player: Query<&actor::ExperiencesGForce, With<actor::Player>>,
|
q_player: Query<&actor::ExperiencesGForce, With<actor::Player>>,
|
||||||
q_target: Query<&LinearVelocity, With<IsTargeted>>,
|
q_target: Query<&LinearVelocity, With<IsTargeted>>,
|
||||||
|
@ -629,7 +630,7 @@ fn update_speedometer(
|
||||||
mut q_speedometer2: Query<&mut Style, (With<Speedometer2>, Without<Speedometer>)>,
|
mut q_speedometer2: Query<&mut Style, (With<Speedometer2>, Without<Speedometer>)>,
|
||||||
mut q_node_speed: Query<&mut Text, With<NodeSpeedometerText>>,
|
mut q_node_speed: Query<&mut Text, With<NodeSpeedometerText>>,
|
||||||
) {
|
) {
|
||||||
if !timer.0.just_finished() {
|
if !settings.hud_active || !timer.0.just_finished() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Ok(cam_v) = q_camera.get_single() {
|
if let Ok(cam_v) = q_camera.get_single() {
|
||||||
|
@ -688,7 +689,7 @@ fn update_gauges(
|
||||||
mut q_gauges: Query<(&mut Style, &mut BackgroundColor, &Gauge, &GaugeLength)>,
|
mut q_gauges: Query<(&mut Style, &mut BackgroundColor, &Gauge, &GaugeLength)>,
|
||||||
settings: Res<var::Settings>,
|
settings: Res<var::Settings>,
|
||||||
) {
|
) {
|
||||||
if !timer.0.just_finished() {
|
if !settings.hud_active || !timer.0.just_finished() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let player = q_player.get_single();
|
let player = q_player.get_single();
|
||||||
|
@ -727,11 +728,10 @@ fn update_hud(
|
||||||
settings: Res<var::Settings>,
|
settings: Res<var::Settings>,
|
||||||
q_target: Query<(&IsClickable, Option<&Position>, Option<&LinearVelocity>), With<IsTargeted>>,
|
q_target: Query<(&IsClickable, Option<&Position>, Option<&LinearVelocity>), With<IsTargeted>>,
|
||||||
) {
|
) {
|
||||||
// TODO only when hud is actually on
|
|
||||||
if timer.0.tick(time.delta()).just_finished() || log.needs_rerendering {
|
if timer.0.tick(time.delta()).just_finished() || log.needs_rerendering {
|
||||||
let q_camera_result = q_camera.get_single();
|
let q_camera_result = q_camera.get_single();
|
||||||
let mut freshest_line: f64 = 0.0;
|
let mut freshest_line: f64 = 0.0;
|
||||||
if q_camera_result.is_ok() {
|
if settings.hud_active && q_camera_result.is_ok() {
|
||||||
let (pos, _) = q_camera_result.unwrap();
|
let (pos, _) = q_camera_result.unwrap();
|
||||||
for mut text in &mut q_node_hud {
|
for mut text in &mut q_node_hud {
|
||||||
text.sections[0].value = format!("2524-03-12 03:02");
|
text.sections[0].value = format!("2524-03-12 03:02");
|
||||||
|
|
Loading…
Reference in a new issue