using Content.Shared.EntityConditions;
using Content.Shared.EntityEffects;
using Content.Shared.Popups;
using Robust.Shared.GameStates;
namespace Content.Shared.Actions.Components;
///
/// Specifies the action performer/target needs to meet specific conditions for the action to be correctly validated.
/// Can optionally use entity effects to do things such as subtracting satiation.
///
[RegisterComponent, NetworkedComponent, Access(typeof(ActionRequirementsSystem))]
public sealed partial class ActionRequirementsComponent : Component
{
///
/// What entity conditions the related entities need to meet for the action to count as valid.
/// Can be used, for example, to check if the performer has enough satiation.
///
[DataField]
public Dictionary Conditions = new ();
///
/// Effects to use on the related entities AFTER the action is successfully performed.
/// Can be used, for example, to spend satiation after the action is performed.
///
[DataField]
public Dictionary Effects = new ();
///
/// The text to show to the performer about why their action failed.
/// Gets "Performer", "Target" and "Action" passed into it as identities.
///
[DataField]
public LocId? FailPopup; // TODO: Conditions should return their own text for why they failed to use in popups. Then this can be optional and be made to ignore that text instead.
///
/// The type the popup for the performer should be.
///
[DataField]
public PopupType FailPopupType = PopupType.Small;
}
///
/// Who the condition/effect will target.
///
[Flags]
public enum ActionRequirementTarget : byte
{
///
/// Literally nothing. The condition and effect will target nothing, and as such, cannot happen.
///
None = 0,
///
/// The target is the action performer.
///
Performer = 1 << 0,
///
/// The target is the action target (if any)
///
Target = 1 << 1,
///
/// The target is both the performer and the target.
///
Both = Performer | Target,
// World - Maybe once conditions and effects support tile/world targeting properly.
}