BinComponent.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Content.Shared.Storage.EntitySystems;
  2. using Content.Shared.Whitelist;
  3. using Robust.Shared.Containers;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.Shared.Storage.Components;
  7. /// <summary>
  8. /// This is used for things like paper bins, in which
  9. /// you can only take off of the top of the bin.
  10. /// </summary>
  11. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  12. [Access(typeof(BinSystem))]
  13. public sealed partial class BinComponent : Component
  14. {
  15. /// <summary>
  16. /// The containers that contain the items held in the bin
  17. /// </summary>
  18. [ViewVariables]
  19. public Container ItemContainer = default!;
  20. /// <summary>
  21. /// A list representing the order in which
  22. /// all the entities are stored in the bin.
  23. /// </summary>
  24. /// <remarks>
  25. /// The only reason this isn't a stack is so that
  26. /// i can handle entities being deleted and removed
  27. /// out of order by other systems
  28. /// </remarks>
  29. [DataField, AutoNetworkedField]
  30. public List<EntityUid> Items = new();
  31. /// <summary>
  32. /// The items that start in the bin. Sorted in order.
  33. /// </summary>
  34. [DataField]
  35. public List<EntProtoId> InitialContents = new();
  36. /// <summary>
  37. /// A whitelist governing what items can be inserted into the bin.
  38. /// </summary>
  39. [DataField, AutoNetworkedField]
  40. public EntityWhitelist? Whitelist;
  41. /// <summary>
  42. /// The maximum amount of items
  43. /// that can be stored in the bin.
  44. /// </summary>
  45. [DataField, AutoNetworkedField]
  46. public int MaxItems = 20;
  47. }