Files
tbd-station-14/Content.Server/GlobalVerbs/PointingVerb.cs
DrSmugleaf 245dbdaa3a Add pointing (#1435)
* Add pointing keybind and simple message

* Add turning the player when pointing

* Add pointing arrow

* Make the popup message appear on the pointing entity

* Add pointing to tiles and space and proper grammar

* Move pointing bind from HandsSystem to PointingSystem

* Add more messages for pointing depending on the viewer perspective

* Fix non nullable reference type

* Serialize pointing arrow duration

* Serialize pointing arrow step and add summaries

* Make arrow speed serializable and make it depend on frame time

* Add 0.2 second delay between pointings

* Add pointing arrow yaml examples

* Add the ability for pointing arrows to be rogue

* Remove rogue package reference

* Add point to verb

https://cdn.discordapp.com/attachments/313107470031650816/735268651636228197/unknown.png

* Add shift middle clicking an entity in the verb menu to point at it

* Add VV to PointingArrowComponent

* Increase pointing delay from 0.2 to 0.5 seconds

* Address reviews

* Fix nullability errors

* Separate pointing and rogue pointing code

* Fix rogue pointing arrow visuals

* Made rogue pointing arrow rotation adjustment readable for mortals

* Make rogue pointing arrows less destructive

* Cleanup more of the rogue pointing arrow code
2020-07-24 14:51:18 +02:00

54 lines
1.5 KiB
C#

using Content.Server.GameObjects.Components.Pointing;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.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.Transform.GridPosition, target.Transform.GridPosition))
{
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.GridPosition, target.Uid);
}
}
}