using Content.Shared.Actions;
using Robust.Shared.Prototypes;
namespace Content.Shared.EntityEffects.Effects;
///
/// Adds an action unless this entity already has one from the same prototype.
///
///
public sealed partial class AddActionEntityEffectSystem : EntityEffectSystem
{
[Dependency] private SharedActionsSystem _actions = default!;
protected override void Effect(Entity entity, ref EntityEffectEvent args)
{
var actionPrototype = args.Effect.Action;
foreach (var action in _actions.GetActions(entity))
{
if (actionPrototype.Equals(MetaData(action).EntityPrototype?.ID))
return;
}
_actions.AddAction(entity, actionPrototype);
}
}
///
public sealed partial class AddAction : EntityEffectBase
{
///
/// Action entity prototype to grant to this entity.
///
[DataField(required: true)]
public EntProtoId Action;
}