Don't reset sleeptimer on building physics islands

This commit is contained in:
metalgearsloth
2021-04-15 23:18:05 +10:00
parent 4dd04207ac
commit d16078a35f
2 changed files with 12 additions and 1 deletions

View File

@@ -136,6 +136,17 @@ namespace Robust.Shared.GameObjects
[DataField("bodyType")]
private BodyType _bodyType = BodyType.Static;
/// <summary>
/// Set awake without the sleeptimer being reset.
/// </summary>
internal void ForceAwake()
{
if (_awake || _bodyType == BodyType.Static) return;
_awake = true;
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new PhysicsWakeMessage(this));
}
// We'll also block Static bodies from ever being awake given they don't need to move.
/// <inheritdoc />
[ViewVariables(VVAccess.ReadWrite)]

View File

@@ -538,7 +538,7 @@ namespace Robust.Shared.Physics.Dynamics
if (body.BodyType == BodyType.Static) continue;
// As static bodies can never be awake (unlike Farseer) we'll set this after the check.
body.Awake = true;
body.ForceAwake();
for (var contactEdge = body.ContactEdges; contactEdge != null; contactEdge = contactEdge.Next)
{