2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.EUI;
|
|
|
|
|
using Content.Shared.Cloning;
|
2021-01-03 17:20:17 +01:00
|
|
|
using Content.Shared.Eui;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-01-03 17:20:17 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Cloning
|
2021-01-03 17:20:17 +01:00
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class AcceptCloningEui : BaseEui
|
2021-01-03 17:20:17 +01:00
|
|
|
{
|
2021-06-09 22:19:39 +02:00
|
|
|
private readonly Mind.Mind _mind;
|
2021-01-03 17:20:17 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
public AcceptCloningEui(Mind.Mind mind)
|
2021-01-03 17:20:17 +01:00
|
|
|
{
|
2021-05-11 16:16:08 -07:00
|
|
|
_mind = mind;
|
2021-01-03 17:20:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void HandleMessage(EuiMessageBase msg)
|
|
|
|
|
{
|
|
|
|
|
base.HandleMessage(msg);
|
|
|
|
|
|
2021-05-11 16:16:08 -07:00
|
|
|
if (msg is not AcceptCloningChoiceMessage choice ||
|
|
|
|
|
choice.Button == AcceptCloningUiButton.Deny ||
|
|
|
|
|
!EntitySystem.TryGet<CloningSystem>(out var cloningSystem))
|
2021-01-03 17:20:17 +01:00
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-11 16:16:08 -07:00
|
|
|
cloningSystem.TransferMindToClone(_mind);
|
2021-01-03 17:20:17 +01:00
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|