Files
OldThink/Content.Shared/Pointing/SharedPointingSystem.cs

37 lines
913 B
C#
Raw Permalink Normal View History

2022-09-17 00:37:15 +10:00
using Robust.Shared.Serialization;
using System.Numerics;
2022-09-17 00:37:15 +10:00
namespace Content.Shared.Pointing;
public abstract class SharedPointingSystem : EntitySystem
{
protected readonly TimeSpan PointDuration = TimeSpan.FromSeconds(4);
protected readonly float PointKeyTimeMove = 0.1f;
protected readonly float PointKeyTimeHover = 0.5f;
2022-09-17 00:37:15 +10:00
[Serializable, NetSerializable]
public sealed class SharedPointingArrowComponentState : ComponentState
2022-09-17 00:37:15 +10:00
{
public Vector2 StartPosition { get; init; }
public TimeSpan EndTime { get; init; }
}
public bool CanPoint(EntityUid uid)
{
var ev = new PointAttemptEvent(uid);
RaiseLocalEvent(uid, ev, true);
return !ev.Cancelled;
}
}
2022-09-17 00:37:15 +10:00
public sealed class PointAttemptEvent : CancellableEntityEventArgs
{
public PointAttemptEvent(EntityUid uid)
{
Uid = uid;
2022-09-17 00:37:15 +10:00
}
public EntityUid Uid { get; }
2022-09-17 00:37:15 +10:00
}