From 45cc19f3152f1f340d56af3edeba1fb4724fc0fa Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 27 Jun 2024 16:58:42 +0200 Subject: [PATCH] Add InteractUsing admin logs. (#29514) Apparently we did not have these. --- Content.Shared.Database/LogType.cs | 5 +++++ .../Interaction/SharedInteractionSystem.cs | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Content.Shared.Database/LogType.cs b/Content.Shared.Database/LogType.cs index 33a5d30c6a..eb2b8e1f6f 100644 --- a/Content.Shared.Database/LogType.cs +++ b/Content.Shared.Database/LogType.cs @@ -105,4 +105,9 @@ public enum LogType /// This is a default value used by PlayerRateLimitManager, though users can use different log types. /// RateLimited = 91, + + /// + /// A player did an item-use interaction of an item they were holding onto another object. + /// + InteractUsing = 92, } diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 1e4c49211f..48076ca360 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -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;