something (#154)

* don`t notify if not ic channels

* allow all jobs to admin

* and i can give it all to you BABY

* fix cringers

* нерф лично для виктории мяукиной

* some tweaks + wonderbox update
This commit is contained in:
rhailrake
2023-06-07 22:06:21 +06:00
committed by Aviu00
parent 11c26811fa
commit 65a471cda8
9 changed files with 4035 additions and 3472 deletions

View File

@@ -1,4 +1,5 @@
using System.Linq;
using Content.Server.Administration.Managers;
using Content.Server.Afk;
using Content.Server.Afk.Events;
using Content.Server.GameTicking;
@@ -31,6 +32,7 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly MindSystem _minds = default!;
[Dependency] private readonly PlayTimeTrackingManager _tracking = default!;
[Dependency] private readonly IAdminManager _adminManager = default!;
public override void Initialize()
{
@@ -157,8 +159,16 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
_tracking.QueueSendTimers(ev.PlayerSession);
}
private bool IsBypassingChecks(ICommonSession player)
{
return _adminManager.IsAdmin(player, true);
}
public bool IsAllowed(ICommonSession player, string role)
{
if (IsBypassingChecks(player))
return true;
if (!_prototypes.TryIndex<JobPrototype>(role, out var job) ||
job.Requirements == null ||
!_cfg.GetCVar(CCVars.GameRoleTimers))
@@ -172,6 +182,10 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
public HashSet<string> GetDisallowedJobs(ICommonSession player)
{
var roles = new HashSet<string>();
if (IsBypassingChecks(player))
return roles;
if (!_cfg.GetCVar(CCVars.GameRoleTimers))
return roles;
@@ -203,6 +217,10 @@ public sealed class PlayTimeTrackingSystem : EntitySystem
return;
var player = _playerManager.GetSessionByUserId(userId);
if (IsBypassingChecks(player))
return;
if (!_tracking.TryGetTrackerTimes(player, out var playTimes))
{
// Sorry mate but your playtimes haven't loaded.