Snap to nearest cardinal on traversal (#10869)
This commit is contained in:
@@ -916,7 +916,7 @@ namespace Content.Shared.CCVar
|
||||
/// - When traversing grids it will snap to the nearest cardinal which will generally be imperceptible.
|
||||
/// </summary>
|
||||
public static readonly CVarDef<bool> CameraRotationLocked =
|
||||
CVarDef.Create("shuttle.camera_rotation_locked", true, CVar.REPLICATED);
|
||||
CVarDef.Create("shuttle.camera_rotation_locked", false, CVar.REPLICATED);
|
||||
|
||||
/// <summary>
|
||||
/// Whether cargo shuttles are enabled.
|
||||
|
||||
@@ -10,5 +10,10 @@ namespace Content.Shared.Decals
|
||||
[DataField("sprite")] public SpriteSpecifier Sprite { get; } = SpriteSpecifier.Invalid;
|
||||
[DataField("tags")] public List<string> Tags = new();
|
||||
[DataField("showMenu")] public bool ShowMenu = true;
|
||||
|
||||
/// <summary>
|
||||
/// If the decal is rotated compared to our eye should we snap it to south.
|
||||
/// </summary>
|
||||
[DataField("snapCardinals")] public bool SnapCardinals = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.Input;
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Throwing;
|
||||
@@ -797,7 +798,16 @@ namespace Content.Shared.Interaction
|
||||
RaiseLocalEvent(item, dropMsg, true);
|
||||
if (dropMsg.Handled)
|
||||
_adminLogger.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}");
|
||||
Transform(item).LocalRotation = Angle.Zero;
|
||||
|
||||
// If the dropper is rotated then use their targetrelativerotation as the drop rotation
|
||||
var rotation = Angle.Zero;
|
||||
|
||||
if (TryComp<InputMoverComponent>(user, out var mover))
|
||||
{
|
||||
rotation = mover.TargetRelativeRotation;
|
||||
}
|
||||
|
||||
Transform(item).LocalRotation = rotation;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Shared.Movement.Systems
|
||||
/// </summary>
|
||||
public abstract partial class SharedMoverController
|
||||
{
|
||||
public bool CameraRotationLocked { get; private set; }
|
||||
public bool CameraRotationLocked { get; set; }
|
||||
|
||||
private void InitializeInput()
|
||||
{
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Content.Shared.Movement.Systems
|
||||
var angleDiff = Angle.ShortestDistance(mover.RelativeRotation, mover.TargetRelativeRotation);
|
||||
|
||||
// if we've just traversed then lerp to our target rotation.
|
||||
if (!angleDiff.EqualsApprox(Angle.Zero, 0.005))
|
||||
if (!angleDiff.EqualsApprox(Angle.Zero, 0.001))
|
||||
{
|
||||
var adjustment = angleDiff * 5f * frameTime;
|
||||
var minAdjustment = 0.005 * frameTime;
|
||||
|
||||
Reference in New Issue
Block a user