using System.Linq; using Content.Shared.Localizations; using Content.Shared.Mind; using Content.Shared.Mind.Components; using Content.Shared.Roles; using Content.Shared.Roles.Components; using Content.Shared.Roles.Jobs; using Content.Shared.Whitelist; using Robust.Shared.Prototypes; namespace Content.Shared.EntityConditions.Conditions.Mind; /// /// Returns true if this entity has any of the specified jobs. False if the entity has no mind, none of the specified jobs, or is jobless. /// /// public sealed partial class MindContainerRoleEntityConditionSystem : EntityConditionSystem { [Dependency] private SharedRoleSystem _role = default!; protected override void Condition(Entity entity, ref EntityConditionEvent args) { if (!TryComp(entity.Comp.Mind, out var mind)) return; args.Result = _role.MindHasRole((entity.Comp.Mind.Value, mind), args.Condition.Whitelist); } } /// /// Returns true if this mind has any of the specified jobs. False if the mind has none of the specified jobs, or is jobless. /// /// public sealed partial class MindRoleEntityConditionSystem : EntityConditionSystem { [Dependency] private SharedRoleSystem _role = default!; protected override void Condition(Entity entity, ref EntityConditionEvent args) { args.Result = _role.MindHasRole(entity, args.Condition.Whitelist); } } /// public sealed partial class RoleCondition : EntityConditionBase { [DataField(required: true)] public EntityWhitelist Whitelist = new (); public override string EntityConditionGuidebookText(IPrototypeManager prototype) { return String.Empty; } }