Files
tbd-station-14/Content.Shared/Pointing/SharedPointingSystem.cs
Krunklehorn d01d75073c Travelling pointing arrows, brains can no longer point (#24864)
* Decoupled from gravity, constant animation time, manual networking, cubic interpolation

* Reduced overshoot

* Implemented PointAttemptEvent, reacts with mobstate & sleeping

* Brains can no longer point, PBs must be inside a chassis

* Removed chassis check, made callback more obvious
2024-02-03 19:09:20 +11:00

37 lines
913 B
C#

using Robust.Shared.Serialization;
using System.Numerics;
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;
[Serializable, NetSerializable]
public sealed class SharedPointingArrowComponentState : ComponentState
{
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;
}
}
public sealed class PointAttemptEvent : CancellableEntityEventArgs
{
public PointAttemptEvent(EntityUid uid)
{
Uid = uid;
}
public EntityUid Uid { get; }
}