#include "../../sdk/interfaces/interfaces.hpp"
#include "world.hpp"

#include "../../utils/color.h"

void SkyBox(C_EnvSky* eSky)
{
	eSky->m_vTintColorLightingOnly() = Color_t(0, 0, 0, 255);
	eSky->m_vTintColor() = Color_t(0, 0, 0, 255);
}

void world::SkyBoxChanger()
{
	for (int i = 64; i < interfaces::pGameResourceService->GetGameEntitySystem()->GetHighestEntityIndex(); i++) {

		CEntityInstance* cEnt = (CEntityInstance*)interfaces::pGameResourceService->GetGameEntitySystem()->GetBaseEntity(i);

		if (cEnt == nullptr) {
			continue;
		}

		CEntityIdentity* pEntity = cEnt->m_pEntity();

		if (!pEntity) {
			continue;
		}

		if (!pEntity->m_designerName()) {
			continue;
		}
		std::string classname;
		classname = pEntity->m_designerName();

		if (classname == "env_sky") {
			C_EnvSky* SkyEntity = interfaces::pGameResourceService->GetGameEntitySystem()->GetBaseEntity<C_EnvSky>(i);
			if (world::skybox)
				SkyBox(SkyEntity);
		}
	}
}