@@ -53,7 +53,7 @@ namespace Content.Server.Ghost
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly ISharedPlayerManager _player = default!;
|
||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
@@ -364,7 +364,7 @@ namespace Content.Server.Ghost
|
||||
|
||||
private IEnumerable<GhostWarp> GetPlayerWarps(EntityUid except)
|
||||
{
|
||||
foreach (var player in _playerManager.Sessions)
|
||||
foreach (var player in _player.Sessions)
|
||||
{
|
||||
if (player.AttachedEntity is not {Valid: true} attached)
|
||||
continue;
|
||||
@@ -484,8 +484,8 @@ namespace Content.Server.Ghost
|
||||
// However, that should rarely happen.
|
||||
if (!string.IsNullOrWhiteSpace(mind.Comp.CharacterName))
|
||||
_metaData.SetEntityName(ghost, mind.Comp.CharacterName);
|
||||
else if (!string.IsNullOrWhiteSpace(mind.Comp.Session?.Name))
|
||||
_metaData.SetEntityName(ghost, mind.Comp.Session.Name);
|
||||
else if (mind.Comp.UserId is { } userId && _player.TryGetSessionById(userId, out var session))
|
||||
_metaData.SetEntityName(ghost, session.Name);
|
||||
|
||||
if (mind.Comp.TimeOfDeath.HasValue)
|
||||
{
|
||||
@@ -530,9 +530,9 @@ namespace Content.Server.Ghost
|
||||
|
||||
if (mind.PreventGhosting && !forced)
|
||||
{
|
||||
if (mind.Session != null) // Logging is suppressed to prevent spam from ghost attempts caused by movement attempts
|
||||
if (_player.TryGetSessionById(mind.UserId, out var session)) // Logging is suppressed to prevent spam from ghost attempts caused by movement attempts
|
||||
{
|
||||
_chatManager.DispatchServerMessage(mind.Session, Loc.GetString("comp-mind-ghosting-prevented"),
|
||||
_chatManager.DispatchServerMessage(session, Loc.GetString("comp-mind-ghosting-prevented"),
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,22 @@ using Content.Server.EUI;
|
||||
using Content.Shared.Eui;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Ghost;
|
||||
|
||||
public sealed class ReturnToBodyEui : BaseEui
|
||||
{
|
||||
private readonly SharedMindSystem _mindSystem;
|
||||
private readonly ISharedPlayerManager _player;
|
||||
private readonly NetUserId? _userId;
|
||||
|
||||
private readonly MindComponent _mind;
|
||||
|
||||
public ReturnToBodyEui(MindComponent mind, SharedMindSystem mindSystem)
|
||||
public ReturnToBodyEui(MindComponent mind, SharedMindSystem mindSystem, ISharedPlayerManager player)
|
||||
{
|
||||
_mind = mind;
|
||||
_mindSystem = mindSystem;
|
||||
_player = player;
|
||||
_userId = mind.UserId;
|
||||
}
|
||||
|
||||
public override void HandleMessage(EuiMessageBase msg)
|
||||
@@ -28,7 +31,8 @@ public sealed class ReturnToBodyEui : BaseEui
|
||||
return;
|
||||
}
|
||||
|
||||
_mindSystem.UnVisit(_mind.Session);
|
||||
if (_userId is { } userId && _player.TryGetSessionById(userId, out var session))
|
||||
_mindSystem.UnVisit(session);
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user