mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-27 07:59:03 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user