]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add InteractUsing admin logs. (#29514)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Thu, 27 Jun 2024 14:58:42 +0000 (16:58 +0200)
committerGitHub <noreply@github.com>
Thu, 27 Jun 2024 14:58:42 +0000 (16:58 +0200)
Apparently we did not have these.

Content.Shared.Database/LogType.cs
Content.Shared/Interaction/SharedInteractionSystem.cs

index 33a5d30c6a9a033e2536b2d7c83757d70577d972..eb2b8e1f6f9e6be7faf36ebf119c24b4187c6b12 100644 (file)
@@ -105,4 +105,9 @@ public enum LogType
     /// This is a default value used by <c>PlayerRateLimitManager</c>, though users can use different log types.
     /// </remarks>
     RateLimited = 91,
+
+    /// <summary>
+    /// A player did an item-use interaction of an item they were holding onto another object.
+    /// </summary>
+    InteractUsing = 92,
 }
index 1e4c49211f566f35d04da554b0e7a9560f880238..48076ca360fffdb5d70f312287a31c92909925ea 100644 (file)
@@ -486,6 +486,21 @@ namespace Content.Shared.Interaction
         public void InteractUsingRanged(EntityUid user, EntityUid used, EntityUid? target,
             EntityCoordinates clickLocation, bool inRangeUnobstructed)
         {
+            if (target != null)
+            {
+                _adminLogger.Add(
+                    LogType.InteractUsing,
+                    LogImpact.Low,
+                    $"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target} using {ToPrettyString(used):used}");
+            }
+            else
+            {
+                _adminLogger.Add(
+                    LogType.InteractUsing,
+                    LogImpact.Low,
+                    $"{ToPrettyString(user):user} interacted with *nothing* using {ToPrettyString(used):used}");
+            }
+
             if (RangedInteractDoBefore(user, used, target, clickLocation, inRangeUnobstructed))
                 return;
 
@@ -926,6 +941,11 @@ namespace Content.Shared.Interaction
             if (checkCanUse && !_actionBlockerSystem.CanUseHeldEntity(user, used))
                 return;
 
+            _adminLogger.Add(
+                LogType.InteractUsing,
+                LogImpact.Low,
+                $"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target} using {ToPrettyString(used):used}");
+
             if (RangedInteractDoBefore(user, used, target, clickLocation, true))
                 return;