using Content.Shared.Alert;
using Content.Shared.Movement.Pulling.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Movement.Pulling.Components;
///
/// Specifies an entity as being able to pull another entity with
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(PullingSystem))]
public sealed partial class PullerComponent : Component
{
///
/// Next time the puller change where they are pulling the target towards.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField]
public TimeSpan NextPushTargetChange;
[DataField, AutoNetworkedField]
public TimeSpan NextPushStop;
[DataField]
public TimeSpan PushChangeCooldown = TimeSpan.FromSeconds(0.1f), PushDuration = TimeSpan.FromSeconds(5f);
// Before changing how this is updated, please see SharedPullerSystem.RefreshMovementSpeed
public float WalkSpeedModifier => Pulling == default ? 1.0f : 0.95f;
public float SprintSpeedModifier => Pulling == default ? 1.0f : 0.95f;
///
/// Entity currently being pulled/pushed if applicable.
///
[AutoNetworkedField, DataField]
public EntityUid? Pulling;
///
/// The position the entity is currently being pulled towards.
///
[AutoNetworkedField, DataField]
public EntityCoordinates? PushingTowards;
///
/// Does this entity need hands to be able to pull something?
///
[DataField]
public bool NeedsHands = true;
///
/// The maximum acceleration of pushing, in meters per second squared.
///
[DataField]
public float PushAcceleration = 0.3f;
///
/// The maximum speed to which the pulled entity may be accelerated relative to the push direction, in meters per second.
///
[DataField]
public float MaxPushSpeed = 1.2f;
///
/// The maximum distance between the puller and the point towards which the puller may attempt to pull it, in meters.
///
[DataField]
public float MaxPushRange = 2f;
[DataField]
public ProtoId PullingAlert = "Pulling";
}