Files
tbd-station-14/Content.Server/Interaction/InRangeUnoccludedVerb.cs
Leon Friedrich 486dc6ca62 Add Alt-click functionality (#4497)
* Fix ItemSlot Bug

* Add Alt-use Key

* Fix TransferAmount window bug

* Alt-click functionality

* Added AltInteract verbs

* Add new verbs

* verb icons

* Changed Comments

* Change Comments

* Fix disposal verbs

* Changed Get...() to Get...OrNull()

* Changed alt-interact combat behaviour

* Update verb icons

* Inventory interact event

* Add Alt+E secondary binding

* Add alt-z keybinding

* Rename AltUse -> AltActivateItemInWorld
2021-08-21 10:20:18 -07:00

60 lines
1.9 KiB
C#

using Content.Shared.Interaction.Helpers;
using Content.Shared.Notification;
using Content.Shared.Notification.Managers;
using Content.Shared.Verbs;
using Robust.Server.Console;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Server.Interaction
{
[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))
{
return;
}
var groupController = IoCManager.Resolve<IConGroupController>();
if (!groupController.CanCommand(actor.PlayerSession, "inrangeunoccluded"))
{
return;
}
data.Visibility = VerbVisibility.Visible;
data.Text = Loc.GetString("in-range-unoccluded-verb-get-data-text");
data.IconTexture = "/Textures/Interface/VerbIcons/information.svg.192dpi.png";
data.CategoryData = VerbCategories.Debug;
}
public override void Activate(IEntity user, IEntity target)
{
if (!user.TryGetComponent(out ActorComponent? actor))
{
return;
}
var groupController = IoCManager.Resolve<IConGroupController>();
if (!groupController.CanCommand(actor.PlayerSession, "inrangeunoccluded"))
{
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");
target.PopupMessage(user, message);
}
}
}