Add component to not log something when it appears.

This commit is contained in:
Nolan Darilek 2021-05-17 09:50:03 -05:00
parent b2138d3e4c
commit 7719bb08b3

View File

@ -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<bool>);
@ -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));