From ad0f046f0c66ff0bbbb1f655fef237ef73703cb1 Mon Sep 17 00:00:00 2001 From: Mephisto72 <66994453+Mephisto72@users.noreply.github.com> Date: Fri, 5 Apr 2024 04:48:24 +0200 Subject: [PATCH] Rework Identifier Overrides to prevent showing Law Priority (#26680) Does-The-Fix Co-authored-by: Mephisto72 --- .../StationEvents/Events/IonStormRule.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Content.Server/StationEvents/Events/IonStormRule.cs b/Content.Server/StationEvents/Events/IonStormRule.cs index e73c9a1813..cd3cd63ae8 100644 --- a/Content.Server/StationEvents/Events/IonStormRule.cs +++ b/Content.Server/StationEvents/Events/IonStormRule.cs @@ -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 }); } + // 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 -- 2.52.0