Files
crystall-punk-14/Content.Server/Ghost/ReturnToBodyEui.cs

37 lines
833 B
C#
Raw Normal View History

using Content.Server.EUI;
2023-06-18 11:33:19 -07:00
using Content.Server.Mind;
using Content.Server.Players;
using Content.Shared.Eui;
using Content.Shared.Ghost;
namespace Content.Server.Ghost;
public sealed class ReturnToBodyEui : BaseEui
{
private readonly MindSystem _mindSystem;
2023-06-18 11:33:19 -07:00
private readonly Mind.Mind _mind;
public ReturnToBodyEui(Mind.Mind mind, MindSystem mindSystem)
{
_mind = mind;
_mindSystem = mindSystem;
}
public override void HandleMessage(EuiMessageBase msg)
{
base.HandleMessage(msg);
if (msg is not ReturnToBodyMessage choice ||
!choice.Accepted)
{
Close();
return;
}
2023-06-18 11:33:19 -07:00
if (_mindSystem.TryGetSession(_mind, out var session))
_mindSystem.UnVisit(session.ContentData()!.Mind);
Close();
}
}