From 78832f106ee5800ab248827820bc16f5f1981d2b Mon Sep 17 00:00:00 2001 From: Revision Date: Sun, 28 Jul 2024 02:43:22 +0200 Subject: [PATCH] Add bots to transports Add bots to transports they're on so they actually move with it. --- src/strategy/actions/MovementActions.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index ed002f53..7ae2f99f 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -849,6 +849,21 @@ void MovementAction::UpdateMovementState() if (bot->IsFlying()) bot->UpdateSpeed(MOVE_FLIGHT, true); + + Transport* newTransport = bot->GetMap()->GetTransportForPos(bot->GetPhaseMask(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), bot); + if (newTransport != bot->GetTransport()) + { + LOG_DEBUG("playerbots", "Bot {} is on a transport", IsMovingAllowed()); + + if (bot->GetTransport()) + bot->GetTransport()->RemovePassenger(bot, true); + + if (newTransport) + newTransport->AddPassenger(bot, true); + + bot->StopMovingOnCurrentPos(); + } + // Temporary speed increase in group //if (botAI->HasRealPlayerMaster()) //bot->SetSpeedRate(MOVE_RUN, 1.1f);