2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Pointing.Components;
|
|
|
|
|
using Content.Server.Pointing.EntitySystems;
|
|
|
|
|
using Content.Shared.Verbs;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-07-24 14:51:18 +02:00
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Pointing
|
2020-07-24 14:51:18 +02:00
|
|
|
{
|
|
|
|
|
/// <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;
|
2021-03-14 14:40:01 +01:00
|
|
|
data.IconTexture = "/Textures/Interface/VerbIcons/point.svg.192dpi.png";
|
2020-07-24 14:51:18 +02:00
|
|
|
|
2021-05-12 13:42:18 +02:00
|
|
|
if (!user.HasComponent<ActorComponent>())
|
2020-07-24 14:51:18 +02:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-03 11:25:31 +01:00
|
|
|
if (!EntitySystem.Get<PointingSystem>().InRange(user, target.Transform.Coordinates))
|
2020-07-24 14:51:18 +02:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (target.HasComponent<PointingArrowComponent>())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.Visibility = VerbVisibility.Visible;
|
|
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
data.Text = Loc.GetString("pointing-verb-get-data-text");
|
2020-07-24 14:51:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Activate(IEntity user, IEntity target)
|
|
|
|
|
{
|
2021-05-12 13:42:18 +02:00
|
|
|
if (!user.TryGetComponent(out ActorComponent? actor))
|
2020-07-24 14:51:18 +02:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-12 13:42:18 +02:00
|
|
|
EntitySystem.Get<PointingSystem>().TryPoint(actor.PlayerSession, target.Transform.Coordinates, target.Uid);
|
2020-07-24 14:51:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|