mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* 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
(cherry picked from commit d01d75073c)
37 lines
913 B
C#
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; }
|
|
}
|