mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix: Prevent bots from eating and drinking while mounted
This change modifies the `DrinkAction::Execute()` and `EatAction::Execute()` functions in `src/strategy/actions/NonCombatActions.cpp`. Previously, playerbots could attempt to eat food or drink water while mounted, which is not possible in the game and creates unrealistic behavior. This fix adds mount state checks to both actions: 1. `DrinkAction::Execute()` now checks `bot->IsMounted()` and returns false if mounted 2. `EatAction::Execute()` now checks `bot->IsMounted()` and returns false if mounted This prevents bots from attempting to consume food or drinks while mounted, improving bot behavior realism and preventing unnecessary action attempts that would fail anyway.
This commit is contained in:
@@ -13,6 +13,10 @@ bool DrinkAction::Execute(Event event)
|
||||
if (bot->IsInCombat())
|
||||
return false;
|
||||
|
||||
// Don't drink while mounted
|
||||
if (bot->IsMounted())
|
||||
return false;
|
||||
|
||||
bool hasMana = AI_VALUE2(bool, "has mana", "self target");
|
||||
if (!hasMana)
|
||||
return false;
|
||||
@@ -66,6 +70,10 @@ bool EatAction::Execute(Event event)
|
||||
if (bot->IsInCombat())
|
||||
return false;
|
||||
|
||||
// Don't eat while mounted
|
||||
if (bot->IsMounted())
|
||||
return false;
|
||||
|
||||
if (botAI->HasCheat(BotCheatMask::food))
|
||||
{
|
||||
// if (bot->IsNonMeleeSpellCast(true))
|
||||
|
||||
Reference in New Issue
Block a user