#include "Actors.h"
#include "Client.h"

#include "Utils/MoveUtils.h"

auto Hooks::Actors::callback_actorrenderdispatcher(ActorRenderDispatcher* _this, void* context, Actor* actor, glm::vec3 camera, glm::vec3 position, glm::vec2 rotation, bool a7) -> void* {
	if (actor->getRuntimeIDComponent()->mRuntimeID.rawID != Client::clientinstance->getLocalPlayer()->getRuntimeIDComponent()->mRuntimeID.rawID)
		return actor_renderdispatcher(_this, context, actor, camera, position, rotation, a7);

	glm::vec3 camera_ = camera;
	glm::vec3 position_ = position;
	for (Mod* mod : Client::modlist) {
		if (!mod->enabled && mod->onlyenabled) continue;

		mod->onRenderActorBefore(actor, &camera_, &position_);
	}

	void* before = actor_renderdispatcher(_this, context, actor, camera_, position_, rotation, a7);
	
	for (Mod* mod : Client::modlist) {
		if (!mod->enabled && mod->onlyenabled) continue;
		mod->onRenderActorAfter(actor);
	}

	return before;
}
