diff --git a/Content.Server/GlobalVerbs/AttachToGrandparentVerb.cs b/Content.Server/GlobalVerbs/AttachToGrandparentVerb.cs new file mode 100644 index 0000000000..fc65d18d8c --- /dev/null +++ b/Content.Server/GlobalVerbs/AttachToGrandparentVerb.cs @@ -0,0 +1,55 @@ +using Content.Shared.GameObjects.Verbs; +using Content.Shared.Utility; +using Robust.Server.Console; +using Robust.Server.Interfaces.GameObjects; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.IoC; +using Robust.Shared.Localization; + +namespace Content.Server.GlobalVerbs +{ + [GlobalVerb] + public class AttachToGrandparentVerb : 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(); + if (!groupController.CanCommand(actor.playerSession, "attachtograndparent")) + { + 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(); + if (!groupController.CanCommand(actor.playerSession, "attachtograndparent")) + { + return; + } + + target.Transform.AttachToGrandparent(); + } + } +} diff --git a/Content.Server/GlobalVerbs/AttachToGridVerb.cs b/Content.Server/GlobalVerbs/AttachToGridVerb.cs new file mode 100644 index 0000000000..932597c2ba --- /dev/null +++ b/Content.Server/GlobalVerbs/AttachToGridVerb.cs @@ -0,0 +1,54 @@ +using Content.Shared.GameObjects.Verbs; +using Robust.Server.Console; +using Robust.Server.Interfaces.GameObjects; +using Robust.Shared.Interfaces.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(); + 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(); + if (!groupController.CanCommand(actor.playerSession, "attachtogrid")) + { + return; + } + + target.Transform.AttachToGridOrMap(); + } + } +} diff --git a/Content.Server/GlobalVerbs/AttachToSelf.cs b/Content.Server/GlobalVerbs/AttachToSelf.cs new file mode 100644 index 0000000000..d0bfab494b --- /dev/null +++ b/Content.Server/GlobalVerbs/AttachToSelf.cs @@ -0,0 +1,54 @@ +using Content.Shared.GameObjects.Verbs; +using Robust.Server.Console; +using Robust.Server.Interfaces.GameObjects; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.IoC; +using Robust.Shared.Localization; + +namespace Content.Server.GlobalVerbs +{ + [GlobalVerb] + public class AttachToSelf : 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(); + if (!groupController.CanCommand(actor.playerSession, "attachtoself")) + { + return; + } + + data.Visibility = VerbVisibility.Visible; + data.Text = Loc.GetString("Attach to self"); + data.CategoryData = VerbCategories.Debug; + } + + public override void Activate(IEntity user, IEntity target) + { + if (!user.TryGetComponent(out IActorComponent actor)) + { + return; + } + + var groupController = IoCManager.Resolve(); + if (!groupController.CanCommand(actor.playerSession, "attachtoself")) + { + return; + } + + target.Transform.AttachParent(user); + } + } +} diff --git a/Resources/Groups/groups.yml b/Resources/Groups/groups.yml index 7bc5bc55da..0ce7ef1073 100644 --- a/Resources/Groups/groups.yml +++ b/Resources/Groups/groups.yml @@ -110,6 +110,9 @@ - hurt - toggledisallowlatejoin - attachbodypart + - attachtoself + - attachtogrid + - attachtograndparent CanViewVar: true CanAdminPlace: true CanAdminMenu: true @@ -213,6 +216,9 @@ - hurt - toggledisallowlatejoin - attachbodypart + - attachtoself + - attachtogrid + - attachtograndparent CanViewVar: true CanAdminPlace: true CanScript: true