Added recastnavigation support

This commit is contained in:
2026-02-06 18:07:42 +03:00
parent 0405214388
commit d4bac06d94
42 changed files with 12227 additions and 158 deletions

View File

@@ -338,15 +338,6 @@ CharacterAIModule::CharacterAIModule(flecs::world &ecs)
.interval(0.1f)
.each([this](flecs::entity town, ActionNodeList &alist,
TownAI &ai, const TownNPCs &npcs) {
for (auto it = npcs.npcs.begin(); it != npcs.npcs.end();
it++) {
const auto &npc = npcs.npcs.at(it->first);
if (ai.blackboards.find(it->first) ==
ai.blackboards.end())
continue;
ai.blackboards.at(it->first).setPosition(
npc.position);
}
Ogre::Root::getSingleton().getWorkQueue()->addTask(
[this, town, &alist, npcs, &ai]() {
{
@@ -471,6 +462,7 @@ void CharacterAIModule::buildPlans(flecs::entity town, const TownNPCs &npcs,
const auto &npc = npcs.npcs.at(it->first);
int index = it->first;
ai.plans[index] = {};
bb.query_ai();
for (const auto &goal : ai.goals)
plan_tasks.emplace_back(bb, goal,
ai.planner.get());
@@ -601,6 +593,8 @@ void CharacterAIModule::updateBlackboards(flecs::entity town,
continue;
ai.blackboards.at(it->first).index = it->first;
ai.blackboards.at(it->first).town = town;
ai.blackboards.at(it->first).setPosition(
npcs.npcs.at(it->first).position);
for (auto e : ai.memoryUpdates) {
std::string key = e.name;
auto &memory = ai.memory.at(it->first);
@@ -613,7 +607,6 @@ void CharacterAIModule::updateBlackboards(flecs::entity town,
}
auto &bb = ai.blackboards.at(it->first);
bb.updateBits(ai, ai.memory.at(it->first), it->second.props);
bb.query_ai();
}
}