]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix some gamerules' round summary not working (#27654)
authorMr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>
Sat, 4 May 2024 00:03:52 +0000 (20:03 -0400)
committerGitHub <noreply@github.com>
Sat, 4 May 2024 00:03:52 +0000 (20:03 -0400)
Update GameRuleSystem.cs

Content.Server/GameTicking/Rules/GameRuleSystem.cs

index c167ae7b6c7331a2b09ee0ae21141f04ed7dd962..0ff9b3bbbba810bbc135e7d95b68239d737a5dd6 100644 (file)
@@ -26,7 +26,7 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
         SubscribeLocalEvent<T, GameRuleAddedEvent>(OnGameRuleAdded);
         SubscribeLocalEvent<T, GameRuleStartedEvent>(OnGameRuleStarted);
         SubscribeLocalEvent<T, GameRuleEndedEvent>(OnGameRuleEnded);
-        SubscribeLocalEvent<T, RoundEndTextAppendEvent>(OnRoundEndTextAppend);
+        SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndTextAppend);
     }
 
     private void OnStartAttempt(RoundStartAttemptEvent args)
@@ -70,11 +70,16 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
         Ended(uid, component, ruleData, args);
     }
 
-    private void OnRoundEndTextAppend(Entity<T> ent, ref RoundEndTextAppendEvent args)
+    private void OnRoundEndTextAppend(RoundEndTextAppendEvent ev)
     {
-        if (!TryComp<GameRuleComponent>(ent, out var ruleData))
-            return;
-        AppendRoundEndText(ent, ent, ruleData, ref args);
+        var query = AllEntityQuery<T>();
+        while (query.MoveNext(out var uid, out var comp))
+        {
+            if (!TryComp<GameRuleComponent>(uid, out var ruleData))
+                return;
+
+            AppendRoundEndText(uid, comp, ruleData, ref ev);
+        }
     }
 
     /// <summary>