Weapons/Base/Effects/TakeMeleeHitEffect.cs
using Sandbox.Utility;

namespace Opium;

public partial class TakeMeleeHitEffect : WeaponEffect
{
	[Property] public float Speed = 1.0f;
	[Property] public float Size = 1.0f;

	[Property] public Angles WindupAngles { get; set; }
	[Property] public Curve WindupCurve { get; set; }
	[Property] public Curve FOVCurve { get; set; }
	[Property] public float FOVOffset { get; set; } = 10;

	public bool Ping { get; set; }

	public override bool TickEffect()
	{
		var delta = Delta;
		delta = Easing.EaseOut( delta );

		Vector3 rand = Vector3.Random;
		rand.z = 0;
		rand = rand.Normal;

		var rotation = Player.MainCamera.Transform.Rotation;
		Player.CameraPositionOffset += (rotation.Right * rand.x + rotation.Up * rand.y) * (1 - delta) * Size;

		var windupDelta = WindupCurve.Evaluate( Delta );

		Player.CameraRotationOffset *= Rotation.From( WindupAngles.pitch * windupDelta, WindupAngles.yaw * windupDelta, WindupAngles.roll * windupDelta ); ;

		Player.FieldOfViewOffset += FOVCurve.Evaluate( Delta ) * FOVOffset;

		return base.TickEffect();
	}
}