Files
tbd-station-14/Content.Server/GameObjects/Components/Observer/AcceptCloningEui.cs
ShadowCommander c2d66723a3 Cloning rework (#3808)
* Fix cloning

* Fix cloning after clone dies and remove unneeded code

* Fix ignored

Co-authored-by: Silver <silvertorch5@gmail.com>
2021-05-11 16:16:08 -07:00

36 lines
937 B
C#

using Content.Server.Eui;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Mobs;
using Content.Shared.Eui;
using Content.Shared.GameObjects.Components.Observer;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Observer
{
public class AcceptCloningEui : BaseEui
{
private readonly Mind _mind;
public AcceptCloningEui(Mind mind)
{
_mind = mind;
}
public override void HandleMessage(EuiMessageBase msg)
{
base.HandleMessage(msg);
if (msg is not AcceptCloningChoiceMessage choice ||
choice.Button == AcceptCloningUiButton.Deny ||
!EntitySystem.TryGet<CloningSystem>(out var cloningSystem))
{
Close();
return;
}
cloningSystem.TransferMindToClone(_mind);
Close();
}
}
}