mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
Reduce collision trapping and improve /unstuck
Add root, branch, thorn, moss, ivy, and other natural doodads to the no-block foliage list. /unstuck now moves the player 5 units forward instead of resetting in place.
This commit is contained in:
parent
1797388b90
commit
90cb7dbfbd
3 changed files with 19 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#include "core/application.hpp"
|
#include "core/application.hpp"
|
||||||
#include "core/coordinates.hpp"
|
#include "core/coordinates.hpp"
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
#include <cmath>
|
||||||
#include "core/spawn_presets.hpp"
|
#include "core/spawn_presets.hpp"
|
||||||
#include "core/logger.hpp"
|
#include "core/logger.hpp"
|
||||||
#include "rendering/renderer.hpp"
|
#include "rendering/renderer.hpp"
|
||||||
|
|
@ -539,14 +540,18 @@ void Application::setupUICallbacks() {
|
||||||
loadOnlineWorldTerrain(mapId, x, y, z);
|
loadOnlineWorldTerrain(mapId, x, y, z);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unstuck callback — re-run spawn search at current XY to find valid floor
|
// Unstuck callback — move 5 units forward (based on facing) and re-snap to floor
|
||||||
gameHandler->setUnstuckCallback([this]() {
|
gameHandler->setUnstuckCallback([this]() {
|
||||||
if (!renderer || !renderer->getCameraController()) return;
|
if (!renderer || !renderer->getCameraController()) return;
|
||||||
auto* cc = renderer->getCameraController();
|
auto* cc = renderer->getCameraController();
|
||||||
auto* ft = cc->getFollowTargetMutable();
|
auto* ft = cc->getFollowTargetMutable();
|
||||||
if (!ft) return;
|
if (!ft) return;
|
||||||
// Use reset() which does a full multi-radius WMO/terrain floor search
|
// Move 5 units in the direction the player is facing
|
||||||
cc->setDefaultSpawn(*ft, cc->getYaw(), cc->getPitch());
|
float yaw = cc->getYaw();
|
||||||
|
ft->x += 5.0f * std::sin(yaw);
|
||||||
|
ft->y += 5.0f * std::cos(yaw);
|
||||||
|
// Re-snap to floor at the new position
|
||||||
|
cc->setDefaultSpawn(*ft, yaw, cc->getPitch());
|
||||||
cc->reset();
|
cc->reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4014,7 +4014,7 @@ void GameHandler::useItemById(uint32_t itemId) {
|
||||||
void GameHandler::unstuck() {
|
void GameHandler::unstuck() {
|
||||||
if (unstuckCallback_) {
|
if (unstuckCallback_) {
|
||||||
unstuckCallback_();
|
unstuckCallback_();
|
||||||
addSystemChatMessage("Unstuck: position reset to floor.");
|
addSystemChatMessage("Unstuck: moved 5 units forward.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -715,7 +715,16 @@ bool M2Renderer::loadModel(const pipeline::M2Model& model, uint32_t modelId) {
|
||||||
(lowerName.find("fireflys") != std::string::npos) ||
|
(lowerName.find("fireflys") != std::string::npos) ||
|
||||||
(lowerName.find("mushroom") != std::string::npos) ||
|
(lowerName.find("mushroom") != std::string::npos) ||
|
||||||
(lowerName.find("fungus") != std::string::npos) ||
|
(lowerName.find("fungus") != std::string::npos) ||
|
||||||
(lowerName.find("toadstool") != std::string::npos);
|
(lowerName.find("toadstool") != std::string::npos) ||
|
||||||
|
(lowerName.find("root") != std::string::npos) ||
|
||||||
|
(lowerName.find("branch") != std::string::npos) ||
|
||||||
|
(lowerName.find("thorn") != std::string::npos) ||
|
||||||
|
(lowerName.find("moss") != std::string::npos) ||
|
||||||
|
(lowerName.find("ivy") != std::string::npos) ||
|
||||||
|
(lowerName.find("seaweed") != std::string::npos) ||
|
||||||
|
(lowerName.find("kelp") != std::string::npos) ||
|
||||||
|
(lowerName.find("cattail") != std::string::npos) ||
|
||||||
|
(lowerName.find("reed") != std::string::npos);
|
||||||
bool treeLike = (lowerName.find("tree") != std::string::npos);
|
bool treeLike = (lowerName.find("tree") != std::string::npos);
|
||||||
foliageOrTreeLike = (foliageName || treeLike);
|
foliageOrTreeLike = (foliageName || treeLike);
|
||||||
bool hardTreePart =
|
bool hardTreePart =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue