Files
Radicade/2023Patch/RadicadePatch/LogNoiseRules.cs
T
2026-10-16 23:33:13 -07:00

43 lines
1.3 KiB
C#

using System;
using System.Threading;
/// <summary>
/// Log lines the client prints on every room load that say nothing a player can
/// act on and bury the lines that matter. Pure rules only, so they can be
/// exercised outside the game.
/// </summary>
internal static class LogNoiseRules
{
private static readonly string[] Noise =
{
// Every chair and couch the dorm/Rec Center spawns complains that its
// RigidbodyEx has no entity component - dozens of lines per room load,
// all identical in substance.
"has an RigidbodyEx but no",
// TMP asks for an underline glyph the legacy Diggity font does not carry;
// the text renders fine without it.
"The character used for Underline is not available in font asset",
};
private static int _dropped;
internal static int PatternCount => Noise.Length;
internal static int DroppedCount => Volatile.Read(ref _dropped);
internal static bool ShouldDrop(string message)
{
if (string.IsNullOrEmpty(message)) return false;
foreach (var pattern in Noise)
{
if (message.IndexOf(pattern, StringComparison.OrdinalIgnoreCase) < 0) continue;
Interlocked.Increment(ref _dropped);
return true;
}
return false;
}
}