SpawnItemsOnUseComponent.cs 945 B

12345678910111213141516171819202122232425262728293031
  1. using Content.Shared.Storage;
  2. using Robust.Shared.Audio;
  3. namespace Content.Server.Storage.Components
  4. {
  5. /// <summary>
  6. /// Spawns items when used in hand.
  7. /// </summary>
  8. [RegisterComponent]
  9. public sealed partial class SpawnItemsOnUseComponent : Component
  10. {
  11. /// <summary>
  12. /// The list of entities to spawn, with amounts and orGroups.
  13. /// </summary>
  14. [DataField("items", required: true)]
  15. public List<EntitySpawnEntry> Items = new();
  16. /// <summary>
  17. /// A sound to play when the items are spawned. For example, gift boxes being unwrapped.
  18. /// </summary>
  19. [DataField("sound")]
  20. public SoundSpecifier? Sound = null;
  21. /// <summary>
  22. /// How many uses before the item should delete itself.
  23. /// </summary>
  24. [ViewVariables(VVAccess.ReadWrite)]
  25. [DataField("uses")]
  26. public int Uses = 1;
  27. }
  28. }