Fix issues with NPC's ghosting who path for long distances, this should wrap up the small remainder of ghosting edge cases

This commit is contained in:
Akkadius 2017-11-21 21:25:20 -06:00
parent 52d31a6846
commit b03e9af597
3 changed files with 88 additions and 74 deletions

View File

@ -269,8 +269,17 @@ bool Client::Process() {
}
}
if (force_spawn_updates && mob != this && distance <= client_update_range)
if (force_spawn_updates && mob != this) {
if (mob->is_distance_roamer) {
Log(Logs::General, Logs::Debug, "Updating distance roamer %s", mob->GetCleanName());
mob->SendPositionUpdateToClient(this);
continue;
}
if (distance <= client_update_range)
mob->SendPositionUpdateToClient(this);
}
}
}

View File

@ -75,7 +75,6 @@ Mob::Mob(const char* in_name,
uint32 in_drakkin_tattoo,
uint32 in_drakkin_details,
EQEmu::TintProfile in_armor_tint,
uint8 in_aa_title,
uint8 in_see_invis, // see through invis/ivu
uint8 in_see_invis_undead,
@ -98,7 +97,7 @@ Mob::Mob(const char* in_name,
tic_timer(6000),
mana_timer(2000),
spellend_timer(0),
rewind_timer(30000), //Timer used for determining amount of time between actual player position updates for /rewind.
rewind_timer(30000),
bindwound_timer(10000),
stunned_timer(0),
spun_timer(0),
@ -126,6 +125,7 @@ Mob::Mob(const char* in_name,
last_z = 0;
last_major_update_position = m_Position;
is_distance_roamer = false;
AI_Init();
SetMoving(false);
@ -172,7 +172,8 @@ Mob::Mob(const char* in_name,
fearspeed = 0.625f;
base_fearspeed = 25;
// npcs
} else {
}
else {
base_walkspeed = base_runspeed * 100 / 265;
walkspeed = ((float)base_walkspeed) * 0.025f;
base_fearspeed = base_runspeed * 100 / 127;
@ -1447,6 +1448,7 @@ void Mob::SendPosition() {
if (DistanceSquared(last_major_update_position, m_Position) >= (100 * 100)) {
entity_list.QueueClients(this, app, true, true);
last_major_update_position = m_Position;
is_distance_roamer = true;
}
else {
entity_list.QueueCloseClients(this, app, true, RuleI(Range, MobPositionUpdates), nullptr, false);

View File

@ -162,6 +162,8 @@ public:
inline virtual bool IsMob() const { return true; }
inline virtual bool InZone() const { return true; }
bool is_distance_roamer;
//Somewhat sorted: needs documenting!
//Attack
@ -1226,6 +1228,7 @@ protected:
glm::vec4 m_Position;
/* Used to determine when an NPC has traversed so many units - to send a zone wide pos update */
glm::vec4 last_major_update_position;
int animation; // this is really what MQ2 calls SpeedRun just packed like (int)(SpeedRun * 40.0f)
float base_size;
float size;