2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Mind.Components;
|
|
|
|
|
using Content.Shared.Verbs;
|
2021-02-16 09:51:27 +01:00
|
|
|
using Robust.Server.Console;
|
|
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Ghost.Roles
|
2021-02-16 09:51:27 +01:00
|
|
|
{
|
|
|
|
|
[GlobalVerb]
|
|
|
|
|
public class MakeGhostRoleVerb : GlobalVerb
|
|
|
|
|
{
|
|
|
|
|
public override bool RequireInteractionRange => false;
|
|
|
|
|
public override bool BlockedByContainers => false;
|
|
|
|
|
|
|
|
|
|
public override void GetData(IEntity user, IEntity target, VerbData data)
|
|
|
|
|
{
|
|
|
|
|
data.Visibility = VerbVisibility.Invisible;
|
|
|
|
|
|
|
|
|
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
|
|
|
|
|
|
|
|
|
if (target.TryGetComponent(out MindComponent? mind) &&
|
|
|
|
|
mind.HasMind)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-12 13:42:18 +02:00
|
|
|
if (!user.TryGetComponent(out ActorComponent? actor) ||
|
|
|
|
|
!groupController.CanCommand(actor.PlayerSession, "makeghostrole"))
|
2021-02-16 09:51:27 +01:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.Visibility = VerbVisibility.Visible;
|
2021-06-21 02:13:54 +02:00
|
|
|
data.Text = Loc.GetString("make-ghost-role-verb-get-data-text");
|
2021-02-16 09:51:27 +01:00
|
|
|
data.CategoryData = VerbCategories.Debug;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Activate(IEntity user, IEntity target)
|
|
|
|
|
{
|
|
|
|
|
var groupController = IoCManager.Resolve<IConGroupController>();
|
|
|
|
|
|
|
|
|
|
if (target.TryGetComponent(out MindComponent? mind) &&
|
|
|
|
|
mind.HasMind)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-12 13:42:18 +02:00
|
|
|
if (!user.TryGetComponent(out ActorComponent? actor) ||
|
|
|
|
|
!groupController.CanCommand(actor.PlayerSession, "makeghostrole"))
|
2021-02-16 09:51:27 +01:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
|
2021-05-12 13:42:18 +02:00
|
|
|
ghostRoleSystem.OpenMakeGhostRoleEui(actor.PlayerSession, target.Uid);
|
2021-02-16 09:51:27 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|