* Update RobustToolbox * Transition direct type usages * More updates * Fix invalid use of to map * Update RobustToolbox * Fix dropping items * Rename name usages of "GridCoordinates" to "EntityCoordinates" * Revert "Update RobustToolbox" This reverts commit 9f334a17c5908ded0043a63158bb671e4aa3f346. * Revert "Update RobustToolbox" This reverts commit 3a9c8cfa3606fa501aa84407796d2ad920853a09. # Conflicts: # RobustToolbox * Fix cursed IMapGrid method usage. * GridTileLookupTest now uses EntityCoordinates Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using Content.Server.GameObjects.Components.Pointing;
|
|
using Content.Server.GameObjects.EntitySystems;
|
|
using Content.Shared.GameObjects.Verbs;
|
|
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.Coordinates, 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);
|
|
}
|
|
}
|
|
}
|