Skip to main content

CharacterTree

Struct CharacterTree 

Source
pub struct CharacterTree { /* private fields */ }
Expand description

The characters’ spatial tree. See the module documentation.

Implementations§

Source§

impl CharacterTree

Source

pub fn insert(&mut self, who: Who, position: [f32; 3], radius: f32) -> i32

A slot for who, placed at once. Returns the slot.

Original: FUN_140018e00.

Source

pub fn slot_of(&self, who: Who) -> Option<i32>

Out of its node; the slot goes on the free list. The slot holding who, if it is in the tree.

Original: FUN_140018f70.

Source

pub fn remove(&mut self, slot: i32)

Remove a character’s slot.

Source

pub fn place(&mut self, slot: i32, position: [f32; 3], radius: f32)

Where the character stands now; a new node puts it at the end of that node’s list.

Original: FUN_140019070.

Source

pub fn set_direction(&mut self, slot: i32, direction: [f32; 3])

The walking direction the follow check reads (the component’s).

Source

pub fn follows(&self, slot: i32) -> bool

MoveTo’s notify: the nearest other character within 0.5, if it came after this one (the original compares the components’ addresses; the port, the order they were put in the tree) and walks the same way (the directions’ dot product above 0), is followed.

Original: FUN_1400cde40, FUN_140097730.

Source

pub fn visit( &self, point: [f32; 3], radius: f32, each: impl FnMut(Who, [f32; 3]), )

The search: every slot of the nodes whose loose box meets point ± radius, in the original’s order, with where it stands.

Original: FUN_1400197e0, FUN_140019290.

Source

pub fn within( &self, point: [f32; 3], radius: f32, filter: impl Fn(Who) -> bool, ) -> Vec<Who>

The characters standing within radius of point (squared distance below radius²), in the tree’s order.

Original: FUN_140097e60.

Source

pub fn nearest( &self, point: [f32; 3], radius: f32, filter: impl Fn(Who) -> bool, ) -> Option<Who>

The nearest character within radius of point that filter takes; the first of equals in the tree’s order.

Original: FUN_140097730.

Trait Implementations§

Source§

impl Clone for CharacterTree

Source§

fn clone(&self) -> CharacterTree

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CharacterTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CharacterTree

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.