pub struct DamageHistory {
records: SyncMutex<FxHashMap<EntityGeneration, DamageRecord>>,
}Expand description
Server-owned equivalent of vanilla’s per-entity lastDamageSource fields.
Entities and worlds link back weakly. Records retain the victim’s clock, which has no world back-reference, to avoid cycles through the victim or world. Only gameplay-owned victims retain strong sources. Removal downgrades their own record; an ownership sweep also covers disconnects and manager teardown.
Fields§
§records: SyncMutex<FxHashMap<EntityGeneration, DamageRecord>>Implementations§
Source§impl DamageHistory
impl DamageHistory
pub(crate) fn record( self: &Arc<Self>, victim: &EntityBase, source: &DamageSource, clock: &Arc<GameTime>, )
pub(crate) fn last_damage_source( &self, victim: EntityGeneration, ) -> Option<RecentDamageSource>
pub(crate) fn clear_victim(&self, victim: EntityGeneration)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DamageHistory
impl !RefUnwindSafe for DamageHistory
impl !UnwindSafe for DamageHistory
impl Send for DamageHistory
impl Sync for DamageHistory
impl Unpin for DamageHistory
impl UnsafeUnpin for DamageHistory
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
Mutably borrows from an owned value. Read more
§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> ⓘ
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 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> ⓘ
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 moreWraps this value in an
Arc<SyncMutex<>>