Added recastnavigation support
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user