Recursively update joint relays on removing entities from containers (#6244)

* Recursively update joint relays on removing entities from containers

* release notes
This commit is contained in:
MilenVolf
2025-10-08 07:50:07 +03:00
committed by GitHub
parent f75ce13f00
commit 9c41f19eaf
3 changed files with 5 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ END TEMPLATE-->
* Fixed yaml hot reloading throwing invalid path exceptions.
* The `EntityManager.CreateEntityUninitialized` overload that uses MapCoordinates now actually attaches entities to a grid if one is present at those coordinates, as was stated in it's documentation.
* Fixed physics joint relays not being properly updated when an entity is removed from a container.
### Other

View File

@@ -219,6 +219,9 @@ public abstract partial class SharedContainerSystem
internal void RecursivelyUpdateJoints(Entity<TransformComponent> entity)
{
if (_timing.ApplyingState)
return;
if (JointQuery.TryGetComponent(entity, out var jointComp))
{
// TODO: This is going to be going up while joints going down, although these aren't too common

View File

@@ -95,10 +95,7 @@ public abstract partial class SharedContainerSystem
_lookup.FindAndAddToEntityTree(toRemove, xform: xform);
}
if (TryComp<JointComponent>(toRemove, out var jointComp))
{
_joint.RefreshRelay(toRemove, jointComp);
}
RecursivelyUpdateJoints((toRemove, xform));
// Raise container events (after re-parenting and internal remove).
RaiseLocalEvent(container.Owner, new EntRemovedFromContainerMessage(toRemove, container), true);