Skip to main content

EntityPriorityMut

Struct EntityPriorityMut 

Source
pub struct EntityPriorityMut<'a, E: Copy + Eq + Hash> { /* private fields */ }
Expand description

Mutable handle for reading and setting an entity’s priority in one priority layer. Lazy-creates a state entry on first write so set-and-forget works even before the entity enters scope for that user.

Returned by global_entity_priority_mut / user_entity_priority_mut on the server, entity_priority_mut on the client, and their Bevy-adapter passthroughs.

Implementations§

Source§

impl<'a, E: Copy + Eq + Hash> EntityPriorityMut<'a, E>

Source

pub fn entity(&self) -> E

Returns the entity this handle refers to.

Source

pub fn accumulated(&self) -> f32

Current accumulated priority value. Higher = more urgent. Returns 0.0 if no entry yet.

Source

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

Current per-tick gain override. None means the default (1.0) applies.

Source

pub fn is_overridden(&self) -> bool

Returns true if a per-tick gain override is currently active.

Source

pub fn set_gain(&mut self, gain: f32) -> &mut Self

Set a persistent per-tick gain override for this layer. Stays in effect until reset() or another set_gain() call. Lazy-creates the entry.

Source

pub fn boost_once(&mut self, amount: f32) -> &mut Self

One-shot additive boost to the accumulator. Does not change gain. Multiple calls in one tick sum additively. Lazy-creates the entry. Persists across ticks until the entity is sent (then reset to 0).

Source

pub fn reset(&mut self) -> &mut Self

Clear the gain override — return to default (1.0). Does NOT clear the accumulator value itself, and does NOT remove the entry.

Auto Trait Implementations§

§

impl<'a, E> Freeze for EntityPriorityMut<'a, E>
where E: Freeze,

§

impl<'a, E> RefUnwindSafe for EntityPriorityMut<'a, E>
where E: RefUnwindSafe,

§

impl<'a, E> Send for EntityPriorityMut<'a, E>
where E: Send,

§

impl<'a, E> Sync for EntityPriorityMut<'a, E>
where E: Sync,

§

impl<'a, E> Unpin for EntityPriorityMut<'a, E>
where E: Unpin,

§

impl<'a, E> UnsafeUnpin for EntityPriorityMut<'a, E>
where E: UnsafeUnpin,

§

impl<'a, E> !UnwindSafe for EntityPriorityMut<'a, E>

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> 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, 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.
Source§

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

Source§

fn vzip(self) -> V