Merge stable into master (#37465)
This commit is contained in:
@@ -210,12 +210,12 @@ namespace Content.Shared.Movement.Systems
|
||||
var diff = relativeRot - oldRelativeRot;
|
||||
|
||||
// If we're going from a grid -> map then preserve the relative rotation so it's seamless if they go into space and back.
|
||||
if (HasComp<MapComponent>(relative) && HasComp<MapGridComponent>(mover.RelativeEntity))
|
||||
if (MapQuery.HasComp(relative) && MapGridQuery.HasComp(mover.RelativeEntity))
|
||||
{
|
||||
mover.TargetRelativeRotation -= diff;
|
||||
}
|
||||
// Snap to nearest cardinal if map -> grid
|
||||
else if (HasComp<MapGridComponent>(relative) && HasComp<MapComponent>(mover.RelativeEntity))
|
||||
// Snap to nearest cardinal if map -> grid or grid -> grid
|
||||
else if (MapGridQuery.HasComp(relative) && (MapQuery.HasComp(mover.RelativeEntity) || MapGridQuery.HasComp(mover.RelativeEntity)))
|
||||
{
|
||||
var targetDir = mover.TargetRelativeRotation - diff;
|
||||
targetDir = targetDir.GetCardinalDir().ToAngle().Reduced();
|
||||
|
||||
@@ -50,18 +50,19 @@ public abstract partial class SharedMoverController : VirtualController
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly TagSystem _tags = default!;
|
||||
|
||||
protected EntityQuery<CanMoveInAirComponent> CanMoveInAirQuery;
|
||||
protected EntityQuery<FootstepModifierComponent> FootstepModifierQuery;
|
||||
protected EntityQuery<InputMoverComponent> MoverQuery;
|
||||
protected EntityQuery<MapComponent> MapQuery;
|
||||
protected EntityQuery<MapGridComponent> MapGridQuery;
|
||||
protected EntityQuery<MobMoverComponent> MobMoverQuery;
|
||||
protected EntityQuery<MovementRelayTargetComponent> RelayTargetQuery;
|
||||
protected EntityQuery<MovementSpeedModifierComponent> ModifierQuery;
|
||||
protected EntityQuery<NoRotateOnMoveComponent> NoRotateQuery;
|
||||
protected EntityQuery<PhysicsComponent> PhysicsQuery;
|
||||
protected EntityQuery<RelayInputMoverComponent> RelayQuery;
|
||||
protected EntityQuery<PullableComponent> PullableQuery;
|
||||
protected EntityQuery<TransformComponent> XformQuery;
|
||||
protected EntityQuery<CanMoveInAirComponent> CanMoveInAirQuery;
|
||||
protected EntityQuery<NoRotateOnMoveComponent> NoRotateQuery;
|
||||
protected EntityQuery<FootstepModifierComponent> FootstepModifierQuery;
|
||||
protected EntityQuery<MapGridComponent> MapGridQuery;
|
||||
|
||||
private static readonly ProtoId<TagPrototype> FootstepSoundTag = "FootstepSound";
|
||||
|
||||
@@ -91,6 +92,7 @@ public abstract partial class SharedMoverController : VirtualController
|
||||
CanMoveInAirQuery = GetEntityQuery<CanMoveInAirComponent>();
|
||||
FootstepModifierQuery = GetEntityQuery<FootstepModifierComponent>();
|
||||
MapGridQuery = GetEntityQuery<MapGridComponent>();
|
||||
MapQuery = GetEntityQuery<MapComponent>();
|
||||
|
||||
SubscribeLocalEvent<MovementSpeedModifierComponent, TileFrictionEvent>(OnTileFriction);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user