Mouse rotator system (#19267)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -54,6 +54,7 @@ namespace Content.Shared.Movement.Systems
|
||||
protected EntityQuery<SharedPullableComponent> PullableQuery;
|
||||
protected EntityQuery<TransformComponent> XformQuery;
|
||||
protected EntityQuery<CanMoveInAirComponent> CanMoveInAirQuery;
|
||||
protected EntityQuery<NoRotateOnMoveComponent> NoRotateQuery;
|
||||
|
||||
private const float StepSoundMoveDistanceRunning = 2;
|
||||
private const float StepSoundMoveDistanceWalking = 1.5f;
|
||||
@@ -84,6 +85,7 @@ namespace Content.Shared.Movement.Systems
|
||||
RelayQuery = GetEntityQuery<RelayInputMoverComponent>();
|
||||
PullableQuery = GetEntityQuery<SharedPullableComponent>();
|
||||
XformQuery = GetEntityQuery<TransformComponent>();
|
||||
NoRotateQuery = GetEntityQuery<NoRotateOnMoveComponent>();
|
||||
CanMoveInAirQuery = GetEntityQuery<CanMoveInAirComponent>();
|
||||
|
||||
InitializeFootsteps();
|
||||
@@ -246,10 +248,13 @@ namespace Content.Shared.Movement.Systems
|
||||
|
||||
if (worldTotal != Vector2.Zero)
|
||||
{
|
||||
var worldRot = _transform.GetWorldRotation(xform);
|
||||
_transform.SetLocalRotation(xform, xform.LocalRotation + worldTotal.ToWorldAngle() - worldRot);
|
||||
// TODO apparently this results in a duplicate move event because "This should have its event run during
|
||||
// island solver"??. So maybe SetRotation needs an argument to avoid raising an event?
|
||||
if (!NoRotateQuery.HasComponent(uid))
|
||||
{
|
||||
// TODO apparently this results in a duplicate move event because "This should have its event run during
|
||||
// island solver"??. So maybe SetRotation needs an argument to avoid raising an event?
|
||||
var worldRot = _transform.GetWorldRotation(xform);
|
||||
_transform.SetLocalRotation(xform, xform.LocalRotation + worldTotal.ToWorldAngle() - worldRot);
|
||||
}
|
||||
|
||||
if (!weightless && MobMoverQuery.TryGetComponent(uid, out var mobMover) &&
|
||||
TryGetSound(weightless, uid, mover, mobMover, xform, out var sound, tileDef: tileDef))
|
||||
|
||||
Reference in New Issue
Block a user