Fix tethergun (#13163)
This commit is contained in:
@@ -17,7 +17,6 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
@@ -85,15 +84,10 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
|
||||
|
||||
if (gameState is GameplayState game)
|
||||
{
|
||||
EntityUid? uid;
|
||||
var uid = game.GetEntityUnderPosition(mousePos);
|
||||
|
||||
foreach (var ent in _lookup.GetEntitiesIntersecting(mousePos, LookupFlags.Approximate | LookupFlags.Static))
|
||||
{
|
||||
uid = game.GetEntityUnderPosition(mousePos);
|
||||
|
||||
if (uid != null)
|
||||
StartDragging(uid.Value, mousePos);
|
||||
}
|
||||
if (uid != null)
|
||||
StartDragging(uid.Value, mousePos);
|
||||
}
|
||||
|
||||
if (_dragging == null)
|
||||
|
||||
@@ -54,7 +54,6 @@ public sealed class PrototypeSaveTest
|
||||
"SignalSwitch",
|
||||
"SignalButton",
|
||||
"ApcNetSwitch",
|
||||
"TetherEntity",
|
||||
"SignalButtonExt1",
|
||||
"SignalButtonExt2",
|
||||
"SignalButtonExt3",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,4 +3,10 @@
|
||||
noSpawn: true
|
||||
components:
|
||||
- type: Physics
|
||||
bodyType: Dynamic
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
id: tether
|
||||
|
||||
Reference in New Issue
Block a user