Fix some gamerules' round summary not working (#27654)

Update GameRuleSystem.cs
This commit is contained in:
Mr. 27
2024-05-03 20:03:52 -04:00
committed by GitHub
parent 960f268d1c
commit 6ecbf0a04c

View File

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