mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Fix some of the Fix Z logic - Boats no longer snap Z - Even though we checked for water, chances are boats pathing was above water and would snap Z to the floor of the water
This commit is contained in:
parent
2c91d1db6e
commit
d43273fd1b
@ -752,55 +752,55 @@ float Mob::GetFixedZ(glm::vec3 dest, int32 z_find_offset)
|
||||
timer.reset();
|
||||
float new_z = dest.z;
|
||||
|
||||
if (zone->HasMap() && RuleB(Map, FixZWhenMoving) &&
|
||||
(flymode != 1 && flymode != 2))
|
||||
{
|
||||
if (!RuleB(Watermap, CheckForWaterWhenMoving) || !zone->HasWaterMap()
|
||||
|| (zone->HasWaterMap() &&
|
||||
!zone->watermap->InWater(glm::vec3(m_Position))))
|
||||
{
|
||||
/* Any more than 5 in the offset makes NPC's hop/snap to ceiling in small corridors */
|
||||
new_z = this->FindDestGroundZ(dest, z_find_offset);
|
||||
if (new_z != BEST_Z_INVALID)
|
||||
{
|
||||
new_z += this->GetZOffset();
|
||||
if (zone->HasMap() && RuleB(Map, FixZWhenMoving)) {
|
||||
|
||||
// If bad new Z restore old one
|
||||
if (new_z < -2000) {
|
||||
new_z = m_Position.z;
|
||||
}
|
||||
if (flymode == 1 || flymode == 2)
|
||||
return new_z;
|
||||
|
||||
if (this->IsBoat())
|
||||
return new_z;
|
||||
|
||||
if (zone->HasWaterMap() && zone->watermap->InWater(glm::vec3(m_Position)))
|
||||
return new_z;
|
||||
|
||||
/*
|
||||
* Any more than 5 in the offset makes NPC's hop/snap to ceiling in small corridors
|
||||
*/
|
||||
new_z = this->FindDestGroundZ(dest, z_find_offset);
|
||||
if (new_z != BEST_Z_INVALID) {
|
||||
new_z += this->GetZOffset();
|
||||
|
||||
if (new_z < -2000) {
|
||||
new_z = m_Position.z;
|
||||
}
|
||||
}
|
||||
|
||||
auto duration = timer.elapsed();
|
||||
|
||||
Log(Logs::Moderate, Logs::FixZ,
|
||||
"Mob::GetFixedZ() (%s) returned %4.3f at %4.3f, %4.3f, %4.3f - Took %lf",
|
||||
this->GetCleanName(), new_z, dest.x, dest.y, dest.z, duration);
|
||||
"Mob::GetFixedZ() (%s) returned %4.3f at %4.3f, %4.3f, %4.3f - Took %lf",
|
||||
this->GetCleanName(), new_z, dest.x, dest.y, dest.z, duration);
|
||||
}
|
||||
|
||||
return new_z;
|
||||
}
|
||||
|
||||
void Mob::FixZ(int32 z_find_offset /*= 5*/)
|
||||
{
|
||||
void Mob::FixZ(int32 z_find_offset /*= 5*/) {
|
||||
glm::vec3 current_loc(m_Position);
|
||||
float new_z = GetFixedZ(current_loc, z_find_offset);
|
||||
float new_z = GetFixedZ(current_loc, z_find_offset);
|
||||
|
||||
if (!IsClient() && new_z != m_Position.z)
|
||||
{
|
||||
if (!IsClient() && new_z != m_Position.z) {
|
||||
if ((new_z > -2000) && new_z != BEST_Z_INVALID) {
|
||||
if (RuleB(Map, MobZVisualDebug))
|
||||
this->SendAppearanceEffect(78, 0, 0, 0, 0);
|
||||
|
||||
m_Position.z = new_z;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (RuleB(Map, MobZVisualDebug))
|
||||
this->SendAppearanceEffect(103, 0, 0, 0, 0);
|
||||
|
||||
Log(Logs::General, Logs::FixZ, "%s is failing to find Z %f",
|
||||
this->GetCleanName(), std::abs(m_Position.z - new_z));
|
||||
this->GetCleanName(), std::abs(m_Position.z - new_z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user