Add BlocksVisibility to visibility-blocking colliders.

This commit is contained in:
Nolan Darilek 2021-06-04 07:58:38 -05:00
parent f01b0856f4
commit c85fdb67c9

View File

@ -11,6 +11,7 @@ use crate::{
core::{Area, Coordinates, Player, PointLike}, core::{Area, Coordinates, Player, PointLike},
exploration::{ExplorationType, Mappable}, exploration::{ExplorationType, Mappable},
log::Log, log::Log,
visibility::BlocksVisibility,
}; };
impl From<mapgen::geometry::Point> for Coordinates { impl From<mapgen::geometry::Point> for Coordinates {
@ -225,10 +226,14 @@ fn add_map_colliders(mut commands: Commands, maps: Query<(Entity, &Map), Added<M
handle: rigid_body_entity.handle(), handle: rigid_body_entity.handle(),
pos_wrt_parent: Vec2::new(x as f32 + 0.5, y as f32 + 0.5).into(), pos_wrt_parent: Vec2::new(x as f32 + 0.5, y as f32 + 0.5).into(),
}; };
commands let id = commands
.spawn() .spawn()
.insert_bundle(collider) .insert_bundle(collider)
.insert(collider_parent); .insert(collider_parent)
.id();
if tile.blocks_visibility() {
commands.entity(id).insert(BlocksVisibility);
}
} }
} }
} }