mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-08 07:13:51 +00:00
Will no longer use bestz snapping every frame if a navmesh is available. Fix for inliquid
This commit is contained in:
parent
a2136e5ee4
commit
14b9b22ca3
@ -77,6 +77,7 @@ public:
|
|||||||
//Expects locations in EQEmu internal format eg what #loc returns not what /loc returns.
|
//Expects locations in EQEmu internal format eg what #loc returns not what /loc returns.
|
||||||
PathfindingRoute FindRoute(const glm::vec3 ¤t_location, const glm::vec3 &dest_location);
|
PathfindingRoute FindRoute(const glm::vec3 ¤t_location, const glm::vec3 &dest_location);
|
||||||
bool GetRandomPoint(const glm::vec3 &start, float radius, glm::vec3 &pos);
|
bool GetRandomPoint(const glm::vec3 &start, float radius, glm::vec3 &pos);
|
||||||
|
bool Loaded() const { return m_nav_mesh != nullptr; }
|
||||||
private:
|
private:
|
||||||
dtNavMesh *m_nav_mesh;
|
dtNavMesh *m_nav_mesh;
|
||||||
dtNavMeshQuery *m_nav_query;
|
dtNavMeshQuery *m_nav_query;
|
||||||
|
|||||||
@ -109,7 +109,7 @@ Mob::Mob(const char* in_name,
|
|||||||
m_TargetV(glm::vec3()),
|
m_TargetV(glm::vec3()),
|
||||||
flee_timer(FLEE_CHECK_TIMER),
|
flee_timer(FLEE_CHECK_TIMER),
|
||||||
m_Position(position),
|
m_Position(position),
|
||||||
m_pos_update_timer(8000)
|
m_pos_update_timer(3000) //this can be much longer but really need to redo ai and movement code first.
|
||||||
{
|
{
|
||||||
targeted = 0;
|
targeted = 0;
|
||||||
tar_ndx=0;
|
tar_ndx=0;
|
||||||
|
|||||||
@ -73,7 +73,7 @@ void Mob::TrySnapToMap() {
|
|||||||
if (snap && zone->HasMap()) {
|
if (snap && zone->HasMap()) {
|
||||||
if (!RuleB(Watermap, CheckForWaterWhenMoving) ||
|
if (!RuleB(Watermap, CheckForWaterWhenMoving) ||
|
||||||
!zone->HasWaterMap() ||
|
!zone->HasWaterMap() ||
|
||||||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position)))) {
|
(zone->HasWaterMap() && !zone->watermap->InLiquid(glm::vec3(m_Position)))) {
|
||||||
glm::vec3 dest(m_Position);
|
glm::vec3 dest(m_Position);
|
||||||
float newz = zone->zonemap->FindBestZ(dest, nullptr) + 3.5f;
|
float newz = zone->zonemap->FindBestZ(dest, nullptr) + 3.5f;
|
||||||
m_Position.z = newz;
|
m_Position.z = newz;
|
||||||
|
|||||||
@ -27,7 +27,8 @@ bool WaterMapV1::InLava(const glm::vec3& location) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WaterMapV1::InLiquid(const glm::vec3& location) const {
|
bool WaterMapV1::InLiquid(const glm::vec3& location) const {
|
||||||
return InWater(location) || InLava(location);
|
auto rtype = ReturnRegionType(location);
|
||||||
|
return rtype == RegionTypeWater || rtype == RegionTypeLava || rtype == RegionTypeVWater;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaterMapV1::Load(FILE *fp) {
|
bool WaterMapV1::Load(FILE *fp) {
|
||||||
|
|||||||
@ -30,7 +30,8 @@ bool WaterMapV2::InLava(const glm::vec3& location) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WaterMapV2::InLiquid(const glm::vec3& location) const {
|
bool WaterMapV2::InLiquid(const glm::vec3& location) const {
|
||||||
return InWater(location) || InLava(location);
|
auto rtype = ReturnRegionType(location);
|
||||||
|
return rtype == RegionTypeWater || rtype == RegionTypeLava || rtype == RegionTypeVWater;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaterMapV2::Load(FILE *fp) {
|
bool WaterMapV2::Load(FILE *fp) {
|
||||||
|
|||||||
@ -526,8 +526,9 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
|
|||||||
NPCFlyMode = 1;
|
NPCFlyMode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//lets_move
|
||||||
//fix up pathing Z
|
//fix up pathing Z
|
||||||
if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
|
if(!NPCFlyMode && checkZ && !zone->pathing.Loaded() && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
|
||||||
{
|
{
|
||||||
if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
|
if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
|
||||||
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
|
(zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
|
||||||
@ -784,34 +785,6 @@ bool Mob::CalculateNewPosition(float x, float y, float z, int speed, bool checkZ
|
|||||||
NPCFlyMode = 1;
|
NPCFlyMode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: lets_move
|
|
||||||
////fix up pathing Z
|
|
||||||
//if(!NPCFlyMode && checkZ && zone->HasMap() && RuleB(Map, FixPathingZWhenMoving))
|
|
||||||
//{
|
|
||||||
// if(!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap() ||
|
|
||||||
// (zone->HasWaterMap() && !zone->watermap->InWater(glm::vec3(m_Position))))
|
|
||||||
// {
|
|
||||||
// glm::vec3 dest(m_Position.x, m_Position.y, m_Position.z);
|
|
||||||
//
|
|
||||||
// float newz = zone->zonemap->FindBestZ(dest, nullptr) + 2.0f;
|
|
||||||
//
|
|
||||||
// Log.Out(Logs::Detail, Logs::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,m_Position.x,m_Position.y,m_Position.z);
|
|
||||||
//
|
|
||||||
// if ((newz > -2000) &&
|
|
||||||
// std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
|
|
||||||
// {
|
|
||||||
// if (std::abs(x - m_Position.x) < 0.5 && std::abs(y - m_Position.y) < 0.5) {
|
|
||||||
// if (std::abs(z - m_Position.z) <= RuleR(Map, FixPathingZMaxDeltaMoving))
|
|
||||||
// m_Position.z = z;
|
|
||||||
// else
|
|
||||||
// m_Position.z = newz + 1;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// m_Position.z = newz+1;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//OP_MobUpdate
|
//OP_MobUpdate
|
||||||
if((old_test_vector!=test_vector) || tar_ndx>20){ //send update
|
if((old_test_vector!=test_vector) || tar_ndx>20){ //send update
|
||||||
tar_ndx=0;
|
tar_ndx=0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user