Enum Body

Source
#[repr(u32)]
pub enum Body {
Show 19 variants Humanoid(Body), QuadrupedSmall(Body), QuadrupedMedium(Body), BirdMedium(Body), FishMedium(Body), Dragon(Body), BirdLarge(Body), FishSmall(Body), BipedLarge(Body), BipedSmall(Body), Object(Body), Golem(Body), Theropod(Body), QuadrupedLow(Body), Ship(Body), Arthropod(Body), Item(Body), Crustacean(Body), Plugin(Body),
}

Variants§

§

Humanoid(Body)

§

QuadrupedSmall(Body)

§

QuadrupedMedium(Body)

§

BirdMedium(Body)

§

FishMedium(Body)

§

Dragon(Body)

§

BirdLarge(Body)

§

FishSmall(Body)

§

BipedLarge(Body)

§

BipedSmall(Body)

§

Object(Body)

§

Golem(Body)

§

Theropod(Body)

§

QuadrupedLow(Body)

§

Ship(Body)

§

Arthropod(Body)

§

Item(Body)

§

Crustacean(Body)

§

Plugin(Body)

Implementations§

Source§

impl Body

Source

pub const NUM_KINDS: usize = 19usize

Number of “kinds” this enum has

Source

fn all_variants() -> Vec<Body>

Source

pub fn iter() -> impl Iterator<Item = Self>

Iterates over all possible variants, including nested ones.

Source§

impl Body

Source

pub fn is_same_species_as(&self, other: &Body) -> bool

Source

pub fn heads(&self) -> Option<usize>

How many heads this body has in the Heads component if any.

Source

pub fn is_humanoid(&self) -> bool

Source

pub fn is_campfire(&self) -> bool

Source

pub fn is_portal(&self) -> bool

Source

pub fn bleeds(&self) -> bool

Source

pub fn stride_length(&self) -> f32

The length of the stride of the body, in metres (not accounting for different legs)

Source

pub fn scale(&self) -> Scale

Source

pub fn density(&self) -> Density

Average density of the body

Source

pub fn mass(&self) -> Mass

Source

pub fn dimensions(&self) -> Vec3<f32>

The width (shoulder to shoulder), length (nose to tail) and height respectively (in metres)

Source

pub fn max_radius(&self) -> f32

Source

pub fn front_radius(&self) -> f32

Source

pub fn min_radius(&self) -> f32

Source

pub fn sausage(&self) -> (Vec2<f32>, Vec2<f32>, f32)

Base of our Capsule Prism used for collisions. Returns line segment and radius. See this wiki page.

Source

pub fn collider(&self) -> Collider

Body collider

Source

pub fn spacing_radius(&self) -> f32

How far away other entities should try to be. Will be added upon the other entity’s spacing_radius. So an entity with 2.0 and an entity with 3.0 will lead to that both entities will try to keep 5.0 units away from each other.

Source

pub fn height(&self) -> f32

Height from the bottom to the top (in metres)

Source

pub fn base_energy(&self) -> u16

Source

pub fn has_death_protection(&self) -> bool

If this body will retain 1 hp when it would die, and consume death protection, and entering a downed state.

Source

pub fn base_health(&self) -> u16

Source

pub fn flying_height(&self) -> f32

Source

pub fn immune_to(&self, buff: BuffKind) -> bool

Source

pub fn combat_multiplier(&self) -> f32

Returns a multiplier representing increased difficulty not accounted for due to AI or not using an actual weapon

Source

pub fn base_poise(&self) -> u16

Source

pub fn eye_height(&self, scale: f32) -> f32

Returns the eye height for this creature.

Source

pub fn default_light_offset(&self) -> Vec3<f32>

Source

pub fn can_strafe(&self) -> bool

Source

pub fn mount_offset(&self) -> Vec3<f32>

Component of the mounting offset specific to the mount

Source

pub fn rider_offset(&self) -> Vec3<f32>

Component of the mounting offset specific to the rider

Source

pub fn tether_offset_leader(&self) -> Vec3<f32>

Source

pub fn tether_offset_follower(&self) -> Vec3<f32>

Source

pub fn localize_npc(&self) -> Content

Should be only used with npc-tell_monster.

If you want to use for displaying names in HUD, add new strings. If you want to use for anything else, add new strings.

Source

pub fn humanoid_gender(&self) -> Option<Gender>

Read comment on Gender for more

Source

pub fn default_gender(&self) -> Gender

Return gender information for this entity.

It’s an imprecise approximation, because body type != gender, and we need more advanced scheme here, but that’s all we have atm.

