mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-21 02:20:00 +01:00
Fix lag in choose rpg target
This commit is contained in:
parent
0eba23d738
commit
7772f2a3a7
@ -54,24 +54,14 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP)
|
||||
GuidPosition currentRpgTarget = AI_VALUE(GuidPosition, "rpg target");
|
||||
SET_AI_VALUE(GuidPosition, "rpg target", guidP);
|
||||
|
||||
Strategy* rpgStrategy;
|
||||
Strategy* rpgStrategy = botAI->GetAiObjectContext()->GetStrategy("rpg");
|
||||
if (!rpgStrategy) return 0.0f;
|
||||
|
||||
std::vector<TriggerNode*> triggerNodes;
|
||||
rpgStrategy->InitTriggers(triggerNodes);
|
||||
|
||||
float maxRelevance = 0.0f;
|
||||
|
||||
for (auto& strategy : botAI->GetAiObjectContext()->GetSupportedStrategies())
|
||||
{
|
||||
if (strategy.find("rpg") == std::string::npos)
|
||||
continue;
|
||||
|
||||
if (!botAI->HasStrategy(strategy, BotState::BOT_STATE_NON_COMBAT))
|
||||
continue;
|
||||
|
||||
rpgStrategy = botAI->GetAiObjectContext()->GetStrategy(strategy);
|
||||
|
||||
rpgStrategy->InitTriggers(triggerNodes);
|
||||
|
||||
for (auto triggerNode : triggerNodes)
|
||||
{
|
||||
Trigger* trigger = context->GetTrigger(triggerNode->getName());
|
||||
@ -115,9 +105,7 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP)
|
||||
{
|
||||
delete trigger;
|
||||
}
|
||||
|
||||
triggerNodes.clear();
|
||||
}
|
||||
|
||||
SET_AI_VALUE(GuidPosition, "rpg target", currentRpgTarget);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user