InventoryComponent.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.Shared.DisplacementMap;
  2. using Robust.Shared.Containers;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  5. namespace Content.Shared.Inventory;
  6. [RegisterComponent, NetworkedComponent]
  7. [Access(typeof(InventorySystem))]
  8. [AutoGenerateComponentState(true)]
  9. public sealed partial class InventoryComponent : Component
  10. {
  11. [DataField("templateId", customTypeSerializer: typeof(PrototypeIdSerializer<InventoryTemplatePrototype>))]
  12. [AutoNetworkedField]
  13. public string TemplateId { get; set; } = "human";
  14. [DataField("speciesId")] public string? SpeciesId { get; set; }
  15. public SlotDefinition[] Slots = Array.Empty<SlotDefinition>();
  16. public ContainerSlot[] Containers = Array.Empty<ContainerSlot>();
  17. [DataField]
  18. public Dictionary<string, DisplacementData> Displacements = new();
  19. /// <summary>
  20. /// Alternate displacement maps, which if available, will be selected for the player of the appropriate gender.
  21. /// </summary>
  22. [DataField]
  23. public Dictionary<string, DisplacementData> FemaleDisplacements = new();
  24. /// <summary>
  25. /// Alternate displacement maps, which if available, will be selected for the player of the appropriate gender.
  26. /// </summary>
  27. [DataField]
  28. public Dictionary<string, DisplacementData> MaleDisplacements = new();
  29. }
  30. /// <summary>
  31. /// Raised if the <see cref="InventoryComponent.TemplateId"/> of an inventory changed.
  32. /// </summary>
  33. [ByRefEvent]
  34. public struct InventoryTemplateUpdated;