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;
|
2023-08-30 21:46:11 -07:00
|
|
|
using Content.Shared.Mind;
|
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
|
|
|
{
|
2023-08-28 16:53:24 -07:00
|
|
|
private readonly EntityUid _mindId;
|
|
|
|
|
private readonly MindComponent _mind;
|
2022-08-04 00:05:17 -04:00
|
|
|
private readonly CloningSystem _cloningSystem;
|
2021-01-03 17:20:17 +01:00
|
|
|
|
2023-08-28 16:53:24 -07:00
|
|
|
public AcceptCloningEui(EntityUid mindId, MindComponent mind, CloningSystem cloningSys)
|
2021-01-03 17:20:17 +01:00
|
|
|
{
|
2023-08-28 16:53:24 -07:00
|
|
|
_mindId = mindId;
|
2021-05-11 16:16:08 -07:00
|
|
|
_mind = mind;
|
2022-08-04 00:05:17 -04:00
|
|
|
_cloningSystem = cloningSys;
|
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 ||
|
2022-08-04 00:05:17 -04:00
|
|
|
choice.Button == AcceptCloningUiButton.Deny)
|
2021-01-03 17:20:17 +01:00
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-28 16:53:24 -07:00
|
|
|
_cloningSystem.TransferMindToClone(_mindId, _mind);
|
2021-01-03 17:20:17 +01:00
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|