Don't throw on player spawn for playtime failure (#24148)

Still gets logged but won't abort the entire startup process.
This commit is contained in:
metalgearsloth
2024-01-16 19:01:41 +11:00
committed by GitHub
parent c29896f505
commit 3b7679f9c9

View File

@@ -164,7 +164,11 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
!_cfg.GetCVar(CCVars.GameRoleTimers))
return true;
var playTimes = _tracking.GetTrackerTimes(player);
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
{
Log.Error($"Unable to check playtimes {Environment.StackTrace}");
playTimes = new Dictionary<string, TimeSpan>();
}
return JobRequirements.TryRequirementsMet(job, playTimes, out _, EntityManager, _prototypes);
}
@@ -175,7 +179,11 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
return roles;
var playTimes = _tracking.GetTrackerTimes(player);
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
{
Log.Error($"Unable to check playtimes {Environment.StackTrace}");
playTimes = new Dictionary<string, TimeSpan>();
}
foreach (var job in _prototypes.EnumeratePrototypes<JobPrototype>())
{
@@ -202,7 +210,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
return;
var player = _playerManager.GetSessionByUserId(userId);
var player = _playerManager.GetSessionById(userId);
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
{
// Sorry mate but your playtimes haven't loaded.