mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-10 18:32:24 +00:00
Fix client pathing Z while feared
This commit is contained in:
parent
d4e0e8aea2
commit
b92e83a465
@ -988,7 +988,7 @@ public:
|
|||||||
void SendToFixZ(float new_x, float new_y, float new_z);
|
void SendToFixZ(float new_x, float new_y, float new_z);
|
||||||
float GetZOffset() const;
|
float GetZOffset() const;
|
||||||
float GetDefaultRaceSize() const;
|
float GetDefaultRaceSize() const;
|
||||||
void FixZ(int32 z_find_offset = 5);
|
void FixZ(int32 z_find_offset = 5, bool fix_client_z = false);
|
||||||
float GetFixedZ(glm::vec3 destination, int32 z_find_offset = 5);
|
float GetFixedZ(glm::vec3 destination, int32 z_find_offset = 5);
|
||||||
|
|
||||||
void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false);
|
void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false);
|
||||||
|
|||||||
@ -779,44 +779,50 @@ void Client::AI_Process()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RuleB(Combat, EnableFearPathing)){
|
if (RuleB(Combat, EnableFearPathing)) {
|
||||||
if(currently_fleeing) {
|
if (currently_fleeing) {
|
||||||
|
|
||||||
if (fix_z_timer_engaged.Check())
|
if (fix_z_timer.Check())
|
||||||
this->FixZ();
|
this->FixZ(5, true);
|
||||||
|
|
||||||
if(IsRooted()) {
|
if (IsRooted()) {
|
||||||
//make sure everybody knows were not moving, for appearance sake
|
//make sure everybody knows were not moving, for appearance sake
|
||||||
if(IsMoving())
|
if (IsMoving()) {
|
||||||
{
|
if (GetTarget())
|
||||||
if(GetTarget())
|
|
||||||
SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()));
|
SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()));
|
||||||
SetCurrentSpeed(0);
|
SetCurrentSpeed(0);
|
||||||
}
|
}
|
||||||
//continue on to attack code, ensuring that we execute the engaged code
|
//continue on to attack code, ensuring that we execute the engaged code
|
||||||
engaged = true;
|
engaged = true;
|
||||||
} else {
|
}
|
||||||
if(AI_movement_timer->Check()) {
|
else {
|
||||||
|
if (AI_movement_timer->Check()) {
|
||||||
int speed = GetFearSpeed();
|
int speed = GetFearSpeed();
|
||||||
animation = speed;
|
animation = speed;
|
||||||
speed *= 2;
|
speed *= 2;
|
||||||
SetCurrentSpeed(speed);
|
SetCurrentSpeed(speed);
|
||||||
// Check if we have reached the last fear point
|
// Check if we have reached the last fear point
|
||||||
if ((std::abs(GetX() - m_FearWalkTarget.x) < 0.1) &&
|
if ((std::abs(GetX() - m_FearWalkTarget.x) < 0.1) &&
|
||||||
(std::abs(GetY() - m_FearWalkTarget.y) < 0.1)) {
|
(std::abs(GetY() - m_FearWalkTarget.y) < 0.1)) {
|
||||||
// Calculate a new point to run to
|
// Calculate a new point to run to
|
||||||
CalculateNewFearpoint();
|
CalculateNewFearpoint();
|
||||||
}
|
}
|
||||||
if(!RuleB(Pathing, Fear) || !zone->pathing)
|
|
||||||
|
if (!RuleB(Pathing, Fear) || !zone->pathing)
|
||||||
CalculateNewPosition(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z, speed, true);
|
CalculateNewPosition(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z, speed, true);
|
||||||
else
|
else {
|
||||||
{
|
bool waypoint_changed, node_reached;
|
||||||
bool WaypointChanged, NodeReached;
|
|
||||||
|
|
||||||
glm::vec3 Goal = UpdatePath(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z,
|
glm::vec3 Goal = UpdatePath(
|
||||||
speed, WaypointChanged, NodeReached);
|
m_FearWalkTarget.x,
|
||||||
|
m_FearWalkTarget.y,
|
||||||
|
m_FearWalkTarget.z,
|
||||||
|
speed,
|
||||||
|
waypoint_changed,
|
||||||
|
node_reached
|
||||||
|
);
|
||||||
|
|
||||||
if(WaypointChanged)
|
if (waypoint_changed)
|
||||||
tar_ndx = 20;
|
tar_ndx = 20;
|
||||||
|
|
||||||
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
CalculateNewPosition(Goal.x, Goal.y, Goal.z, speed);
|
||||||
|
|||||||
@ -793,26 +793,34 @@ float Mob::GetFixedZ(glm::vec3 destination, int32 z_find_offset) {
|
|||||||
return new_z;
|
return new_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::FixZ(int32 z_find_offset /*= 5*/) {
|
void Mob::FixZ(int32 z_find_offset /*= 5*/, bool fix_client_z /*= false*/) {
|
||||||
glm::vec3 current_loc(m_Position);
|
glm::vec3 current_loc(m_Position);
|
||||||
float new_z = GetFixedZ(current_loc, z_find_offset);
|
|
||||||
|
|
||||||
if (!IsClient() && new_z != m_Position.z) {
|
if (IsClient() && !fix_client_z)
|
||||||
if ((new_z > -2000) && new_z != BEST_Z_INVALID) {
|
return;
|
||||||
if (RuleB(Map, MobZVisualDebug)) {
|
|
||||||
this->SendAppearanceEffect(78, 0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Position.z = new_z;
|
float new_z = GetFixedZ(current_loc, z_find_offset);
|
||||||
|
|
||||||
|
if (new_z == m_Position.z)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((new_z > -2000) && new_z != BEST_Z_INVALID) {
|
||||||
|
if (RuleB(Map, MobZVisualDebug)) {
|
||||||
|
this->SendAppearanceEffect(78, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (RuleB(Map, MobZVisualDebug)) {
|
|
||||||
this->SendAppearanceEffect(103, 0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log(Logs::General, Logs::FixZ, "%s is failing to find Z %f",
|
m_Position.z = new_z;
|
||||||
this->GetCleanName(), std::abs(m_Position.z - new_z));
|
}
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user