Skip to content

Commit a2a8a63

Browse files
committed
ActionBlocker CanChangeDirection uses EntityUid exclusively
1 parent cba96ad commit a2a8a63

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

Content.IntegrationTests/Tests/Buckle/BuckleTest.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ await server.WaitAssertion(() =>
8383
Assert.Null(buckle.BuckledTo);
8484
Assert.False(buckle.Buckled);
8585
Assert.True(actionBlocker.CanMove(human.Uid));
86-
Assert.True(actionBlocker.CanChangeDirection(human));
86+
Assert.True(actionBlocker.CanChangeDirection(human.Uid));
8787
Assert.True(standingState.Down(human.Uid));
8888
Assert.True(standingState.Stand(human.Uid));
8989

@@ -101,7 +101,7 @@ await server.WaitAssertion(() =>
101101
var player = IoCManager.Resolve<IPlayerManager>().GetAllPlayers().Single();
102102
Assert.True(((BuckleComponentState) buckle.GetComponentState(player)).Buckled);
103103
Assert.False(actionBlocker.CanMove(human.Uid));
104-
Assert.False(actionBlocker.CanChangeDirection(human));
104+
Assert.False(actionBlocker.CanChangeDirection(human.Uid));
105105
Assert.False(standingState.Down(human.Uid));
106106
Assert.That((human.Transform.WorldPosition - chair.Transform.WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length));
107107

@@ -135,7 +135,7 @@ await server.WaitAssertion(() =>
135135
Assert.Null(buckle.BuckledTo);
136136
Assert.False(buckle.Buckled);
137137
Assert.True(actionBlocker.CanMove(human.Uid));
138-
Assert.True(actionBlocker.CanChangeDirection(human));
138+
Assert.True(actionBlocker.CanChangeDirection(human.Uid));
139139
Assert.True(standingState.Down(human.Uid));
140140

141141
// Unbuckle, strap
@@ -193,7 +193,7 @@ await server.WaitAssertion(() =>
193193
Assert.True(buckle.TryUnbuckle(human, true));
194194
Assert.False(buckle.Buckled);
195195
Assert.True(actionBlocker.CanMove(human.Uid));
196-
Assert.True(actionBlocker.CanChangeDirection(human));
196+
Assert.True(actionBlocker.CanChangeDirection(human.Uid));
197197
Assert.True(standingState.Down(human.Uid));
198198

199199
// Re-buckle

Content.Shared/ActionBlocker/ActionBlockerSystem.cs

+3-9
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,14 @@ public bool CanUnequip(EntityUid uid)
115115
return !ev.Cancelled;
116116
}
117117

118-
public bool CanChangeDirection(IEntity entity)
118+
public bool CanChangeDirection(EntityUid uid)
119119
{
120-
var ev = new ChangeDirectionAttemptEvent(entity);
121-
122-
RaiseLocalEvent(entity.Uid, ev);
120+
var ev = new ChangeDirectionAttemptEvent(uid);
121+
RaiseLocalEvent(uid, ev);
123122

124123
return !ev.Cancelled;
125124
}
126125

127-
public bool CanChangeDirection(EntityUid uid)
128-
{
129-
return CanChangeDirection(EntityManager.GetEntity(uid));
130-
}
131-
132126
public bool CanShiver(IEntity entity)
133127
{
134128
var ev = new ShiverAttemptEvent(entity);

Content.Shared/Interaction/Events/ChangeDirectionAttemptEvent.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ namespace Content.Shared.Interaction.Events
44
{
55
public class ChangeDirectionAttemptEvent : CancellableEntityEventArgs
66
{
7-
public ChangeDirectionAttemptEvent(IEntity entity)
7+
public ChangeDirectionAttemptEvent(EntityUid uid)
88
{
9-
Entity = entity;
9+
Uid = uid;
1010
}
1111

12-
public IEntity Entity { get; }
12+
public EntityUid Uid { get; }
1313
}
1414
}

Content.Shared/Interaction/RotateToFaceSystem.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public bool TryFaceCoordinates(IEntity user, Vector2 coordinates)
4545

4646
public bool TryFaceAngle(IEntity user, Angle diffAngle)
4747
{
48-
if (_actionBlockerSystem.CanChangeDirection(user))
48+
if (_actionBlockerSystem.CanChangeDirection(user.Uid))
4949
{
5050
user.Transform.WorldRotation = diffAngle;
5151
return true;

0 commit comments

Comments
 (0)