Refactor minds to be entities with components, make roles components (#19591)

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2023-08-28 16:53:24 -07:00
committed by GitHub
parent e0ee397af7
commit 15c0211fb2
119 changed files with 1445 additions and 1289 deletions

View File

@@ -1,6 +1,6 @@
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Players;
using Content.Server.Mind;
using Content.Server.Pointing.Components;
using Content.Server.Visible;
using Content.Shared.Bed.Sleep;
@@ -38,6 +38,7 @@ namespace Content.Server.Pointing.EntitySystems
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
[Dependency] private readonly MindSystem _minds = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f);
@@ -169,7 +170,8 @@ namespace Content.Server.Pointing.EntitySystems
// Get players that are in range and whose visibility layer matches the arrow's.
bool ViewerPredicate(IPlayerSession playerSession)
{
if (playerSession.ContentData()?.Mind?.CurrentEntity is not {Valid: true} ent ||
if (!_minds.TryGetMind(playerSession, out _, out var mind) ||
mind.CurrentEntity is not { Valid: true } ent ||
!TryComp(ent, out EyeComponent? eyeComp) ||
(eyeComp.VisibilityMask & layer) == 0)
return false;