Fix tethergun (#13163)

This commit is contained in:
metalgearsloth
2022-12-25 08:24:43 +11:00
committed by GitHub
parent 21d1b885d6
commit a5f17a590f
4 changed files with 13 additions and 11 deletions

View File

@@ -21,6 +21,7 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedJointSystem _joints = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
private readonly Dictionary<ICommonSession, (EntityUid Entity, EntityUid Tether, Joint Joint)> _tethered = new();
private readonly HashSet<ICommonSession> _draggers = new();
@@ -113,6 +114,8 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
body.BodyStatus = BodyStatus.InAir;
}
_physics.WakeBody(bodyA);
_physics.WakeBody(bodyB);
var joint = _joints.CreateMouseJoint(bodyA.Owner, bodyB.Owner, id: JointId);
SharedJointSystem.LinearStiffness(5f, 0.7f, bodyA.Mass, bodyB.Mass, out var stiffness, out var damping);
@@ -183,7 +186,7 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
// Force it awake, always
if (bodyQuery.TryGetComponent(entity.Entity, out var body))
{
body.WakeBody();
_physics.WakeBody(body);
}
}