using System.Numerics;
using Content.Shared.Movement.Systems;
using Robust.Shared.GameStates;
namespace Content.Shared.Movement.Components;
///
/// Handles mobs pushing against each other.
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true)]
public sealed partial class MobCollisionComponent : Component
{
// If you want to tweak the feel of the pushing use SpeedModifier and Strength.
// Strength goes both ways and affects how much the other mob is pushed by so controls static pushing a lot.
// Speed mod affects your own mob primarily.
///
/// Is this mob currently colliding? Used for SpeedModifier.
///
[DataField, AutoNetworkedField]
public bool Colliding;
// TODO: I hate this but also I couldn't quite figure out a way to avoid having to dirty it every tick.
// The issue is it's a time target that changes constantly so we can't just use a timespan.
// However that doesn't mean it should be modified every tick if we're still colliding.
///
/// Buffer time for to keep applying after the entities are no longer colliding.
/// Without this you will get jittering unless you are very specific with your values.
///
[DataField, AutoNetworkedField]
public float BufferAccumulator = SharedMobCollisionSystem.BufferTime;
///
/// The speed modifier for mobs currently pushing.
/// By setting this low you can ensure you don't have to set the push-strength too high if you can push static entities.
///
[DataField, AutoNetworkedField]
public float SpeedModifier = 1f;
[DataField, AutoNetworkedField]
public float MinimumSpeedModifier = 0.35f;
///
/// Strength of the pushback for entities. This is combined between the 2 entities being pushed.
///
[DataField, AutoNetworkedField]
public float Strength = 50f;
// Yes I know, I will deal with it if I ever refactor collision layers due to misuse.
// If anything it probably needs some assurance on mobcollisionsystem for it.
///
/// Fixture to listen to for mob collisions.
///
[DataField, AutoNetworkedField]
public string FixtureId = "flammable";
[DataField, AutoNetworkedField]
public Vector2 Direction;
}