pub struct RecentDamageSource {
pub damage_type: &'static DamageType,
causing_entity: Option<ResolvedSourceEntity>,
direct_entity: Option<ResolvedSourceEntity>,
source_position: Option<DVec3>,
}Expand description
A read of recent history, retaining the original entities that still exist.
Unlike vanilla, a removed or unmanaged victim’s history does not keep source entities alive. Generation accessors distinguish a released entity from an originally absent one. Each entity resolves independently, so a released projectile does not hide its still-live shooter.
Fields§
§damage_type: &'static DamageTypeThe original damage type, even when its entities have been released.
causing_entity: Option<ResolvedSourceEntity>§direct_entity: Option<ResolvedSourceEntity>§source_position: Option<DVec3>Implementations§
Source§impl RecentDamageSource
impl RecentDamageSource
Sourcepub fn causing_entity(&self) -> Option<&SharedEntity>
pub fn causing_entity(&self) -> Option<&SharedEntity>
The original causing entity, if it was still alive when history was read.
Sourcepub fn direct_entity(&self) -> Option<&SharedEntity>
pub fn direct_entity(&self) -> Option<&SharedEntity>
The original direct entity, if it was still alive when history was read.
Sourcepub fn causing_entity_generation(&self) -> Option<EntityGeneration>
pub fn causing_entity_generation(&self) -> Option<EntityGeneration>
Original allocation identity; None means the source never had a cause.
Sourcepub fn direct_entity_generation(&self) -> Option<EntityGeneration>
pub fn direct_entity_generation(&self) -> Option<EntityGeneration>
Original allocation identity; None means the source never had a direct entity.
Sourcepub fn is_direct(&self) -> bool
pub fn is_direct(&self) -> bool
Original directness, including after either entity has been released.
Sourcepub fn is(&self, tag: &Identifier) -> bool
pub fn is(&self, tag: &Identifier) -> bool
Tests the original damage type’s tag membership.
Sourcepub fn source_position(&self) -> Option<DVec3>
pub fn source_position(&self) -> Option<DVec3>
Explicit position, or the retained direct entity’s current position.
Sourcepub const fn source_position_raw(&self) -> Option<DVec3>
pub const fn source_position_raw(&self) -> Option<DVec3>
The original explicit source position, without substituting an entity position.
Auto Trait Implementations§
impl !RefUnwindSafe for RecentDamageSource
impl !UnwindSafe for RecentDamageSource
impl Freeze for RecentDamageSource
impl Send for RecentDamageSource
impl Sync for RecentDamageSource
impl Unpin for RecentDamageSource
impl UnsafeUnpin for RecentDamageSource
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 moreArc<SyncMutex<>>