Fix pinpointer flicker (#15452)
This commit is contained in:
@@ -1,57 +1,60 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Pinpointer
|
||||
namespace Content.Shared.Pinpointer;
|
||||
|
||||
/// <summary>
|
||||
/// Displays a sprite on the item that points towards the target component.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[AutoGenerateComponentState]
|
||||
[Access(typeof(SharedPinpointerSystem))]
|
||||
public sealed partial class PinpointerComponent : Component
|
||||
{
|
||||
// TODO: Type serializer oh god
|
||||
[DataField("component")]
|
||||
public string? Component;
|
||||
|
||||
[DataField("mediumDistance"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float MediumDistance = 16f;
|
||||
|
||||
[DataField("closeDistance"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float CloseDistance = 8f;
|
||||
|
||||
[DataField("reachedDistance"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float ReachedDistance = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Displays a sprite on the item that points towards the target component.
|
||||
/// Pinpointer arrow precision in radians.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
[Access(typeof(SharedPinpointerSystem))]
|
||||
public sealed class PinpointerComponent : Component
|
||||
{
|
||||
// TODO: Type serializer oh god
|
||||
[DataField("component")]
|
||||
public string? Component;
|
||||
[DataField("precision"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public double Precision = 0.09;
|
||||
|
||||
[DataField("mediumDistance")]
|
||||
public float MediumDistance = 16f;
|
||||
[ViewVariables]
|
||||
public EntityUid? Target = null;
|
||||
|
||||
[DataField("closeDistance")]
|
||||
public float CloseDistance = 8f;
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField]
|
||||
public bool IsActive = false;
|
||||
|
||||
[DataField("reachedDistance")]
|
||||
public float ReachedDistance = 1f;
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField]
|
||||
public Angle ArrowAngle;
|
||||
|
||||
/// <summary>
|
||||
/// Pinpointer arrow precision in radians.
|
||||
/// </summary>
|
||||
[DataField("precision")]
|
||||
public double Precision = 0.09;
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField]
|
||||
public Distance DistanceToTarget = Distance.Unknown;
|
||||
|
||||
public EntityUid? Target = null;
|
||||
public bool IsActive = false;
|
||||
public Angle ArrowAngle;
|
||||
public Distance DistanceToTarget = Distance.Unknown;
|
||||
public bool HasTarget => DistanceToTarget != Distance.Unknown;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class PinpointerComponentState : ComponentState
|
||||
{
|
||||
public bool IsActive;
|
||||
public Angle ArrowAngle;
|
||||
public Distance DistanceToTarget;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum Distance : byte
|
||||
{
|
||||
Unknown,
|
||||
Reached,
|
||||
Close,
|
||||
Medium,
|
||||
Far
|
||||
}
|
||||
[ViewVariables]
|
||||
public bool HasTarget => DistanceToTarget != Distance.Unknown;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum Distance : byte
|
||||
{
|
||||
Unknown,
|
||||
Reached,
|
||||
Close,
|
||||
Medium,
|
||||
Far
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user