#include "HitBoxes.h"

auto HitBoxes::onWorldTick(Player* _this) -> void {
	auto level = _this->getLevel();
	if (!level) return;

	std::vector<Player*> list;
	level->forEachPlayer([&](Player& player) {
		if (&player != _this)
			list.push_back(&player);
		return true;
		});

	for (auto player : list) {
		if (enabled && !throughwalls && !_this->canSee(*player, ShapeType::Outline))
			continue;

		player->getAABBShapeComponent()->mBBDim.y = enabled ? (1.8f * height) : 1.8f;
		player->getAABBShapeComponent()->mBBDim.x = enabled ? (0.6f * width) : 1.8f;
	}
}

auto HitBoxes::getMode() -> std::string {
	std::stringstream ss;
	ss.precision(0);
	ss << std::fixed << height << " " << width;
	return ss.str();
}
