Rework Identifier Overrides to prevent showing Law Priority (#26680)

Does-The-Fix

Co-authored-by: Mephisto72 <Mephisto.Respectator@proton.me>
(cherry picked from commit ad0f046f0c66ff0bbbb1f655fef237ef73703cb1)
This commit is contained in:
Mephisto72 2024-04-05 04:48:24 +02:00 committed by NullWanderer
parent aa1a9b22da
commit 78751ead94
No known key found for this signature in database
GPG Key ID: 65CF92BD1D26F4AC
1 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,4 @@
using System.Linq;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Silicons.Laws;
using Content.Server.Station.Components;
@ -143,6 +144,24 @@ public sealed class IonStormRule : StationEventSystem<IonStormRuleComponent>
});
}
// sets all unobfuscated laws' indentifier in order from highest to lowest priority
// This could technically override the Obfuscation from the code above, but it seems unlikely enough to basically never happen
int orderDeduction = -1;
for (int i = 0; i < laws.Laws.Count; i++)
{
string notNullIdentifier = laws.Laws[i].LawIdentifierOverride ?? (i - orderDeduction).ToString();
if (notNullIdentifier.Any(char.IsSymbol))
{
orderDeduction += 1;
}
else
{
laws.Laws[i].LawIdentifierOverride = (i - orderDeduction).ToString();
}
}
_adminLogger.Add(LogType.Mind, LogImpact.High, $"{ToPrettyString(ent):silicon} had its laws changed by an ion storm to {laws.LoggingString()}");
// laws unique to this silicon, dont use station laws anymore