IPlayerManager refactor (#21215)

This commit is contained in:
Leon Friedrich
2023-10-24 20:19:08 +11:00
committed by GitHub
parent c500a63ada
commit 7ba0ea2926
248 changed files with 966 additions and 1048 deletions

View File

@@ -1,4 +1,3 @@
using System.Linq;
using Content.Server.Afk.Events;
using Content.Server.GameTicking;
using Content.Shared.CCVar;
@@ -24,7 +23,7 @@ public sealed class AFKSystem : EntitySystem
private float _checkDelay;
private TimeSpan _checkTime;
private readonly HashSet<IPlayerSession> _afkPlayers = new();
private readonly HashSet<ICommonSession> _afkPlayers = new();
public override void Initialize()
{
@@ -73,11 +72,9 @@ public sealed class AFKSystem : EntitySystem
_checkTime = _timing.CurTime + TimeSpan.FromSeconds(_checkDelay);
foreach (var session in Filter.GetAllPlayers())
foreach (var pSession in Filter.GetAllPlayers())
{
if (session.Status != SessionStatus.InGame) continue;
var pSession = (IPlayerSession) session;
if (pSession.Status != SessionStatus.InGame) continue;
var isAfk = _afkManager.IsAfk(pSession);
if (isAfk && _afkPlayers.Add(pSession))