]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Rework Identifier Overrides to prevent showing Law Priority (#26680)
authorMephisto72 <66994453+Mephisto72@users.noreply.github.com>
Fri, 5 Apr 2024 02:48:24 +0000 (04:48 +0200)
committerGitHub <noreply@github.com>
Fri, 5 Apr 2024 02:48:24 +0000 (22:48 -0400)
Does-The-Fix

Co-authored-by: Mephisto72 <Mephisto.Respectator@proton.me>
Content.Server/StationEvents/Events/IonStormRule.cs

index e73c9a18131f1cfdf6287ff8c2ef0f618a24ca1f..cd3cd63ae860ec9e0634ca765268c47350c63293 100644 (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