-using Content.Shared.Actions;
-using Content.Shared.Whitelist;
+using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
/// </summary>
[DataField, AutoNetworkedField]
public bool CanTargetSelf = true;
+
+ /// <summary>
+ /// Whether to make the user face towards the direction where they targeted this action.
+ /// </summary>
+ [DataField, AutoNetworkedField]
+ public bool RotateOnUse = true;
}
-using Content.Shared.Actions;
-using Robust.Shared.GameStates;
+using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Actions.Components;
/// </remarks>
[RegisterComponent, NetworkedComponent, Access(typeof(SharedActionsSystem))]
[EntityCategory("Actions")]
+[AutoGenerateComponentState]
public sealed partial class WorldTargetActionComponent : Component
{
/// <summary>
/// </summary>
[DataField(required: true), NonSerialized]
public WorldTargetActionEvent? Event;
+
+ /// <summary>
+ /// Whether to make the user face towards the direction where they targeted this action.
+ /// </summary>
+ [DataField, AutoNetworkedField]
+ public bool RotateOnUse = true;
}
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;
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;
return AddAction(performer, ref actionId, out _, actionPrototypeId, container, component);
}
- /// <inheritdoc cref="AddAction(Robust.Shared.GameObjects.EntityUid,ref System.Nullable{Robust.Shared.GameObjects.EntityUid},string?,Robust.Shared.GameObjects.EntityUid,Content.Shared.Actions.ActionsComponent?)"/>
+ /// <inheritdoc cref="AddAction(Robust.Shared.GameObjects.EntityUid,ref System.Nullable{Robust.Shared.GameObjects.EntityUid},string?,Robust.Shared.GameObjects.EntityUid,ActionsComponent?)"/>
public bool AddAction(EntityUid performer,
[NotNullWhen(true)] ref EntityUid? actionId,
[NotNullWhen(true)] out ActionComponent? action,