Prevent dead players from turning bar stools (#24308)
Prevent dead users from turning their bar stools Previously, players could always turn a bar stool or office chair they were buckled into; even while stone cold dead!
This commit is contained in:
@@ -101,7 +101,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
|||||||
Assert.That(buckle.Buckled);
|
Assert.That(buckle.Buckled);
|
||||||
|
|
||||||
Assert.That(actionBlocker.CanMove(human), Is.False);
|
Assert.That(actionBlocker.CanMove(human), Is.False);
|
||||||
Assert.That(actionBlocker.CanChangeDirection(human), Is.False);
|
Assert.That(actionBlocker.CanChangeDirection(human));
|
||||||
Assert.That(standingState.Down(human), Is.False);
|
Assert.That(standingState.Down(human), Is.False);
|
||||||
Assert.That(
|
Assert.That(
|
||||||
(xformSystem.GetWorldPosition(human) - xformSystem.GetWorldPosition(chair)).LengthSquared,
|
(xformSystem.GetWorldPosition(human) - xformSystem.GetWorldPosition(chair)).LengthSquared,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Interaction.Events;
|
|
||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Movement.Events;
|
using Content.Shared.Movement.Events;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
@@ -39,7 +38,6 @@ public abstract partial class SharedBuckleSystem
|
|||||||
SubscribeLocalEvent<BuckleComponent, StandAttemptEvent>(OnBuckleStandAttempt);
|
SubscribeLocalEvent<BuckleComponent, StandAttemptEvent>(OnBuckleStandAttempt);
|
||||||
SubscribeLocalEvent<BuckleComponent, ThrowPushbackAttemptEvent>(OnBuckleThrowPushbackAttempt);
|
SubscribeLocalEvent<BuckleComponent, ThrowPushbackAttemptEvent>(OnBuckleThrowPushbackAttempt);
|
||||||
SubscribeLocalEvent<BuckleComponent, UpdateCanMoveEvent>(OnBuckleUpdateCanMove);
|
SubscribeLocalEvent<BuckleComponent, UpdateCanMoveEvent>(OnBuckleUpdateCanMove);
|
||||||
SubscribeLocalEvent<BuckleComponent, ChangeDirectionAttemptEvent>(OnBuckleChangeDirectionAttempt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBuckleComponentStartup(EntityUid uid, BuckleComponent component, ComponentStartup args)
|
private void OnBuckleComponentStartup(EntityUid uid, BuckleComponent component, ComponentStartup args)
|
||||||
@@ -142,12 +140,6 @@ public abstract partial class SharedBuckleSystem
|
|||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBuckleChangeDirectionAttempt(EntityUid uid, BuckleComponent component, ChangeDirectionAttemptEvent args)
|
|
||||||
{
|
|
||||||
if (component.Buckled)
|
|
||||||
args.Cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsBuckled(EntityUid uid, BuckleComponent? component = null)
|
public bool IsBuckled(EntityUid uid, BuckleComponent? component = null)
|
||||||
{
|
{
|
||||||
return Resolve(uid, ref component, false) && component.Buckled;
|
return Resolve(uid, ref component, false) && component.Buckled;
|
||||||
|
|||||||
@@ -80,14 +80,8 @@ namespace Content.Shared.Interaction
|
|||||||
|
|
||||||
public bool TryFaceAngle(EntityUid user, Angle diffAngle, TransformComponent? xform = null)
|
public bool TryFaceAngle(EntityUid user, Angle diffAngle, TransformComponent? xform = null)
|
||||||
{
|
{
|
||||||
if (_actionBlockerSystem.CanChangeDirection(user))
|
if (!_actionBlockerSystem.CanChangeDirection(user))
|
||||||
{
|
return false;
|
||||||
if (!Resolve(user, ref xform))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
_transform.SetWorldRotation(xform, diffAngle);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EntityManager.TryGetComponent(user, out BuckleComponent? buckle) && buckle.Buckled)
|
if (EntityManager.TryGetComponent(user, out BuckleComponent? buckle) && buckle.Buckled)
|
||||||
{
|
{
|
||||||
@@ -105,9 +99,16 @@ namespace Content.Shared.Interaction
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
// user is not buckled in; apply to their transform
|
||||||
|
if (!Resolve(user, ref xform))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_transform.SetWorldRotation(xform, diffAngle);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user