using Content.Server.EntityEffects.Effects.Smite; using Content.Server.Physics.Controllers; using Content.Server.Weapons.Ranged.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Server.Physics.Components; /// /// A component which makes its entity chasing entity with selected component. /// [RegisterComponent, Access(typeof(ChasingWalkSystem), typeof(HomingRodEntityEffectSystem), typeof(GunSystem)), AutoGenerateComponentPause] public sealed partial class ChasingWalkComponent : Component { /// /// The next moment in time when the entity is pushed toward its goal /// [DataField, ViewVariables(VVAccess.ReadWrite)] [AutoPausedField] public TimeSpan NextImpulseTime; /// /// Push-to-target frequency. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float ImpulseInterval = 2f; /// /// The max angle the entity can turn each impulse /// [DataField] public Angle MaxAngleVectorChangePerImpulse = Angle.FromDegrees(180); /// /// The minimum speed at which this entity will move. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float MinSpeed = 1.5f; /// /// The maximum speed at which this entity will move. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float MaxSpeed = 3f; /// /// The current speed. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float Speed; /// /// If the entity should stop moving if they are already on top of the target /// [DataField] public bool StopAtTarget = true; /// /// The minimum time interval in which an object can change its motion target. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float ChangeVectorMinInterval = 5f; /// /// The maximum time interval in which an object can change its motion target. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float ChangeVectorMaxInterval = 25f; /// /// The next change of direction time. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] [AutoPausedField] public TimeSpan NextChangeVectorTime; /// /// List of components used to select a target to chase. /// [DataField] public ComponentRegistry ChasingComponent = []; /// /// The maximum radius in which the entity chooses the target component to follow /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float MaxChaseRadius = 25; /// /// The entity uid that is being chased. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public EntityUid? ChasingEntity; /// /// whether the entity should point in the direction its moving /// [DataField] public bool RotateWithImpulse; /// /// Sprite rotation offset. /// [DataField] public Angle RotationAngleOffset = Angle.Zero; }