diff --git a/src/core.rs b/src/core.rs index 36d5edd..3abd675 100644 --- a/src/core.rs +++ b/src/core.rs @@ -21,6 +21,14 @@ use once_cell::sync::Lazy; use rand::prelude::*; use serde::{Deserialize, Serialize}; +#[derive(Component, Clone, Debug, Default, Reflect)] +#[reflect(Component)] +pub struct Obstacle; + +#[derive(Default, Component, Clone, Debug, Reflect)] +#[reflect(Component)] +pub struct Zone; + fn relative_desc(rot: &Rot2) -> String { let mode = RELATIVE_DIRECTION_MODE.read().unwrap(); match rot.as_radians() { diff --git a/src/map.rs b/src/map.rs index ab96906..2622a92 100644 --- a/src/map.rs +++ b/src/map.rs @@ -7,7 +7,11 @@ use here_be_dragons::{geometry::Rect as MRect, MapFilter, Tile}; use maze_generator::{prelude::*, recursive_backtracking::RbGenerator}; use rand::prelude::StdRng; -use crate::{core::PointLike, exploration::Mappable, visibility::Visible}; +use crate::{ + core::{Obstacle, PointLike, Zone}, + exploration::Mappable, + visibility::Visible, +}; #[derive(Component, Clone, Default, Deref, DerefMut)] pub struct Map(pub MapgenMap); @@ -18,10 +22,6 @@ impl From> for Map { } } -#[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component)] -pub struct MapObstruction; - #[derive(Component, Clone, Debug, Default, Reflect)] #[reflect(Component)] pub struct Portal; @@ -52,10 +52,6 @@ impl Default for SpawnPortals { } } -#[derive(Default, Component, Clone, Debug, Reflect)] -#[reflect(Component)] -pub struct Zone; - pub trait ITileType { fn blocks_motion(&self) -> bool; fn blocks_visibility(&self) -> bool; @@ -91,7 +87,7 @@ pub struct TileBundle { pub transform: Transform, pub collider: Collider, pub rigid_body: RigidBody, - pub map_obstruction: MapObstruction, + pub map_obstruction: Obstacle, } impl Default for TileBundle { diff --git a/src/navigation.rs b/src/navigation.rs index 700d0ba..97d88c1 100644 --- a/src/navigation.rs +++ b/src/navigation.rs @@ -8,10 +8,9 @@ use bevy_tts::Tts; use leafwing_input_manager::prelude::*; use crate::{ - core::{CardinalDirection, GlobalTransformExt, Player, TransformExt}, + core::{CardinalDirection, GlobalTransformExt, Player, TransformExt, Zone}, error::error_handler, log::Log, - map::Zone, utils::target_and_other, }; @@ -154,6 +153,7 @@ fn tick_snap_timers(time: Res