EntityWhitelist.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Content.Shared.Item;
  2. using Content.Shared.Tag;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization;
  5. namespace Content.Shared.Whitelist;
  6. /// <summary>
  7. /// Used to determine whether an entity fits a certain whitelist.
  8. /// Does not whitelist by prototypes, since that is undesirable; you're better off just adding a tag to all
  9. /// entity prototypes that need to be whitelisted, and checking for that.
  10. /// </summary>
  11. /// <code>
  12. /// whitelist:
  13. /// tags:
  14. /// - Cigarette
  15. /// - FirelockElectronics
  16. /// components:
  17. /// - Buckle
  18. /// - AsteroidRock
  19. /// sizes:
  20. /// - Tiny
  21. /// - Large
  22. /// </code>
  23. [DataDefinition]
  24. [Serializable, NetSerializable]
  25. public sealed partial class EntityWhitelist
  26. {
  27. /// <summary>
  28. /// Component names that are allowed in the whitelist.
  29. /// </summary>
  30. [DataField] public string[]? Components;
  31. // TODO yaml validation
  32. /// <summary>
  33. /// Mind Role Prototype names that are allowed in the whitelist.
  34. /// </summary>
  35. [DataField] public string[]? MindRoles;
  36. // TODO yaml validation
  37. /// <summary>
  38. /// Item sizes that are allowed in the whitelist.
  39. /// </summary>
  40. [DataField]
  41. public List<ProtoId<ItemSizePrototype>>? Sizes;
  42. [NonSerialized, Access(typeof(EntityWhitelistSystem))]
  43. public List<ComponentRegistration>? Registrations;
  44. /// <summary>
  45. /// Tags that are allowed in the whitelist.
  46. /// </summary>
  47. [DataField]
  48. public List<ProtoId<TagPrototype>>? Tags;
  49. /// <summary>
  50. /// If false, an entity only requires one of these components or tags to pass the whitelist. If true, an
  51. /// entity requires to have ALL of these components and tags to pass.
  52. /// The "Sizes" criteria will ignores this, since an item can only have one size.
  53. /// </summary>
  54. [DataField]
  55. public bool RequireAll;
  56. }