2023-05-02 20:10:19 -04:00
|
|
|
using Content.Server.EUI;
|
|
|
|
|
using Content.Shared.Eui;
|
|
|
|
|
using Content.Shared.Ghost;
|
2023-08-30 21:46:11 -07:00
|
|
|
using Content.Shared.Mind;
|
2023-05-02 20:10:19 -04:00
|
|
|
|
|
|
|
|
namespace Content.Server.Ghost;
|
|
|
|
|
|
|
|
|
|
public sealed class ReturnToBodyEui : BaseEui
|
|
|
|
|
{
|
2023-08-30 21:46:11 -07:00
|
|
|
private readonly SharedMindSystem _mindSystem;
|
2023-06-18 11:33:19 -07:00
|
|
|
|
2023-08-28 16:53:24 -07:00
|
|
|
private readonly MindComponent _mind;
|
2023-05-02 20:10:19 -04:00
|
|
|
|
2024-03-22 17:23:33 +09:00
|
|
|
private readonly EntityUid _mindId;
|
|
|
|
|
|
|
|
|
|
private readonly EntityUid? _transferTo;
|
|
|
|
|
|
2023-08-30 21:46:11 -07:00
|
|
|
public ReturnToBodyEui(MindComponent mind, SharedMindSystem 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
|
|
|
}
|
|
|
|
|
|
2024-03-22 17:23:33 +09:00
|
|
|
// WD START
|
|
|
|
|
public ReturnToBodyEui(MindComponent mind, SharedMindSystem mindSystem, EntityUid mindId, EntityUid? transferTo)
|
|
|
|
|
{
|
|
|
|
|
_mind = mind;
|
|
|
|
|
_mindSystem = mindSystem;
|
|
|
|
|
_mindId = mindId;
|
|
|
|
|
_transferTo = transferTo;
|
|
|
|
|
}
|
|
|
|
|
// WD END
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-22 17:23:33 +09:00
|
|
|
if (_transferTo != null) // WD
|
|
|
|
|
_mindSystem.TransferTo(_mindId, _transferTo, mind: _mind);
|
|
|
|
|
|
2023-08-28 16:53:24 -07:00
|
|
|
_mindSystem.UnVisit(_mind.Session);
|
|
|
|
|
|
2023-05-02 20:10:19 -04:00
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
}
|