2023-05-02 20:10:19 -04:00
|
|
|
using Content.Server.EUI;
|
2023-06-18 11:33:19 -07:00
|
|
|
using Content.Server.Mind;
|
2023-05-02 20:10:19 -04:00
|
|
|
using Content.Server.Players;
|
|
|
|
|
using Content.Shared.Eui;
|
|
|
|
|
using Content.Shared.Ghost;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Ghost;
|
|
|
|
|
|
|
|
|
|
public sealed class ReturnToBodyEui : BaseEui
|
|
|
|
|
{
|
2023-07-27 21:13:17 +02:00
|
|
|
private readonly MindSystem _mindSystem;
|
2023-06-18 11:33:19 -07:00
|
|
|
|
2023-05-02 20:10:19 -04:00
|
|
|
private readonly Mind.Mind _mind;
|
|
|
|
|
|
2023-07-27 21:13:17 +02:00
|
|
|
public ReturnToBodyEui(Mind.Mind mind, MindSystem mindSystem)
|
2023-05-02 20:10:19 -04:00
|
|
|
{
|
|
|
|
|
_mind = mind;
|
2023-07-27 21:13:17 +02:00
|
|
|
_mindSystem = mindSystem;
|
2023-05-02 20:10:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
2023-05-02 20:10:19 -04:00
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
}
|