From 159980f76eb0a84be56f68dbfe224be8147767f4 Mon Sep 17 00:00:00 2001 From: Jgoodwin64 <94092417+Jgoodwin64@users.noreply.github.com> Date: Sun, 14 Jul 2024 20:30:43 -0400 Subject: [PATCH 1/2] Fixed bug in StayActions.cpp The bot used to wait till it got done with it's current path. Now the bot stays immediately on the stayAction is loaded. --- src/strategy/actions/StayActions.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/strategy/actions/StayActions.cpp b/src/strategy/actions/StayActions.cpp index 1b810dd4..ca8a83b1 100644 --- a/src/strategy/actions/StayActions.cpp +++ b/src/strategy/actions/StayActions.cpp @@ -13,7 +13,6 @@ bool StayActionBase::Stay() //if (!urand(0, 10)) //botAI->PlaySound(TEXT_EMOTE_YAWN); - if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE) return false; @@ -26,12 +25,13 @@ bool StayActionBase::Stay() context->GetValue("stay time")->Set(stayTime); } - if (!bot->isMoving()) - return false; - - bot->StopMoving(); - bot->ClearUnitState(UNIT_STATE_CHASE); - bot->ClearUnitState(UNIT_STATE_FOLLOW); + // Stop the bot from moving immediately when action is called + if (bot->isMoving()) + { + bot->StopMoving(); + bot->ClearUnitState(UNIT_STATE_CHASE); + bot->ClearUnitState(UNIT_STATE_FOLLOW); + } return true; } @@ -43,7 +43,8 @@ bool StayAction::Execute(Event event) bool StayAction::isUseful() { - return !AI_VALUE2(bool, "moving", "self target"); + // Only useful if the bot is currently moving + return AI_VALUE2(bool, "moving", "self target"); } bool SitAction::Execute(Event event) From 3e20d837bde6efd455eb6ed32a8b267aaeeadc0e Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Tue, 16 Jul 2024 11:00:19 +0800 Subject: [PATCH 2/2] [Crash fix] Owner check for AvoidAuraWithDynamicObj --- src/strategy/actions/MovementActions.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index 6a67e01b..0dfea873 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -1535,6 +1535,9 @@ bool AvoidAoeAction::AvoidAuraWithDynamicObj() if (!aura || aura->IsRemoved() || aura->IsExpired()) { return false; } + if (!aura->GetOwner() || !aura->GetOwner()->IsInWorld()) { + return false; + } // Crash fix: maybe change owner due to check interval if (aura->GetType() != DYNOBJ_AURA_TYPE) { return false;