Skip to content

Commit

Permalink
Don't defer adding joints (space-wizards#4762)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroJr authored Dec 25, 2023
1 parent 2d3379d commit d212479
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Robust.Shared/Physics/Systems/SharedJointSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ private void InitJoint(Joint joint,
FilterContactsForJoint(joint, bodyA, bodyB);
}

// TODO reduce metadata resolves.
_physics.WakeBody(aUid, body: bodyA);
_physics.WakeBody(bUid, body: bodyB);
Dirty(aUid, bodyA);
Expand Down Expand Up @@ -426,13 +427,7 @@ protected void AddJoint(Joint joint, PhysicsComponent? bodyA = null, PhysicsComp
return;
}

// Need to defer this for prediction reasons, yay!
// This can also break prediction for reasons, yay!
// Whenever a joint is added or removed, you need to check if its queued for adding.
// The client can apply multiple game states in a row without running a tick update,
// which can lead to things like cross-map joints.
// TODO is this actually needed. Its bad for performance coin.
AddedJoints.Add(joint);
InitJoint(joint, bodyA, bodyB);

if (_gameTiming.IsFirstTimePredicted)
{
Expand Down

0 comments on commit d212479

Please sign in to comment.