ItemCounterComponent.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Content.Shared.Storage.EntitySystems;
  2. using Content.Shared.Whitelist;
  3. namespace Content.Shared.Storage.Components
  4. {
  5. /// <summary>
  6. /// Storage that spawns and counts a single item.
  7. /// Usually used for things like matchboxes, cigarette packs,
  8. /// cigar cases etc.
  9. /// </summary>
  10. /// <code>
  11. /// - type: ItemCounter
  12. /// amount: 6 # Note: this field can be omitted.
  13. /// count:
  14. /// tags: [Cigarette]
  15. /// </code>
  16. [RegisterComponent]
  17. [Access(typeof(SharedItemCounterSystem))]
  18. public sealed partial class ItemCounterComponent : Component
  19. {
  20. [DataField("count", required: true)]
  21. public EntityWhitelist Count { get; set; } = default!;
  22. [DataField("amount")]
  23. public int? MaxAmount { get; set; }
  24. /// <summary>
  25. /// Default IconLayer stack.
  26. /// </summary>
  27. [DataField("baseLayer")]
  28. [ViewVariables(VVAccess.ReadWrite)]
  29. public string BaseLayer = "";
  30. /// <summary>
  31. /// Determines if the visualizer uses composite or non-composite layers for icons. Defaults to false.
  32. ///
  33. /// <list type="bullet">
  34. /// <item>
  35. /// <description>false: they are opaque and mutually exclusive (e.g. sprites in a cable coil). <b>Default value</b></description>
  36. /// </item>
  37. /// <item>
  38. /// <description>true: they are transparent and thus layered one over another in ascending order first</description>
  39. /// </item>
  40. /// </list>
  41. ///
  42. /// </summary>
  43. [DataField("composite")]
  44. [ViewVariables(VVAccess.ReadWrite)]
  45. public bool IsComposite;
  46. /// <summary>
  47. /// Sprite layers used in counter visualizer. Sprites first in layer correspond to lower stack states
  48. /// e.g. <code>_spriteLayers[0]</code> is lower stack level than <code>_spriteLayers[1]</code>.
  49. /// </summary>
  50. [DataField("layerStates")]
  51. [ViewVariables(VVAccess.ReadWrite)]
  52. public List<string> LayerStates = new();
  53. }
  54. }