pub struct EntityContainer {
pub entities: FxHashMap<i32, Entity>,
/* private fields */
}Expand description
Container managing all active entities.
Fields§
§entities: FxHashMap<i32, Entity>Implementations§
Source§impl EntityContainer
impl EntityContainer
pub fn new() -> Self
Sourcepub fn handle_packet_entities(
&mut self,
msg: CsvcMsgPacketEntities,
class_info: &ClassInfo,
serializers: &SerializerContainer,
string_tables: &StringTableContainer,
field_decode_ctx: &mut FieldDecodeContext,
fp_buf: &mut Vec<FieldPath>,
) -> Result<()>
pub fn handle_packet_entities( &mut self, msg: CsvcMsgPacketEntities, class_info: &ClassInfo, serializers: &SerializerContainer, string_tables: &StringTableContainer, field_decode_ctx: &mut FieldDecodeContext, fp_buf: &mut Vec<FieldPath>, ) -> Result<()>
Handle a CSVCMsg_PacketEntities message.
Sourcepub fn handle_packet_entities_filtered(
&mut self,
msg: CsvcMsgPacketEntities,
class_info: &ClassInfo,
serializers: &SerializerContainer,
string_tables: &StringTableContainer,
field_decode_ctx: &mut FieldDecodeContext,
class_filter: &HashSet<&str>,
fp_buf: &mut Vec<FieldPath>,
) -> Result<()>
pub fn handle_packet_entities_filtered( &mut self, msg: CsvcMsgPacketEntities, class_info: &ClassInfo, serializers: &SerializerContainer, string_tables: &StringTableContainer, field_decode_ctx: &mut FieldDecodeContext, class_filter: &HashSet<&str>, fp_buf: &mut Vec<FieldPath>, ) -> Result<()>
Handle a CSVCMsg_PacketEntities message, only tracking specified entity classes. Entities not in the filter are parsed (to advance the bit reader) but not stored.
Sourcepub fn get_by_handle(&self, handle: u32) -> Option<&Entity>
pub fn get_by_handle(&self, handle: u32) -> Option<&Entity>
Resolve a networked CHandle to the entity it refers to, if still active.
Applies ENTITY_HANDLE_INDEX_MASK to recover the entity index, then
looks it up. This is the canonical way to follow a handle field such as
m_hPawn; decoding the mask by hand risks resolving the wrong entity.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&i32, &Entity)>
pub fn iter(&self) -> impl Iterator<Item = (&i32, &Entity)>
Iterate over all active entities as (index, entity) pairs.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Default for EntityContainer
impl Default for EntityContainer
Source§fn default() -> EntityContainer
fn default() -> EntityContainer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EntityContainer
impl RefUnwindSafe for EntityContainer
impl Send for EntityContainer
impl Sync for EntityContainer
impl Unpin for EntityContainer
impl UnsafeUnpin for EntityContainer
impl UnwindSafe for EntityContainer
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