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:
@@ -164,7 +164,11 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
|||||||
!_cfg.GetCVar(CCVars.GameRoleTimers))
|
!_cfg.GetCVar(CCVars.GameRoleTimers))
|
||||||
return true;
|
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);
|
return JobRequirements.TryRequirementsMet(job, playTimes, out _, EntityManager, _prototypes);
|
||||||
}
|
}
|
||||||
@@ -175,7 +179,11 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
|||||||
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
|
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
|
||||||
return roles;
|
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>())
|
foreach (var job in _prototypes.EnumeratePrototypes<JobPrototype>())
|
||||||
{
|
{
|
||||||
@@ -202,7 +210,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
|
|||||||
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
|
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var player = _playerManager.GetSessionByUserId(userId);
|
var player = _playerManager.GetSessionById(userId);
|
||||||
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
|
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
|
||||||
{
|
{
|
||||||
// Sorry mate but your playtimes haven't loaded.
|
// Sorry mate but your playtimes haven't loaded.
|
||||||
|
|||||||
Reference in New Issue
Block a user