Files
crystall-punk-14/Content.Server/Interaction/InRangeUnoccludedVerb.cs

59 lines
1.8 KiB
C#
Raw Normal View History

using Content.Shared.Interaction.Helpers;
2021-06-09 22:19:39 +02:00
using Content.Shared.Notification;
using Content.Shared.Notification.Managers;
2021-06-09 22:19:39 +02:00
using Content.Shared.Verbs;
2020-10-28 15:03:21 +01:00
using Robust.Server.Console;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
2020-10-28 15:03:21 +01:00
using Robust.Shared.IoC;
using Robust.Shared.Localization;
2021-06-09 22:19:39 +02:00
namespace Content.Server.Interaction
2020-10-28 15:03:21 +01:00
{
[GlobalVerb]
public class InRangeUnoccludedVerb : GlobalVerb
{
public override bool RequireInteractionRange => false;
public override void GetData(IEntity user, IEntity target, VerbData data)
{
data.Visibility = VerbVisibility.Invisible;
if (!user.TryGetComponent(out ActorComponent? actor))
2020-10-28 15:03:21 +01:00
{
return;
}
var groupController = IoCManager.Resolve<IConGroupController>();
if (!groupController.CanCommand(actor.PlayerSession, "inrangeunoccluded"))
2020-10-28 15:03:21 +01:00
{
return;
}
data.Visibility = VerbVisibility.Visible;
data.Text = Loc.GetString("in-range-unoccluded-verb-get-data-text");
2020-10-28 15:03:21 +01:00
data.CategoryData = VerbCategories.Debug;
}
public override void Activate(IEntity user, IEntity target)
{
if (!user.TryGetComponent(out ActorComponent? actor))
2020-10-28 15:03:21 +01:00
{
return;
}
var groupController = IoCManager.Resolve<IConGroupController>();
if (!groupController.CanCommand(actor.PlayerSession, "inrangeunoccluded"))
2020-10-28 15:03:21 +01:00
{
return;
}
var message = user.InRangeUnOccluded(target)
? Loc.GetString("in-range-unoccluded-verb-on-activate-not-occluded")
: Loc.GetString("in-range-unoccluded-verb-on-activate-occluded");
2020-10-28 15:03:21 +01:00
target.PopupMessage(user, message);
}
}
}