using Content.Shared.Construction.EntitySystems;
using Content.Shared.Whitelist;
using Robust.Shared.Map;
using Robust.Shared.Utility;
namespace Content.Shared.Construction.Conditions;
///
/// A check to see if the entity itself can be crafted.
///
[DataDefinition]
public sealed partial class EntityWhitelistCondition : IConstructionCondition
{
///
/// What is told to the player attempting to construct the recipe using this condition. This will be localised.
///
[DataField("conditionString")]
public string ConditionString = "construction-step-condition-entity-whitelist";
///
/// The icon shown to the player beside the condition string.
///
[DataField("conditionIcon")]
public SpriteSpecifier? ConditionIcon = null;
///
/// The whitelist that allows only certain entities to use this.
///
[DataField("whitelist", required: true)]
public EntityWhitelist Whitelist = new();
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
var whitelistSystem = IoCManager.Resolve().System();
return whitelistSystem.IsWhitelistPass(Whitelist, user);
}
public ConstructionGuideEntry GenerateGuideEntry()
{
return new ConstructionGuideEntry
{
Localization = ConditionString,
Icon = ConditionIcon
};
}
}