Files
crystall-punk-14/Content.Server/GlobalVerbs/PointingVerb.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

53 lines
1.4 KiB
C#

using Content.Server.GameObjects.Components.Pointing;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
namespace Content.Server.GlobalVerbs
{
/// <summary>
/// Global verb that points at an entity.
/// </summary>
[GlobalVerb]
public class PointingVerb : GlobalVerb
{
public override bool RequireInteractionRange => false;
public override void GetData(IEntity user, IEntity target, VerbData data)
{
data.Visibility = VerbVisibility.Invisible;
if (!user.HasComponent<IActorComponent>())
{
return;
}
if (!EntitySystem.Get<PointingSystem>().InRange(user, target.Transform.Coordinates))
{
return;
}
if (target.HasComponent<PointingArrowComponent>())
{
return;
}
data.Visibility = VerbVisibility.Visible;
data.Text = Loc.GetString("Point at");
}
public override void Activate(IEntity user, IEntity target)
{
if (!user.TryGetComponent(out IActorComponent actor))
{
return;
}
EntitySystem.Get<PointingSystem>().TryPoint(actor.playerSession, target.Transform.Coordinates, target.Uid);
}
}
}