Follow mouse rotation in combat mode (#20433)
This commit is contained in:
@@ -14,22 +14,31 @@ public sealed partial class MouseRotatorComponent : Component
|
||||
/// <summary>
|
||||
/// How much the desired angle needs to change before a predictive event is sent
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public Angle AngleTolerance = Angle.FromDegrees(5.0);
|
||||
[DataField, AutoNetworkedField]
|
||||
public Angle AngleTolerance = Angle.FromDegrees(20.0);
|
||||
|
||||
/// <summary>
|
||||
/// The angle that will be lerped to
|
||||
/// </summary>
|
||||
[AutoNetworkedField, DataField]
|
||||
[DataField, AutoNetworkedField]
|
||||
public Angle? GoalRotation;
|
||||
|
||||
/// <summary>
|
||||
/// Max degrees the entity can rotate per second
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField, AutoNetworkedField]
|
||||
public double RotationSpeed = float.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// This one is important. If this is true, <see cref="AngleTolerance"/> does not apply, and the system will
|
||||
/// use <see cref="RequestMouseRotatorRotationSimpleEvent"/> instead. In this mode, the client will only send
|
||||
/// events when an entity should snap to a different cardinal direction, rather than for every angle change.
|
||||
///
|
||||
/// This is useful for cases like humans, where what really matters is the visual sprite direction, as opposed to something
|
||||
/// like turrets or ship guns, which have finer range of movement.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool Simple4DirMode = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -41,3 +50,13 @@ public sealed class RequestMouseRotatorRotationEvent : EntityEventArgs
|
||||
{
|
||||
public Angle Rotation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simpler version of <see cref="RequestMouseRotatorRotationEvent"/> for implementations
|
||||
/// that only require snapping to 4-dir and not full angle rotation.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class RequestMouseRotatorRotationSimpleEvent : EntityEventArgs
|
||||
{
|
||||
public Direction Direction;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user