"New player" admin logging improvements (#35961)

* Initial commit

* Adjust a whoooole bunch of logs

* Also spears

* Track going crit

* Review fix

* Review fixes
This commit is contained in:
SlamBamActionman
2025-03-20 20:56:51 +01:00
committed by GitHub
parent 07a8a02522
commit 43d08100b9
47 changed files with 249 additions and 97 deletions

View File

@@ -21,6 +21,8 @@ using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using System.Linq;
using Content.Shared.Humanoid;
using Robust.Shared.Player;
namespace Content.Server.Destructible
{
@@ -61,9 +63,12 @@ namespace Content.Server.Destructible
{
RaiseLocalEvent(uid, new DamageThresholdReached(component, threshold), true);
var logImpact = LogImpact.Low;
// Convert behaviors into string for logs
var triggeredBehaviors = string.Join(", ", threshold.Behaviors.Select(b =>
{
if (logImpact <= b.Impact)
logImpact = b.Impact;
if (b is DoActsBehavior doActsBehavior)
{
return $"{b.GetType().Name}:{doActsBehavior.Acts.ToString()}";
@@ -71,14 +76,20 @@ namespace Content.Server.Destructible
return b.GetType().Name;
}));
// If it doesn't have a humanoid component, it's probably not particularly notable?
if (logImpact > LogImpact.Medium && !HasComp<HumanoidAppearanceComponent>(uid))
logImpact = LogImpact.Medium;
if (args.Origin != null)
{
_adminLogger.Add(LogType.Damaged, LogImpact.Medium,
_adminLogger.Add(LogType.Damaged,
logImpact,
$"{ToPrettyString(args.Origin.Value):actor} caused {ToPrettyString(uid):subject} to trigger [{triggeredBehaviors}]");
}
else
{
_adminLogger.Add(LogType.Damaged, LogImpact.Medium,
_adminLogger.Add(LogType.Damaged,
logImpact,
$"Unknown damage source caused {ToPrettyString(uid):subject} to trigger [{triggeredBehaviors}]");
}