From 7719bb08b38f9ec17d0db597d736df0bbdf85788 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 17 May 2021 09:50:03 -0500 Subject: [PATCH] Add component to not log something when it appears. --- src/visibility.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/visibility.rs b/src/visibility.rs index 5ee4236..236ac6e 100644 --- a/src/visibility.rs +++ b/src/visibility.rs @@ -15,6 +15,10 @@ use crate::{ #[reflect(Component)] pub struct BlocksVisibility; +#[derive(Clone, Copy, Debug, Default, Reflect)] +#[reflect(Component)] +pub struct DontLogWhenVisible; + #[derive(Clone, Debug, Default, Deref, DerefMut, Reflect)] #[reflect(Component)] pub struct RevealedTiles(pub Vec); @@ -226,6 +230,7 @@ fn log_visible( map: Query<&Map>, names: Query<&Name>, players: Query<&Player>, + dont_log_when_visible: Query<&DontLogWhenVisible>, ) { for timer in recently_lost.values_mut() { timer.tick(time.delta()); @@ -248,7 +253,9 @@ fn log_visible( } if let Ok(name) = names.get(*entity) { if players.get(*entity).is_err() { - if !seen.contains(&*entity) { + if !seen.contains(&*entity) + && dont_log_when_visible.get(*entity).is_err() + { let name = name.to_string(); let forward = transform.local_x(); let yaw = Angle::Radians(forward.y.atan2(forward.x));