perks/CurseRotateAim.cs

A Perk class named CurseRotateAim that applies a continuous rotation to the player's aiming direction. When active it enables updates and subtracts a small angle from Player.BodyAimOffset every frame, and it resets the offset to zero on removal.

using Sandbox;

[Perk( Rarity.Unique, curse: true, disabled: true, alwaysOfferDebug: false )]
public class CurseRotateAim : Perk
{
	private const float RotateDegreesPerSecond = 10f;

	//static CurseRotateAim()
	//{
	//	Register<CurseRotateAim>(
	//		name: "Dizzy",
	//		imagePath: "textures/icons/vector/blank_icon.png",
	//		description: level => $"Your facing direction continuously rotates"
	//	);
	//}

	public override void Start()
	{
		base.Start();
		ShouldUpdate = true;
	}

	public override void Update( float dt )
	{
		base.Update( dt );
		Player.BodyAimOffset -= RotateDegreesPerSecond * Player.TimeScale * dt;
	}

	public override void Remove( bool restart = false )
	{
		base.Remove( restart );
		Player.BodyAimOffset = 0f;
	}
}