using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Actions;
///
/// Used on action entities to define an action that triggers when targeting an entity.
///
[RegisterComponent, NetworkedComponent]
public sealed partial class EntityTargetActionComponent : BaseTargetActionComponent
{
public override BaseActionEvent? BaseEvent => Event;
///
/// The local-event to raise when this action is performed.
///
[DataField("event")]
[NonSerialized]
public EntityTargetActionEvent? Event;
///
/// Determines which entities are valid targets for this action.
///
/// No whitelist check when null.
[DataField("whitelist")] public EntityWhitelist? Whitelist;
///
/// Whether this action considers the user as a valid target entity when using this action.
///
[DataField("canTargetSelf")] public bool CanTargetSelf = true;
}
[Serializable, NetSerializable]
public sealed class EntityTargetActionComponentState : BaseActionComponentState
{
public EntityWhitelist? Whitelist;
public bool CanTargetSelf;
public EntityTargetActionComponentState(EntityTargetActionComponent component, IEntityManager entManager) : base(component, entManager)
{
Whitelist = component.Whitelist;
CanTargetSelf = component.CanTargetSelf;
}
}