At the moment used for two things:

  • Grammatical gender indicator regarding players for proper grammatical agreement in sentences for languages that require it. At the moment can be used only for chat messages, but should be extended further.
  • Semantic indicator to pick proper name variant for NPC. For example, Hunter vs Huntress or Lion vs Lioness.
Source

pub fn gender_attr(&self) -> &'static str

For use with NPC name localization.

Not a grammatical gender, keep that in mind.

Source§

impl Body

Source

pub fn aerodynamic_forces( &self, rel_flow: &Vel, fluid_density: f32, wings: Option<&Wings>, scale: f32, ) -> Vec3<f32>

Source

pub fn drag_coefficient_liquid(&self, fluid_density: f32, scale: f32) -> f32

Physically incorrect (but relatively dt-independent) way to calculate drag coefficients for liquids.

Source

fn parasite_drag(&self, scale: f32) -> f32

Parasite drag is the sum of pressure drag and skin friction. Skin friction is the drag arising from the shear forces between a fluid and a surface, while pressure drag is due to flow separation. Both are viscous effects.

Source§

impl Body

Source

pub fn base_accel(&self) -> f32

Source

pub fn air_accel(&self) -> f32

Source

pub fn max_speed_approx(&self) -> f32

Attempt to determine the maximum speed of the character when moving on the ground

Source

pub fn base_ori_rate(&self) -> f32

The turn rate in 180°/s (or (rotations per second)/2)

Source

pub fn swim_thrust(&self) -> Option<f32>

Returns thrust force if the body type can swim, otherwise None

Source

pub fn fly_thrust(&self) -> Option<f32>

Returns thrust force if the body type can fly, otherwise None

Source

pub fn vectored_propulsion(&self) -> bool

Returns whether the body uses vectored propulsion

Source

pub fn jump_impulse(&self) -> Option<f32>

Returns jump impulse if the body type can jump, otherwise None

Source

pub fn can_climb(&self) -> bool

Source

pub fn reverse_move_factor(&self) -> f32

Returns how well a body can move backwards while strafing (0.0 = not at all, 1.0 = same as forward)

Source

pub fn projectile_offsets(&self, ori: Vec3<f32>, scale: f32) -> Vec3<f32>

Returns the position where a projectile should be fired relative to this body

Trait Implementations§

Source§

impl Clone for Body

Source§

fn clone(&self) -> Body

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Component for Body

Source§

type Storage = DerefFlaggedStorage<Body, VecStorage<Body>>

Associated storage type for this component.
Source§

impl Debug for Body

Source§

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

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

impl Default for Body

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Body

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Body

Source§

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

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

impl<'a> From<&'a Body> for Psyche

Source§

fn from(body: &'a Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Body> for Body

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl Hash for Body

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<BodyMeta, SpeciesMeta> Index<&Body> for AllBodies<BodyMeta, SpeciesMeta>

Can only retrieve body metadata by direct index.

Source§

type Output = BodyMeta

The returned type after indexing.
Source§

fn index(&self, index: &Body) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Ord for Body

Source§

fn cmp(&self, other: &Body) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Body

Source§

fn eq(&self, other: &Body) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Body

Source§

fn partial_cmp(&self, other: &Body) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Body

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Body

Source§

impl Eq for Body

Source§

impl StructuralPartialEq for Body

Auto Trait Implementations§

§

impl Freeze for Body

§

impl RefUnwindSafe for Body

§

impl Send for Body

§

impl Sync for Body

§

impl Unpin for Body

§

impl UnwindSafe for Body

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
§

impl<T> CallHasher for T
where T: Hash,

§

fn get_hash<H>(&self, hasher: H) -> u64
where H: Hasher,

Source§

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

Source§

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

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

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<C, M> ConvertSaveload<M> for C

§

type Data = C

(De)Serializable data representation for data type
§

type Error = Infallible

Error may occur during serialization or deserialization of component
§

fn convert_into<F>( &self, _: F, ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
where F: FnMut(Entity) -> Option<M>,

Convert this data type into serializable form (Data) using entity to marker mapping function
§

fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F, ) -> Result<C, <C as ConvertSaveload<M>>::Error>
where F: FnMut(M) -> Option<Entity>,

Convert this data from a deserializable form (Data) using entity to marker mapping function
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Context> SubContext<Context> for Context

Source§

fn sub_context(self) -> Context

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryDefault for T
where T: Default,

§

fn try_default() -> Result<T, String>

Tries to create the default.
§

fn unwrap_default() -> Self

Calls try_default and panics on an error case.
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Event for T
where T: Send + Sync + 'static,

§

impl<T> Resource for T
where T: Any + Send + Sync,

§

impl<T> Storable for T
where T: Send + Sync + 'static,