Hotfix round restart loops (#16292)
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -254,7 +254,7 @@ namespace Content.Server.GameTicking
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_sawmill.Warning($"Exception caught while trying to start the round! Restarting round...");
|
_sawmill.Error($"Exception caught while trying to start the round! Restarting round...");
|
||||||
_runtimeLog.LogException(e, nameof(GameTicker));
|
_runtimeLog.LogException(e, nameof(GameTicker));
|
||||||
_startingRound = false;
|
_startingRound = false;
|
||||||
RestartRound();
|
RestartRound();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Database;
|
using Content.Server.Database;
|
||||||
@@ -350,6 +351,19 @@ public sealed class PlayTimeTrackingManager
|
|||||||
return GetPlayTimeForTracker(id, PlayTimeTrackingShared.TrackerOverall);
|
return GetPlayTimeForTracker(id, PlayTimeTrackingShared.TrackerOverall);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TryGetTrackerTimes(IPlayerSession id, [NotNullWhen(true)] out Dictionary<string, TimeSpan>? time)
|
||||||
|
{
|
||||||
|
time = null;
|
||||||
|
|
||||||
|
if (!_playTimeData.TryGetValue(id, out var data) || !data.Initialized)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
time = data.TrackerTimes;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<string, TimeSpan> GetTrackerTimes(IPlayerSession id)
|
public Dictionary<string, TimeSpan> GetTrackerTimes(IPlayerSession id)
|
||||||
{
|
{
|
||||||
if (!_playTimeData.TryGetValue(id, out var data) || !data.Initialized)
|
if (!_playTimeData.TryGetValue(id, out var data) || !data.Initialized)
|
||||||
|
|||||||
@@ -201,7 +201,12 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var player = _playerManager.GetSessionByUserId(userId);
|
var player = _playerManager.GetSessionByUserId(userId);
|
||||||
var playTimes = _tracking.GetTrackerTimes(player);
|
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
|
||||||
|
{
|
||||||
|
// Sorry mate but your playtimes haven't loaded.
|
||||||
|
Logger.ErrorS("playtime", $"Playtimes weren't ready yet for {player} on roundstart!");
|
||||||
|
playTimes ??= new Dictionary<string, TimeSpan>();
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < jobs.Count; i++)
|
for (var i = 0; i < jobs.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user