mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Ensure DestroyContacts is called on fixture deletion (#3658)
This commit is contained in:
@@ -560,7 +560,7 @@ namespace Robust.Shared.GameObjects
|
||||
var physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
if (oldBroadphase != null && oldBroadphase != newBroadphase)
|
||||
{
|
||||
RemoveFromEntityTree(oldBroadphase.Owner, oldBroadphase, ref oldPhysMap, uid, xform, xformQuery, physicsQuery, fixturesQuery);
|
||||
RemoveFromEntityTree(oldBroadphase.Owner, oldBroadphase, ref oldPhysMap, uid, xform, xformQuery, fixturesQuery);
|
||||
}
|
||||
|
||||
if (newBroadphase == null)
|
||||
@@ -749,7 +749,7 @@ namespace Robust.Shared.GameObjects
|
||||
$"Broadphase's map is missing a physics map comp. Broadphase: {ToPrettyString(broadphase.Owner)}");
|
||||
}
|
||||
|
||||
RemoveFromEntityTree(broadphase.Owner, broadphase, ref physMap, uid, xform, xformQuery, physicsQuery, fixturesQuery);
|
||||
RemoveFromEntityTree(broadphase.Owner, broadphase, ref physMap, uid, xform, xformQuery, fixturesQuery);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -762,7 +762,6 @@ namespace Robust.Shared.GameObjects
|
||||
EntityUid uid,
|
||||
TransformComponent xform,
|
||||
EntityQuery<TransformComponent> xformQuery,
|
||||
EntityQuery<PhysicsComponent> physicsQuery,
|
||||
EntityQuery<FixturesComponent> fixturesQuery,
|
||||
bool recursive = true)
|
||||
{
|
||||
@@ -812,7 +811,6 @@ namespace Robust.Shared.GameObjects
|
||||
child.Value,
|
||||
xformQuery.GetComponent(child.Value),
|
||||
xformQuery,
|
||||
physicsQuery,
|
||||
fixturesQuery);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,18 +178,16 @@ namespace Robust.Shared.Physics.Systems
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var contact in fixture.Contacts.Values.ToArray())
|
||||
{
|
||||
_physics.DestroyContact(contact);
|
||||
}
|
||||
|
||||
if (_lookup.TryGetCurrentBroadphase(xform, out var broadphase))
|
||||
{
|
||||
var map = Transform(broadphase.Owner).MapUid;
|
||||
if (TryComp<PhysicsMapComponent>(map, out var physicsMap))
|
||||
{
|
||||
foreach (var contact in fixture.Contacts.Values.ToArray())
|
||||
{
|
||||
_physics.DestroyContact(contact);
|
||||
}
|
||||
}
|
||||
TryComp<PhysicsMapComponent>(map, out var physicsMap);
|
||||
_lookup.DestroyProxies(fixture, xform, broadphase, physicsMap);
|
||||
|
||||
}
|
||||
|
||||
if (updates)
|
||||
|
||||
Reference in New Issue
Block a user