mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-06 09:23:52 +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);
|
||||
float GetZOffset() 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);
|
||||
|
||||
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(currently_fleeing) {
|
||||
if (RuleB(Combat, EnableFearPathing)) {
|
||||
if (currently_fleeing) {
|
||||
|
||||
if (fix_z_timer_engaged.Check())
|
||||
this->FixZ();
|
||||
if (fix_z_timer.Check())
|
||||
this->FixZ(5, true);
|
||||
|
||||
if(IsRooted()) {
|
||||
if (IsRooted()) {
|
||||
//make sure everybody knows were not moving, for appearance sake
|
||||
if(IsMoving())
|
||||
{
|
||||
if(GetTarget())
|
||||
if (IsMoving()) {
|
||||
if (GetTarget())
|
||||
SetHeading(CalculateHeadingToTarget(GetTarget()->GetX(), GetTarget()->GetY()));
|
||||
SetCurrentSpeed(0);
|
||||
}
|
||||
//continue on to attack code, ensuring that we execute the engaged code
|
||||
engaged = true;
|
||||
} else {
|
||||
if(AI_movement_timer->Check()) {
|
||||
}
|
||||
else {
|
||||
if (AI_movement_timer->Check()) {
|
||||
int speed = GetFearSpeed();
|
||||
animation = speed;
|
||||
speed *= 2;
|
||||
SetCurrentSpeed(speed);
|
||||
// Check if we have reached the last fear point
|
||||
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
|
||||
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);
|
||||
else
|
||||
{
|
||||
bool WaypointChanged, NodeReached;
|
||||
else {
|
||||
bool waypoint_changed, node_reached;
|
||||
|
||||
glm::vec3 Goal = UpdatePath(m_FearWalkTarget.x, m_FearWalkTarget.y, m_FearWalkTarget.z,
|
||||
speed, WaypointChanged, NodeReached);
|
||||
glm::vec3 Goal = UpdatePath(
|
||||
m_FearWalkTarget.x,
|
||||
m_FearWalkTarget.y,
|
||||
m_FearWalkTarget.z,
|
||||
speed,
|
||||
waypoint_changed,
|
||||
node_reached
|
||||
);
|
||||
|
||||
if(WaypointChanged)
|
||||
if (waypoint_changed)
|
||||
tar_ndx = 20;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
float new_z = GetFixedZ(current_loc, z_find_offset);
|
||||
|
||||
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);
|
||||
}
|
||||
if (IsClient() && !fix_client_z)
|
||||
return;
|
||||
|
||||
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",
|
||||
this->GetCleanName(), std::abs(m_Position.z - new_z));
|
||||
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