diff --git a/Content.Shared/Actions/Components/EntityTargetActionComponent.cs b/Content.Shared/Actions/Components/EntityTargetActionComponent.cs index d32205d157..82289364b4 100644 --- a/Content.Shared/Actions/Components/EntityTargetActionComponent.cs +++ b/Content.Shared/Actions/Components/EntityTargetActionComponent.cs @@ -1,5 +1,4 @@ -using Content.Shared.Actions; -using Content.Shared.Whitelist; +using Content.Shared.Whitelist; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; @@ -45,4 +44,10 @@ public sealed partial class EntityTargetActionComponent : Component /// [DataField, AutoNetworkedField] public bool CanTargetSelf = true; + + /// + /// Whether to make the user face towards the direction where they targeted this action. + /// + [DataField, AutoNetworkedField] + public bool RotateOnUse = true; } diff --git a/Content.Shared/Actions/Components/WorldTargetActionComponent.cs b/Content.Shared/Actions/Components/WorldTargetActionComponent.cs index 6ec201dcb8..87e3220e37 100644 --- a/Content.Shared/Actions/Components/WorldTargetActionComponent.cs +++ b/Content.Shared/Actions/Components/WorldTargetActionComponent.cs @@ -1,5 +1,4 @@ -using Content.Shared.Actions; -using Robust.Shared.GameStates; +using Robust.Shared.GameStates; using Robust.Shared.Prototypes; namespace Content.Shared.Actions.Components; @@ -13,6 +12,7 @@ namespace Content.Shared.Actions.Components; /// [RegisterComponent, NetworkedComponent, Access(typeof(SharedActionsSystem))] [EntityCategory("Actions")] +[AutoGenerateComponentState] public sealed partial class WorldTargetActionComponent : Component { /// @@ -20,4 +20,10 @@ public sealed partial class WorldTargetActionComponent : Component /// [DataField(required: true), NonSerialized] public WorldTargetActionEvent? Event; + + /// + /// Whether to make the user face towards the direction where they targeted this action. + /// + [DataField, AutoNetworkedField] + public bool RotateOnUse = true; } diff --git a/Content.Shared/Actions/SharedActionsSystem.cs b/Content.Shared/Actions/SharedActionsSystem.cs index d32bd23da0..948d655d4a 100644 --- a/Content.Shared/Actions/SharedActionsSystem.cs +++ b/Content.Shared/Actions/SharedActionsSystem.cs @@ -348,7 +348,9 @@ public abstract class SharedActionsSystem : EntitySystem var target = GetEntity(netTarget); var targetWorldPos = _transform.GetWorldPosition(target); - _rotateToFace.TryFaceCoordinates(user, targetWorldPos); + + if (ent.Comp.RotateOnUse) + _rotateToFace.TryFaceCoordinates(user, targetWorldPos); if (!ValidateEntityTarget(user, target, ent)) return; @@ -369,7 +371,9 @@ public abstract class SharedActionsSystem : EntitySystem var user = args.User; var target = GetCoordinates(netTarget); - _rotateToFace.TryFaceCoordinates(user, target.ToMapPos(EntityManager, _transform)); + + if (ent.Comp.RotateOnUse) + _rotateToFace.TryFaceCoordinates(user, _transform.ToMapCoordinates(target).Position); if (!ValidateWorldTarget(user, target, ent)) return; @@ -604,7 +608,7 @@ public abstract class SharedActionsSystem : EntitySystem return AddAction(performer, ref actionId, out _, actionPrototypeId, container, component); } - /// + /// public bool AddAction(EntityUid performer, [NotNullWhen(true)] ref EntityUid? actionId, [NotNullWhen(true)] out ActionComponent? action,