Module update for CollisionChange (#2242)

<!--
Thank you for contributing to mod-playerbots, please make sure that
you...
1. Submit your PR to the test-staging branch, not master.
2. Read the guidelines below before submitting.
3. Don't delete parts of this template.

DESIGN PHILOSOPHY: We prioritize STABILITY, PERFORMANCE, AND
PREDICTABILITY over behavioral realism.

Every action and decision executes PER BOT AND PER TRIGGER. Small
increases in logic complexity scale
poorly across thousands of bots and negatively affect all. We prioritize
a stable system over a smarter
one. Bots don't need to behave perfectly; believable behavior is the
goal, not human simulation.
Default behavior must be cheap in processing; expensive behavior must be
opt-in.

Before submitting, make sure your changes aligns with these principles.
-->

## Pull Request Description
<!-- Describe what this change does and why it is needed -->
Some code changes due to core update change from MMapFactory.h
->MapCollisionData.h


## Feature Evaluation
<!--
If your PR is very minimal (comment typo, wrong ID reference, etc), and
it is very obvious it will not have
any impact on performance, you may skip these question. If necessary, a
maintainer may ask you for them later.
-->

<!-- Please answer the following: -->
- Describe the **minimum logic** required to achieve the intended
behavior.
- Describe the **processing cost** when this logic executes across many
bots.



## How to Test the Changes
<!--
- Step-by-step instructions to test the change.
- Any required setup (e.g. multiple players, number of bots, specific
configuration).
- Expected behavior and how to verify it.
-->



## Impact Assessment
<!-- As a generic test, before and after measure of pmon (playerbot pmon
tick) can help you here. -->
- Does this change increase per-bot/per-tick processing or risk scaling
poorly with thousands of bots?
    - - [x] No, not at all
    - - [ ] Minimal impact (**explain below**)
    - - [ ] Moderate impact (**explain below**)



- Does this change modify default bot behavior?
    - - [x] No
    - - [ ] Yes (**explain why**)



- Does this change add new decision branches or increase maintenance
complexity?
    - - [x] No
    - - [ ] Yes (**explain below**)



## Messages to Translate
<!--
Bot messages have to be translatable, but you don't need to do the
translations here. You only need to make sure
the message is in a translatable format, and list in the table the
message_key and the default English message.
Search for GetBotTextOrDefault in the codebase for examples.
-->
Does this change add bot messages to translate?
    - - [x] No
    - - [ ] Yes (**list messages in the table**)

| Message key  | Default message |
| --------------- | ------------------ |
|			 |			      |
|			 |			      |

## AI Assistance
<!--
AI assistance is allowed, but all submitted code must be fully
understood, reviewed, and owned by the contributor.
We expect contributors to be honest about what they do and do not
understand.
-->
Was AI assistance used while working on this change?
    - - [ ] No
    - - [X] Yes (**explain below**)
<!--
If yes, please specify:
- Purpose of usage (e.g. brainstorming, refactoring, documentation, code
generation).
- Which parts of the change were influenced or generated, and whether it
was thoroughly reviewed.
-->
Identifying problematic areas generated by the change



## Final Checklist

- - [x] Stability is not compromised.
- - [x] Performance impact is understood, tested, and acceptable.
- - [x] Added logic complexity is justified and explained.
- - [x] Documentation updated if needed (Conf comments, WiKi commands).

## Notes for Reviewers
<!-- Anything else that's helpful to review or test your pull request.
-->
This commit is contained in:
Keleborn 2026-03-30 11:55:33 -07:00 committed by GitHub
parent 4dbcd2544c
commit 7fa9ab7d34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 19 deletions

View File

@ -8,7 +8,7 @@
#include "CellImpl.h" #include "CellImpl.h"
#include "PathGenerator.h" #include "PathGenerator.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "MMapFactory.h" #include "MapCollisionData.h"
bool MoveStuckTrigger::IsActive() bool MoveStuckTrigger::IsActive()
{ {
@ -89,8 +89,7 @@ bool MoveLongStuckTrigger::IsActive()
return true; return true;
} }
if (cell.GridX() > 0 && cell.GridY() > 0 && if (bot->GetMap()->IsGridCreated(GridCoord(cell.GridX(), cell.GridY())))
!MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(botPos.GetMapId(), cell.GridX(), cell.GridY()))
{ {
// LOG_INFO("playerbots", "Bot {} {}:{} <{}> was in unloaded grid {},{} on map {}", // LOG_INFO("playerbots", "Bot {} {}:{} <{}> was in unloaded grid {},{} on map {}",
// bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), // bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),

View File

@ -14,7 +14,7 @@
#include "TravelNode.h" #include "TravelNode.h"
#include "Talentspec.h" #include "Talentspec.h"
#include "ChatHelper.h" #include "ChatHelper.h"
#include "MMapFactory.h" #include "MapCollisionData.h"
#include "MapMgr.h" #include "MapMgr.h"
#include "PathGenerator.h" #include "PathGenerator.h"
#include "Playerbots.h" #include "Playerbots.h"
@ -687,10 +687,11 @@ std::vector<WorldPosition> WorldPosition::frommGridCoord(mGridCoord GridCoord)
return retVec; return retVec;
} }
// TODO: Cleanup — make this actually work.
void WorldPosition::loadMapAndVMap(uint32 mapId, uint8 x, uint8 y) void WorldPosition::loadMapAndVMap(uint32 mapId, uint8 x, uint8 y)
{ {
std::string const fileName = "load_map_grid.csv"; std::string const fileName = "load_map_grid.csv";
/*
if (isOverworld() && false || false) if (isOverworld() && false || false)
{ {
if (!MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(mapId, x, y)) if (!MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(mapId, x, y))
@ -745,22 +746,22 @@ void WorldPosition::loadMapAndVMap(uint32 mapId, uint8 x, uint8 y)
sPlayerbotAIConfig.log(fileName, out.str().c_str()); sPlayerbotAIConfig.log(fileName, out.str().c_str());
} }
} }
*/
if (!TravelMgr::instance().isBadMmap(mapId, x, y))
{
// load navmesh
Map* map = getMap();
if (map && map->GetMapCollisionData().LoadMMapTile(x, y) == MMAP::MMAP_LOAD_RESULT_ERROR)
TravelMgr::instance().addBadMmap(mapId, x, y);
if (!TravelMgr::instance().isBadMmap(mapId, x, y)) if (sPlayerbotAIConfig.hasLog(fileName))
{ {
// load navmesh std::ostringstream out;
if (!MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(mapId, x, y)) out << sPlayerbotAIConfig.GetTimestampStr();
TravelMgr::instance().addBadMmap(mapId, x, y); out << "+00,\"mmap\", " << x << "," << y << "," << (TravelMgr::instance().isBadMmap(mapId, x, y) ? "0" : "1")
<< ",";
if (sPlayerbotAIConfig.hasLog(fileName)) printWKT(fromGridCoord(GridCoord(x, y)), out, 1, true);
{ sPlayerbotAIConfig.log(fileName, out.str().c_str());
std::ostringstream out;
out << sPlayerbotAIConfig.GetTimestampStr();
out << "+00,\"mmap\", " << x << "," << y << "," << (TravelMgr::instance().isBadMmap(mapId, x, y) ? "0" : "1")
<< ",";
printWKT(fromGridCoord(GridCoord(x, y)), out, 1, true);
sPlayerbotAIConfig.log(fileName, out.str().c_str());
}
} }
} }
} }