pub struct NavigationSystem { /* private fields */ }Expand description
Навигация ботов: сетка проходимости + граф с A* (порт src/server/modules/bots/NavigationSystem.js).
Implementations§
Sourcepub fn generate(grid: &[Vec<i32>], physics_static: &[i32], step: f32) -> Self
pub fn generate(grid: &[Vec<i32>], physics_static: &[i32], step: f32) -> Self
Строит сетку проходимости и навигационный граф из данных карты (сетка тайлов + масштабированный step + список статичных тайлов).
Sourcepub fn generate_layered(levels: &MapLevels, step: f32) -> Self
pub fn generate_layered(levels: &MapLevels, step: f32) -> Self
Граф со слоями: узлы каждого уровня + рёбра переходов (рампы — двусторонние, обрывы — только сверху вниз).
pub fn has_nodes(&self) -> bool
pub fn node_count(&self) -> usize
pub fn edge_count(&self) -> usize
pub fn grid_step(&self) -> f32
Sourcepub fn random_node(&self, rng: &mut Rng) -> Option<[f32; 2]>
pub fn random_node(&self, rng: &mut Rng) -> Option<[f32; 2]>
Случайный узел графа (цель патрулирования).
Sourcepub fn is_walkable(&self, x: f32, y: f32) -> bool
pub fn is_walkable(&self, x: f32, y: f32) -> bool
Проходима ли точка в мировых координатах (уровень 0).
Sourcepub fn is_walkable_on(&self, level: u8, x: f32, y: f32) -> bool
pub fn is_walkable_on(&self, level: u8, x: f32, y: f32) -> bool
Проходима ли точка на конкретном уровне.
Sourcepub fn has_obstacle_between(&self, start: [f32; 2], end: [f32; 2]) -> bool
pub fn has_obstacle_between(&self, start: [f32; 2], end: [f32; 2]) -> bool
Быстрая линия видимости по сетке (алгоритм Брезенхэма): true — на пути есть препятствие.
Sourcepub fn has_obstacle_between_on(
&self,
level: u8,
start: [f32; 2],
end: [f32; 2],
) -> bool
pub fn has_obstacle_between_on( &self, level: u8, start: [f32; 2], end: [f32; 2], ) -> bool
Линия видимости по сетке конкретного уровня.
Sourcepub fn find_path(&self, start: [f32; 2], end: [f32; 2]) -> Option<Vec<[f32; 2]>>
pub fn find_path(&self, start: [f32; 2], end: [f32; 2]) -> Option<Vec<[f32; 2]>>
Путь из точки в точку (мировые координаты) или None.
Sourcepub fn find_path_on(
&self,
start: PathPoint,
end: PathPoint,
) -> Option<Vec<PathPoint>>
pub fn find_path_on( &self, start: PathPoint, end: PathPoint, ) -> Option<Vec<PathPoint>>
Путь между точками с уровнями (мировые координаты) или None.
Sourcepub fn random_point(&self, rng: &mut Rng) -> Option<PathPoint>
pub fn random_point(&self, rng: &mut Rng) -> Option<PathPoint>
Случайный узел графа вместе с его уровнем (цель патрулирования).
Sourcepub fn node_level(&self, index: usize) -> u8
pub fn node_level(&self, index: usize) -> u8
Уровень узла: у одноуровневого графа node_levels пуст — все узлы
на земле.
Sourcepub fn level_count(&self) -> usize
pub fn level_count(&self) -> usize
Число уровней графа, включая землю.
Sourcepub fn nodes_by_level(&self) -> Vec<usize>
pub fn nodes_by_level(&self) -> Vec<usize>
Число узлов по уровням (отладочный дамп).
pub fn ramp_edge_count(&self) -> usize
pub fn ledge_edge_count(&self) -> usize
Trait Implementations§
Source§fn clone(&self) -> NavigationSystem
fn clone(&self) -> NavigationSystem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§fn default() -> NavigationSystem
fn default() -> NavigationSystem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.