HOTFIX Add logging to gamepreset fallback (#41522)
* Add logging to gamepreset fallback * cleanup
This commit is contained in:
@@ -35,6 +35,7 @@ public sealed partial class GameTicker
|
||||
|
||||
private bool StartPreset(ICommonSession[] origReadyPlayers, bool force)
|
||||
{
|
||||
_sawmill.Info($"Attempting to start preset '{CurrentPreset?.ID}'");
|
||||
var startAttempt = new RoundStartAttemptEvent(origReadyPlayers, force);
|
||||
RaiseLocalEvent(startAttempt);
|
||||
|
||||
@@ -56,9 +57,12 @@ public sealed partial class GameTicker
|
||||
var fallbackPresets = _cfg.GetCVar(CCVars.GameLobbyFallbackPreset).Split(",");
|
||||
var startFailed = true;
|
||||
|
||||
_sawmill.Info($"Fallback - Failed to start round, attempting to start fallback presets.");
|
||||
foreach (var preset in fallbackPresets)
|
||||
{
|
||||
_sawmill.Info($"Fallback - Clearing up gamerules");
|
||||
ClearGameRules();
|
||||
_sawmill.Info($"Fallback - Attempting to start '{preset}'");
|
||||
SetGamePreset(preset, resetDelay: 1);
|
||||
AddGamePresetRules();
|
||||
StartGamePresetRules();
|
||||
@@ -76,6 +80,7 @@ public sealed partial class GameTicker
|
||||
startFailed = false;
|
||||
break;
|
||||
}
|
||||
_sawmill.Info($"Fallback - '{preset}' failed to start.");
|
||||
}
|
||||
|
||||
if (startFailed)
|
||||
@@ -87,6 +92,7 @@ public sealed partial class GameTicker
|
||||
|
||||
else
|
||||
{
|
||||
_sawmill.Info($"Fallback - Failed to start preset but fallbacks are disabled. Returning to Lobby.");
|
||||
FailedPresetRestart();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
|
||||
while (query.MoveNext(out var uid, out _, out var gameRule))
|
||||
{
|
||||
var minPlayers = gameRule.MinPlayers;
|
||||
var name = ToPrettyString(uid);
|
||||
|
||||
if (args.Players.Length >= minPlayers)
|
||||
continue;
|
||||
|
||||
@@ -46,8 +48,10 @@ public abstract partial class GameRuleSystem<T> : EntitySystem where T : ICompon
|
||||
ChatManager.SendAdminAnnouncement(Loc.GetString("preset-not-enough-ready-players",
|
||||
("readyPlayersCount", args.Players.Length),
|
||||
("minimumPlayers", minPlayers),
|
||||
("presetName", ToPrettyString(uid))));
|
||||
("presetName", name)));
|
||||
args.Cancel();
|
||||
//TODO remove this once announcements are logged
|
||||
Log.Info($"Rule '{name}' requires {minPlayers} players, but only {args.Players.Length} are ready.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user