]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add SharedPopupSystem.PopupClient for cursor and coordinates (#27231)
authorDrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com>
Mon, 22 Apr 2024 03:57:13 +0000 (20:57 -0700)
committerGitHub <noreply@github.com>
Mon, 22 Apr 2024 03:57:13 +0000 (13:57 +1000)
Content.Client/Popups/PopupSystem.cs
Content.Server/Popups/PopupSystem.cs
Content.Shared/Popups/SharedPopupSystem.cs

index 3faa392e58d5b26bb6612db5e2321bf28b9358d4..1ef8dfba2d1d4e354a1e9b216fec2ab3c8a1f0b6 100644 (file)
@@ -5,7 +5,6 @@ using Content.Shared.Popups;
 using Robust.Client.Graphics;
 using Robust.Client.Input;
 using Robust.Client.Player;
-using Robust.Client.ResourceManagement;
 using Robust.Client.UserInterface;
 using Robust.Shared.Configuration;
 using Robust.Shared.Map;
@@ -163,6 +162,15 @@ namespace Content.Client.Popups
             PopupEntity(message, uid, type);
         }
 
+        public override void PopupClient(string? message, EntityUid? recipient, PopupType type = PopupType.Small)
+        {
+            if (recipient == null)
+                return;
+
+            if (_timing.IsFirstTimePredicted)
+                PopupCursor(message, recipient.Value, type);
+        }
+
         public override void PopupClient(string? message, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small)
         {
             if (recipient == null)
@@ -172,6 +180,15 @@ namespace Content.Client.Popups
                 PopupEntity(message, uid, recipient.Value, type);
         }
 
+        public override void PopupClient(string? message, EntityCoordinates coordinates, EntityUid? recipient, PopupType type = PopupType.Small)
+        {
+            if (recipient == null)
+                return;
+
+            if (_timing.IsFirstTimePredicted)
+                PopupCoordinates(message, coordinates, recipient.Value, type);
+        }
+
         public override void PopupEntity(string? message, EntityUid uid, PopupType type = PopupType.Small)
         {
             if (TryComp(uid, out TransformComponent? transform))
index d1163a2be1b8b9dfe4c0a7b823008ad03616cba8..4aa3d39224cfd887da22fcafef1850b112baf72f 100644 (file)
@@ -88,11 +88,19 @@ namespace Content.Server.Popups
                 RaiseNetworkEvent(new PopupEntityEvent(message, type, GetNetEntity(uid)), actor.PlayerSession);
         }
 
+        public override void PopupClient(string? message, EntityUid? recipient, PopupType type = PopupType.Small)
+        {
+        }
+
         public override void PopupClient(string? message, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small)
         {
             // do nothing duh its for client only
         }
 
+        public override void PopupClient(string? message, EntityCoordinates coordinates, EntityUid? recipient, PopupType type = PopupType.Small)
+        {
+        }
+
         public override void PopupEntity(string? message, EntityUid uid, ICommonSession recipient, PopupType type = PopupType.Small)
         {
             if (message == null)
index 10e8ca9be11294a0fe1b3826a41232471dee0a98..38d2030cd5a039f74fc0b464699f9d10a4bea8dd 100644 (file)
@@ -82,12 +82,24 @@ namespace Content.Shared.Popups
         /// </summary>
         public abstract void PopupEntity(string? message, EntityUid uid, Filter filter, bool recordReplay, PopupType type = PopupType.Small);
 
+        /// <summary>
+        /// Variant of <see cref="PopupCursor(string, EntityUid, PopupType)"/> that only runs on the client, outside of prediction.
+        /// Useful for shared code that is always ran by both sides to avoid duplicate popups.
+        /// </summary>
+        public abstract void PopupClient(string? message, EntityUid? recipient, PopupType type = PopupType.Small);
+
         /// <summary>
         /// Variant of <see cref="PopupEntity(string, EntityUid, EntityUid, PopupType)"/> that only runs on the client, outside of prediction.
         /// Useful for shared code that is always ran by both sides to avoid duplicate popups.
         /// </summary>
         public abstract void PopupClient(string? message, EntityUid uid, EntityUid? recipient, PopupType type = PopupType.Small);
 
+        /// <summary>
+        /// Variant of <see cref="PopupCoordinates(string, EntityCoordinates, PopupType)"/> that only runs on the client, outside of prediction.
+        /// Useful for shared code that is always ran by both sides to avoid duplicate popups.
+        /// </summary>
+        public abstract void PopupClient(string? message, EntityCoordinates coordinates, EntityUid? recipient, PopupType type = PopupType.Small);
+
         /// <summary>
         /// Variant of <see cref="PopupEntity(string, EntityUid, EntityUid, PopupType)"/> for use with prediction. The local client will show
         /// the popup to the recipient, and the server will show it to every other player in PVS range. If recipient is null, the local client