2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Verbs;
|
2020-10-26 11:31:27 +01:00
|
|
|
|
using Robust.Server.Console;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-26 11:31:27 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Server.Transform.Verbs
|
2020-10-26 11:31:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
[GlobalVerb]
|
|
|
|
|
|
public class AttachToSelf : GlobalVerb
|
|
|
|
|
|
{
|
|
|
|
|
|
public override void GetData(IEntity user, IEntity target, VerbData data)
|
|
|
|
|
|
{
|
|
|
|
|
|
data.Visibility = VerbVisibility.Invisible;
|
|
|
|
|
|
|
|
|
|
|
|
if (user == target)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-05-12 13:42:18 +02:00
|
|
|
|
if (!user.TryGetComponent(out ActorComponent? actor))
|
2020-10-26 11:31:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
2021-05-12 13:42:18 +02:00
|
|
|
|
if (!groupController.CanCommand(actor.PlayerSession, "attachtoself"))
|
2020-10-26 11:31:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data.Visibility = VerbVisibility.Visible;
|
|
|
|
|
|
data.Text = Loc.GetString("Attach to self");
|
|
|
|
|
|
data.CategoryData = VerbCategories.Debug;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Activate(IEntity user, IEntity target)
|
|
|
|
|
|
{
|
2021-05-12 13:42:18 +02:00
|
|
|
|
if (!user.TryGetComponent(out ActorComponent? actor))
|
2020-10-26 11:31:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
2021-05-12 13:42:18 +02:00
|
|
|
|
if (!groupController.CanCommand(actor.PlayerSession, "attachtoself"))
|
2020-10-26 11:31:27 +01:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
target.Transform.AttachParent(user);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|