mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-10 18:32:24 +00:00
[Pathing] Improvements to z-clipping, z-recovery and z-calculations (#2975)
* zclip adjustments * Remove debug
This commit is contained in:
parent
33bb5aa8e5
commit
1e50f19f7e
@ -103,6 +103,7 @@ Mob::Mob(
|
|||||||
attack_dw_timer(2000),
|
attack_dw_timer(2000),
|
||||||
ranged_timer(2000),
|
ranged_timer(2000),
|
||||||
hp_regen_per_second_timer(1000),
|
hp_regen_per_second_timer(1000),
|
||||||
|
m_z_clip_check_timer(1000),
|
||||||
tic_timer(6000),
|
tic_timer(6000),
|
||||||
mana_timer(2000),
|
mana_timer(2000),
|
||||||
spellend_timer(0),
|
spellend_timer(0),
|
||||||
|
|||||||
@ -1427,6 +1427,8 @@ protected:
|
|||||||
int _GetRunSpeed() const;
|
int _GetRunSpeed() const;
|
||||||
int _GetFearSpeed() const;
|
int _GetFearSpeed() const;
|
||||||
|
|
||||||
|
Timer m_z_clip_check_timer;
|
||||||
|
|
||||||
virtual bool AI_EngagedCastCheck() { return(false); }
|
virtual bool AI_EngagedCastCheck() { return(false); }
|
||||||
virtual bool AI_PursueCastCheck() { return(false); }
|
virtual bool AI_PursueCastCheck() { return(false); }
|
||||||
virtual bool AI_IdleCastCheck() { return(false); }
|
virtual bool AI_IdleCastCheck() { return(false); }
|
||||||
|
|||||||
@ -1071,6 +1071,14 @@ void Mob::AI_Process() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (engaged) {
|
if (engaged) {
|
||||||
|
if (IsNPC() && m_z_clip_check_timer.Check()) {
|
||||||
|
auto t = GetTarget();
|
||||||
|
if (t && DistanceNoZ(GetPosition(), t->GetPosition()) < 75 && std::abs(GetPosition().z - t->GetPosition().z) > 15 && !CheckLosFN(t)) {
|
||||||
|
GMMove(t->GetPosition().x, t->GetPosition().y, t->GetPosition().z, t->GetPosition().w);
|
||||||
|
FaceTarget(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive)))
|
if (!(m_PlayerState & static_cast<uint32>(PlayerState::Aggressive)))
|
||||||
SendAddPlayerState(PlayerState::Aggressive);
|
SendAddPlayerState(PlayerState::Aggressive);
|
||||||
|
|
||||||
|
|||||||
@ -781,7 +781,19 @@ float Mob::GetFixedZ(const glm::vec3 &destination, int32 z_find_offset) {
|
|||||||
return new_z;
|
return new_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_z = FindDestGroundZ(destination, (-GetZOffset() / 2));
|
new_z = FindDestGroundZ(destination, ((-GetZOffset() / 2) + z_find_offset));
|
||||||
|
|
||||||
|
if (RuleB(Map, MobPathingVisualDebug)) {
|
||||||
|
DrawDebugCoordinateNode(
|
||||||
|
fmt::format("{} search z node", GetCleanName()),
|
||||||
|
glm::vec4{
|
||||||
|
m_Position.x,
|
||||||
|
m_Position.y,
|
||||||
|
((-GetZOffset() / 2) + z_find_offset),
|
||||||
|
m_Position.w
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
if (new_z != BEST_Z_INVALID) {
|
if (new_z != BEST_Z_INVALID) {
|
||||||
new_z += GetZOffset();
|
new_z += GetZOffset();
|
||||||
|
|
||||||
@ -790,20 +802,6 @@ float Mob::GetFixedZ(const glm::vec3 &destination, int32 z_find_offset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent ceiling clipping
|
|
||||||
// if client is close in distance (not counting Z) and we clipped up into a ceiling
|
|
||||||
// this helps us snap back down (or up) if it were to happen
|
|
||||||
// other fixes were put in place to prevent clipping into the ceiling to begin with
|
|
||||||
if (std::abs(new_z - m_Position.z) > 15) {
|
|
||||||
LogFixZ("TRIGGER clipping detection");
|
|
||||||
auto t = GetTarget();
|
|
||||||
if (t && DistanceNoZ(GetPosition(), t->GetPosition()) < 20) {
|
|
||||||
new_z = FindDestGroundZ(t->GetPosition(), -t->GetZOffset());
|
|
||||||
new_z += GetZOffset();
|
|
||||||
GMMove(t->GetPosition().x, t->GetPosition().y, new_z, t->GetPosition().w);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto duration = timer.elapsed();
|
auto duration = timer.elapsed();
|
||||||
|
|
||||||
LogFixZ("[{}] returned [{}] at [{}] [{}] [{}] - Took [{}]",
|
LogFixZ("[{}] returned [{}] at [{}] [{}] [{}] - Took [{}]",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user