mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
movement fix test
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include "MovementGenerator.h"
|
#include "MovementGenerator.h"
|
||||||
#include "ObjectDefines.h"
|
#include "ObjectDefines.h"
|
||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
|
#include "PathGenerator.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "TargetedMovementGenerator.h"
|
#include "TargetedMovementGenerator.h"
|
||||||
@@ -147,14 +148,15 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// if (bot->Unit::IsFalling()) {
|
// if (bot->Unit::IsFalling()) {
|
||||||
// bot->Say("I'm falling", LANG_UNIVERSAL);
|
// bot->Say("I'm falling", LANG_UNIVERSAL);
|
||||||
// }
|
// }
|
||||||
float modified_z = z + 5.0f;
|
float modified_z;
|
||||||
bot->UpdateAllowedPositionZ(x, y, modified_z);
|
for (float delta = 2.0f; delta <= 15.0f; delta++) {
|
||||||
// prevent falling when bot on slope
|
modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta);
|
||||||
if (modified_z < z - 20.0f) {
|
PathGenerator gen(bot);
|
||||||
modified_z = z + 15.0f;
|
gen.CalculatePath(x, y, modified_z);
|
||||||
bot->UpdateAllowedPositionZ(x, y, modified_z);
|
if (gen.GetPathType() == PATHFIND_NORMAL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
z = modified_z;
|
|
||||||
// z += 0.5f;
|
// z += 0.5f;
|
||||||
float distance = bot->GetDistance2d(x, y);
|
float distance = bot->GetDistance2d(x, y);
|
||||||
if (distance > sPlayerbotAIConfig->contactDistance)
|
if (distance > sPlayerbotAIConfig->contactDistance)
|
||||||
|
|||||||
Reference in New Issue
Block a user