Files
crystall-punk-14/Content.Server/GlobalVerbs/AttachToGridVerb.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

55 lines
1.5 KiB
C#

using Content.Shared.GameObjects.Verbs;
using Robust.Server.Console;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Server.GlobalVerbs
{
[GlobalVerb]
public class AttachToGridVerb : GlobalVerb
{
public override void GetData(IEntity user, IEntity target, VerbData data)
{
data.Visibility = VerbVisibility.Invisible;
if (user == target)
{
return;
}
if (!user.TryGetComponent(out IActorComponent actor))
{
return;
}
var groupController = IoCManager.Resolve<IConGroupController>();
if (!groupController.CanCommand(actor.playerSession, "attachtogrid"))
{
return;
}
data.Visibility = VerbVisibility.Visible;
data.Text = Loc.GetString("Attach to grid");
data.CategoryData = VerbCategories.Debug;
}
public override void Activate(IEntity user, IEntity target)
{
if (!user.TryGetComponent(out IActorComponent actor))
{
return;
}
var groupController = IoCManager.Resolve<IConGroupController>();
if (!groupController.CanCommand(actor.playerSession, "attachtogrid"))
{
return;
}
target.Transform.AttachToGridOrMap();
}
}
}