#pragma once
#include "Mod.h"

class ServerRotations : public Mod {
public:
	float headspeed = 1.f, bodyspeed = 0.5f;
	bool whenfirst = false;
	bool bodylock = true;
	ServerRotations() : Mod(_("Server Rotations"), _("Get server rotations and adapt to client."), Category::RENDER) {
		settings.push_back(new Setting{ _("Head Speed"), &headspeed, new float(5.f), new float(0.f), 2, {}, true, 20.f});
		settings.push_back(new Setting{ _("Body Speed"), &bodyspeed, new float(5.f), new float(0.f), 2, {}, true, 20.f});
		settings.push_back(new Setting{ _("When First"), &whenfirst, 0, 0, 0, {}, true, 20.f});
		settings.push_back(new Setting{ _("Body Lock"), &bodylock, 0, 0, 0, {}, true, 20.f});
	
		enabled = true;
		visible = false;
	}

private:
	glm::vec2 mRotationDegree = glm::vec2(), mRotationDegreePrevious = glm::vec2();
	float _pitch = 0.f, _yaw = 0.f, _headyaw = 0.f;
	float __pitch = 0.f, __yaw = 0.f, __headyaw = 0.f;
	bool changedrot = false;

	int perspective_ = 0;
	virtual auto onViewPerspectiveAfter(int* perspective) -> void override;
	virtual auto onRenderActorBefore(Actor* actor, glm::vec3* camera, glm::vec3* position) -> void override;
	virtual auto onRenderActorAfter(Actor* actor) -> void override;
	virtual auto onInterpolatedHeadYaw(Player* _this, float* yaw) -> void override;
	virtual auto onInterpolatedBodyYaw(Player* _this, float* yaw) -> void override;
	virtual auto onPacketSendBefore2(Packet* packet) -> void override;
	virtual auto onPacketSendAfter(Packet* packet, bool* cancel) -> void override;
	virtual auto getMode() -> std::string override;
};
