ItemCreatorComponent.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using Content.Shared.Actions;
  2. using Content.Shared.Ninja.Systems;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Shared.Ninja.Components;
  6. /// <summary>
  7. /// Uses battery charge to spawn an item and place it in the user's hands.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  10. [Access(typeof(SharedItemCreatorSystem))]
  11. public sealed partial class ItemCreatorComponent : Component
  12. {
  13. /// <summary>
  14. /// The battery entity to use charge from
  15. /// </summary>
  16. [DataField, AutoNetworkedField]
  17. public EntityUid? Battery;
  18. /// <summary>
  19. /// The action id for creating an item.
  20. /// </summary>
  21. [DataField(required: true)]
  22. public EntProtoId<InstantActionComponent> Action = string.Empty;
  23. [DataField, AutoNetworkedField]
  24. public EntityUid? ActionEntity;
  25. /// <summary>
  26. /// Battery charge used to create an item.
  27. /// </summary>
  28. [DataField(required: true)]
  29. public float Charge = 14.4f;
  30. /// <summary>
  31. /// Item to create with the action
  32. /// </summary>
  33. [DataField(required: true)]
  34. public EntProtoId SpawnedPrototype = string.Empty;
  35. /// <summary>
  36. /// Popup shown to the user when there isn't enough power to create an item.
  37. /// </summary>
  38. [DataField(required: true)]
  39. public LocId NoPowerPopup = string.Empty;
  40. }
  41. /// <summary>
  42. /// Action event to use an <see cref="ItemCreator"/>.
  43. /// </summary>
  44. public sealed partial class CreateItemEvent : InstantActionEvent;