ItemBorgModuleComponent.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Robust.Shared.Containers;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
  5. namespace Content.Shared.Silicons.Borgs.Components;
  6. /// <summary>
  7. /// This is used for a <see cref="BorgModuleComponent"/> that provides items to the entity it's installed into.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent, Access(typeof(SharedBorgSystem))]
  10. public sealed partial class ItemBorgModuleComponent : Component
  11. {
  12. /// <summary>
  13. /// The items that are provided.
  14. /// </summary>
  15. [DataField("items", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>), required: true)]
  16. public List<string> Items = new();
  17. /// <summary>
  18. /// The entities from <see cref="Items"/> that were spawned.
  19. /// </summary>
  20. [DataField("providedItems")]
  21. public SortedDictionary<string, EntityUid> ProvidedItems = new();
  22. /// <summary>
  23. /// A counter that ensures a unique
  24. /// </summary>
  25. [DataField("handCounter")]
  26. public int HandCounter;
  27. /// <summary>
  28. /// Whether or not the items have been created and stored in <see cref="ProvidedContainer"/>
  29. /// </summary>
  30. [DataField("itemsCrated")]
  31. public bool ItemsCreated;
  32. /// <summary>
  33. /// A container where provided items are stored when not being used.
  34. /// This is helpful as it means that items retain state.
  35. /// </summary>
  36. [ViewVariables]
  37. public Container ProvidedContainer = default!;
  38. /// <summary>
  39. /// An ID for the container where provided items are stored when not used.
  40. /// </summary>
  41. [DataField("providedContainerId")]
  42. public string ProvidedContainerId = "provided_container";
  43. }