mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
fix(editor): patrol waypoint NaN guard + 10-minute wait-time cap
NaN positions in waypoints would teleport the creature to chaos coords mid-patrol. Cap wait time at 600000ms (10 min) — prevents obvious typos (e.g. 24h = 86400000) from producing a creature that effectively never moves.
This commit is contained in:
parent
604d29d375
commit
2b02ca6b58
1 changed files with 10 additions and 0 deletions
|
|
@ -190,7 +190,17 @@ bool NpcSpawner::loadFromFile(const std::string& path) {
|
|||
if (pt.is_array() && pt.size() >= 4) {
|
||||
PatrolPoint pp;
|
||||
pp.position = glm::vec3(pt[0].get<float>(), pt[1].get<float>(), pt[2].get<float>());
|
||||
// Skip waypoints with NaN/inf — would produce a path
|
||||
// that warps the creature to garbage coords.
|
||||
if (!std::isfinite(pp.position.x) || !std::isfinite(pp.position.y) ||
|
||||
!std::isfinite(pp.position.z))
|
||||
continue;
|
||||
pp.waitTimeMs = pt[3].get<uint32_t>();
|
||||
// Cap wait time at 10 minutes to keep AzerothCore
|
||||
// happy and prevent obvious data-entry typos that
|
||||
// would produce a creature that effectively never
|
||||
// moves (e.g. 24h = 86400000).
|
||||
if (pp.waitTimeMs > 600000) pp.waitTimeMs = 600000;
|
||||
s.patrolPath.push_back(pp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue