Remove some unnecessary EntityQuery<T> and warns (#4167)

This commit is contained in:
metalgearsloth
2023-07-02 01:12:45 +10:00
committed by GitHub
parent d4902a9714
commit e763d59617
19 changed files with 382 additions and 369 deletions
+2 -2
View File
@@ -115,7 +115,7 @@ namespace Robust.Shared.Containers
// Remove the entity and any children from broadphases.
// This is done before changing can collide to avoid unecceary updates.
// TODO maybe combine with RecursivelyUpdatePhysics to avoid fetching components and iterating parents twice?
lookupSys.RemoveFromEntityTree(toinsert, transform, transformQuery);
lookupSys.RemoveFromEntityTree(toinsert, transform);
DebugTools.Assert(transform.Broadphase == null || !transform.Broadphase.Value.IsValid());
// Avoid unnecessary broadphase updates while unanchoring, changing physics collision, and re-parenting.
@@ -313,7 +313,7 @@ namespace Robust.Shared.Containers
if (xform.ParentUid == oldParent // move event should already have handled it
&& xform.Broadphase == null) // broadphase explicitly invalid?
{
entMan.EntitySysManager.GetEntitySystem<EntityLookupSystem>().FindAndAddToEntityTree(toRemove, xform);
entMan.EntitySysManager.GetEntitySystem<EntityLookupSystem>().FindAndAddToEntityTree(toRemove, xform: xform);
}
if (entMan.TryGetComponent<JointComponent>(toRemove, out var jointComp))
@@ -45,7 +45,7 @@ public abstract partial class SharedContainerSystem : EntitySystem
// CBF updating all maps. meta-data flags now get saved, eventually we should be able to just initialize
// entities in containers without having to "re-insert" them.
meta.Flags |= MetaDataFlags.InContainer;
_lookup.RemoveFromEntityTree(ent, xform, xformQuery);
_lookup.RemoveFromEntityTree(ent, xform);
((BaseContainer)cont).RecursivelyUpdatePhysics(ent, xform, physics, _physics, physicsQuery, xformQuery);
// assert children have correct properties