Include area AABB in component.

This commit is contained in:
Nolan Darilek 2022-01-10 13:55:42 -06:00
parent 356caa09e0
commit cb02e39870

View File

@ -22,9 +22,9 @@ impl From<mapgen::geometry::Point> for Coordinates {
}
}
#[derive(Component, Clone, Debug, Default, Reflect)]
#[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect)]
#[reflect(Component)]
pub struct Area;
pub struct Area(AABB);
#[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect)]
#[reflect(Component)]
@ -354,8 +354,7 @@ fn spawn_colliders(
position,
..Default::default()
})
.insert(aabb)
.insert(Area)
.insert(Area(aabb))
.id();
commands.entity(map_entity).push_children(&[id]);
}
@ -445,7 +444,7 @@ fn spawn_portal_colliders(
fn area_description(
mut events: EventReader<IntersectionEvent>,
areas: Query<(&AABB, Option<&Name>), With<Area>>,
areas: Query<(&Area, Option<&Name>)>,
players: Query<&Player>,
config: Res<MapConfig>,
mut log: Query<&mut Log>,