mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
feat(playerbots): staggered taxi take-off for bots (#1281)
* feat(playerbots): staggered taxi take-off for bots Adds four new configurable settings to playerbots.conf: - AiPlayerbot.BotTaxiDelayMinMs: Min random delay before the 1st follower bot clicks the flight-master - AiPlayerbot.BotTaxiDelayMaxMs: Upper bound for the overall taxi delay window – larger spreads big raids - AiPlayerbot.BotTaxiGapMs: Fixed gap added per group-slot so bots never take off together - AiPlayerbot.BotTaxiGapJitterMs: Extra small randomness added to each gap so launches don’t look robotic These options allow server owners to fine-tune how bots queue up and take off from flight masters, making their behavior appear more natural. Closes #1017 : Bots use Flight master nearly the same time. * fixed build errors Was missing a header and variable declarations.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "CreatureData.h"
|
||||
#include "EmoteAction.h"
|
||||
#include "Engine.h"
|
||||
#include "EventProcessor.h"
|
||||
#include "ExternalEventHelper.h"
|
||||
#include "GameObjectData.h"
|
||||
#include "GameTime.h"
|
||||
@@ -6279,3 +6280,23 @@ SpellFamilyNames PlayerbotAI::Class2SpellFamilyName(uint8 cls)
|
||||
}
|
||||
return SPELLFAMILY_GENERIC;
|
||||
}
|
||||
|
||||
void PlayerbotAI::AddTimedEvent(std::function<void()> callback, uint32 delayMs)
|
||||
{
|
||||
class LambdaEvent final : public BasicEvent
|
||||
{
|
||||
std::function<void()> _cb;
|
||||
public:
|
||||
explicit LambdaEvent(std::function<void()> cb) : _cb(std::move(cb)) {}
|
||||
bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override
|
||||
{
|
||||
_cb();
|
||||
return true; // remove after execution
|
||||
}
|
||||
};
|
||||
|
||||
// Every Player already owns an EventMap called m_Events
|
||||
bot->m_Events.AddEvent(
|
||||
new LambdaEvent(std::move(callback)),
|
||||
bot->m_Events.CalculateTime(delayMs));
|
||||
}
|
||||
Reference in New Issue
Block a user