Fix some gamerules' round summary not working (#27654)
Update GameRuleSystem.cs
This commit is contained in:
@@ -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))
|
||||
var query = AllEntityQuery<T>();
|
||||
while (query.MoveNext(out var uid, out var comp))
|
||||
{
|
||||
if (!TryComp<GameRuleComponent>(uid, out var ruleData))
|
||||
return;
|
||||
AppendRoundEndText(ent, ent, ruleData, ref args);
|
||||
|
||||
AppendRoundEndText(uid, comp, ruleData, ref ev);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user