using System.Numerics; using Content.Server.Physics.Controllers; namespace Content.Server.Physics.Components; /// /// A component which makes its entity move around at random. /// [RegisterComponent] public sealed partial class RandomWalkComponent : Component { /// /// The minimum speed at which this entity will move. /// [DataField("minSpeed")] [ViewVariables(VVAccess.ReadWrite)] public float MinSpeed = 7.5f; /// /// The maximum speed at which this entity will move. /// [DataField("maxSpeed")] [ViewVariables(VVAccess.ReadWrite)] public float MaxSpeed = 10f; /// /// The amount of speed carried over when the speed updates. /// [DataField("accumulatorRatio")] [ViewVariables(VVAccess.ReadWrite)] public float AccumulatorRatio = 0.0f; /// /// The vector by which the random walk direction is biased. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public Vector2 BiasVector = new Vector2(0f, 0f); /// /// Whether to set BiasVector to (0, 0) every random walk update. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public bool ResetBiasOnWalk = true; /// /// Whether this random walker should take a step immediately when it starts up. /// [DataField("stepOnStartup")] [ViewVariables(VVAccess.ReadOnly)] public bool StepOnStartup = false; #region Update Timing /// /// The minimum amount of time between speed updates. /// [DataField("minStepCooldown")] [ViewVariables(VVAccess.ReadWrite)] public TimeSpan MinStepCooldown { get; internal set; } = TimeSpan.FromSeconds(2.0); /// /// The maximum amount of time between speed updates. /// [DataField("maxStepCooldown")] [ViewVariables(VVAccess.ReadWrite)] public TimeSpan MaxStepCooldown { get; internal set; } = TimeSpan.FromSeconds(5.0); /// /// The next time this should update its speed. /// [ViewVariables(VVAccess.ReadWrite)] [Access(typeof(RandomWalkController))] public TimeSpan NextStepTime { get; internal set; } = default!; #endregion Update Timing }