Fix NukeOps rule not checking for enabled before adding text to the roundend screen. (#8291)

This commit is contained in:
Vera Aguilera Puerto
2022-05-19 20:16:29 +02:00
committed by GitHub
parent 1750fb1cdc
commit 631b024c2f

View File

@@ -49,7 +49,8 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
private void OnNukeExploded(NukeExplodedEvent ev) private void OnNukeExploded(NukeExplodedEvent ev)
{ {
if (!Enabled) return; if (!Enabled)
return;
_opsWon = true; _opsWon = true;
_roundEndSystem.EndRound(); _roundEndSystem.EndRound();
@@ -57,6 +58,9 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
private void OnRoundEndText(RoundEndTextAppendEvent ev) private void OnRoundEndText(RoundEndTextAppendEvent ev)
{ {
if (!Enabled)
return;
ev.AddLine(_opsWon ? Loc.GetString("nukeops-ops-won") : Loc.GetString("nukeops-crew-won")); ev.AddLine(_opsWon ? Loc.GetString("nukeops-ops-won") : Loc.GetString("nukeops-crew-won"));
ev.AddLine(Loc.GetString("nukeops-list-start")); ev.AddLine(Loc.GetString("nukeops-list-start"));
foreach (var nukeop in _aliveNukeops) foreach (var nukeop in _aliveNukeops)
@@ -67,6 +71,9 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
private void OnMobStateChanged(MobStateChangedEvent ev) private void OnMobStateChanged(MobStateChangedEvent ev)
{ {
if (!Enabled)
return;
if (!_aliveNukeops.TryFirstOrNull(x => x.Key.OwnedEntity == ev.Entity, out var op)) return; if (!_aliveNukeops.TryFirstOrNull(x => x.Key.OwnedEntity == ev.Entity, out var op)) return;
_aliveNukeops[op.Value.Key] = op.Value.Key.CharacterDeadIC; _aliveNukeops[op.Value.Key] = op.Value.Key.CharacterDeadIC;
@@ -79,7 +86,8 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
private void OnPlayersSpawning(RulePlayerSpawningEvent ev) private void OnPlayersSpawning(RulePlayerSpawningEvent ev)
{ {
if (!Enabled) return; if (!Enabled)
return;
_aliveNukeops.Clear(); _aliveNukeops.Clear();
@@ -197,7 +205,10 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
} }
public override void Started(){ _opsWon = false; } public override void Started()
{
_opsWon = false;
}
public override void Ended(){ } public override void Ended() { }
} }