PopupUser.cs 914 B

12345678910111213141516171819202122232425262728
  1. using Content.Server.Popups;
  2. using Content.Shared.Construction;
  3. using JetBrains.Annotations;
  4. using Robust.Shared.Player;
  5. namespace Content.Server.Construction.Completions
  6. {
  7. [UsedImplicitly]
  8. [DataDefinition]
  9. public sealed partial class PopupUser : IGraphAction
  10. {
  11. [DataField("cursor")] public bool Cursor { get; private set; }
  12. [DataField("text")] public string Text { get; private set; } = string.Empty;
  13. public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
  14. {
  15. if (userUid == null)
  16. return;
  17. var popupSystem = entityManager.EntitySysManager.GetEntitySystem<PopupSystem>();
  18. if(Cursor)
  19. popupSystem.PopupCursor(Loc.GetString(Text), userUid.Value);
  20. else
  21. popupSystem.PopupEntity(Loc.GetString(Text), uid, userUid.Value);
  22. }
  23. }
  24. }