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