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); 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_tattoo,
uint32 in_drakkin_details, uint32 in_drakkin_details,
EQEmu::TintProfile in_armor_tint, EQEmu::TintProfile in_armor_tint,
uint8 in_aa_title, uint8 in_aa_title,
uint8 in_see_invis, // see through invis/ivu uint8 in_see_invis, // see through invis/ivu
uint8 in_see_invis_undead, uint8 in_see_invis_undead,
@ -98,14 +97,14 @@ Mob::Mob(const char* in_name,
tic_timer(6000), tic_timer(6000),
mana_timer(2000), mana_timer(2000),
spellend_timer(0), 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), bindwound_timer(10000),
stunned_timer(0), stunned_timer(0),
spun_timer(0), spun_timer(0),
bardsong_timer(6000), bardsong_timer(6000),
gravity_timer(1000), gravity_timer(1000),
viral_timer(0), viral_timer(0),
m_FearWalkTarget(-999999.0f,-999999.0f,-999999.0f), m_FearWalkTarget(-999999.0f, -999999.0f, -999999.0f),
m_TargetLocation(glm::vec3()), m_TargetLocation(glm::vec3()),
m_TargetV(glm::vec3()), m_TargetV(glm::vec3()),
flee_timer(FLEE_CHECK_TIMER), flee_timer(FLEE_CHECK_TIMER),
@ -119,30 +118,31 @@ Mob::Mob(const char* in_name,
position_update_melee_push_timer(1000) position_update_melee_push_timer(1000)
{ {
targeted = 0; targeted = 0;
tar_ndx=0; tar_ndx = 0;
tar_vector=0; tar_vector = 0;
currently_fleeing = false; currently_fleeing = false;
last_z = 0; last_z = 0;
last_major_update_position = m_Position; last_major_update_position = m_Position;
is_distance_roamer = false;
AI_Init(); AI_Init();
SetMoving(false); SetMoving(false);
moved=false; moved = false;
m_RewindLocation = glm::vec3(); m_RewindLocation = glm::vec3();
_egnode = nullptr; _egnode = nullptr;
name[0]=0; name[0] = 0;
orig_name[0]=0; orig_name[0] = 0;
clean_name[0]=0; clean_name[0] = 0;
lastname[0]=0; lastname[0] = 0;
if(in_name) { if (in_name) {
strn0cpy(name,in_name,64); strn0cpy(name, in_name, 64);
strn0cpy(orig_name,in_name,64); strn0cpy(orig_name, in_name, 64);
} }
if(in_lastname) if (in_lastname)
strn0cpy(lastname,in_lastname,64); strn0cpy(lastname, in_lastname, 64);
cur_hp = in_cur_hp; cur_hp = in_cur_hp;
max_hp = in_max_hp; max_hp = in_max_hp;
base_hp = in_max_hp; base_hp = in_max_hp;
@ -172,7 +172,8 @@ Mob::Mob(const char* in_name,
fearspeed = 0.625f; fearspeed = 0.625f;
base_fearspeed = 25; base_fearspeed = 25;
// npcs // npcs
} else { }
else {
base_walkspeed = base_runspeed * 100 / 265; base_walkspeed = base_runspeed * 100 / 265;
walkspeed = ((float)base_walkspeed) * 0.025f; walkspeed = ((float)base_walkspeed) * 0.025f;
base_fearspeed = base_runspeed * 100 / 127; base_fearspeed = base_runspeed * 100 / 127;
@ -230,10 +231,10 @@ Mob::Mob(const char* in_name,
SpellPowerDistanceMod = 0; SpellPowerDistanceMod = 0;
last_los_check = false; last_los_check = false;
if(in_aa_title>0) if (in_aa_title > 0)
aa_title = in_aa_title; aa_title = in_aa_title;
else else
aa_title =0xFF; aa_title = 0xFF;
AC = in_ac; AC = in_ac;
ATK = in_atk; ATK = in_atk;
STR = in_str; STR = in_str;
@ -264,7 +265,7 @@ Mob::Mob(const char* in_name,
improved_hidden = false; improved_hidden = false;
invulnerable = false; invulnerable = false;
IsFullHP = (cur_hp == max_hp); IsFullHP = (cur_hp == max_hp);
qglobal=0; qglobal = 0;
spawned = false; spawned = false;
InitializeBuffSlots(); InitializeBuffSlots();
@ -376,13 +377,13 @@ Mob::Mob(const char* in_name,
} }
destructibleobject = false; destructibleobject = false;
wandertype=0; wandertype = 0;
pausetype=0; pausetype = 0;
cur_wp = 0; cur_wp = 0;
m_CurrentWayPoint = glm::vec4(); m_CurrentWayPoint = glm::vec4();
cur_wp_pause = 0; cur_wp_pause = 0;
patrol=0; patrol = 0;
follow=0; follow = 0;
follow_dist = 100; // Default Distance for Follow follow_dist = 100; // Default Distance for Follow
no_target_hotkey = false; no_target_hotkey = false;
flee_mode = false; flee_mode = false;
@ -396,7 +397,7 @@ Mob::Mob(const char* in_name,
rooted = false; rooted = false;
charmed = false; charmed = false;
has_virus = false; has_virus = false;
for (i=0; i<MAX_SPELL_TRIGGER*2; i++) { for (i = 0; i < MAX_SPELL_TRIGGER * 2; i++) {
viral_spells[i] = 0; viral_spells[i] = 0;
} }
pStandingPetOrder = SPO_Follow; pStandingPetOrder = SPO_Follow;
@ -444,7 +445,7 @@ Mob::Mob(const char* in_name,
m_AllowBeneficial = false; m_AllowBeneficial = false;
m_DisableMelee = false; m_DisableMelee = false;
for (int i = 0; i < EQEmu::skills::HIGHEST_SKILL + 2; i++) { SkillDmgTaken_Mod[i] = 0; } for (int i = 0; i < EQEmu::skills::HIGHEST_SKILL + 2; i++) { SkillDmgTaken_Mod[i] = 0; }
for (int i = 0; i < HIGHEST_RESIST+2; i++) { Vulnerability_Mod[i] = 0; } for (int i = 0; i < HIGHEST_RESIST + 2; i++) { Vulnerability_Mod[i] = 0; }
emoteid = 0; emoteid = 0;
endur_upkeep = false; endur_upkeep = false;
@ -1447,6 +1448,7 @@ void Mob::SendPosition() {
if (DistanceSquared(last_major_update_position, m_Position) >= (100 * 100)) { if (DistanceSquared(last_major_update_position, m_Position) >= (100 * 100)) {
entity_list.QueueClients(this, app, true, true); entity_list.QueueClients(this, app, true, true);
last_major_update_position = m_Position; last_major_update_position = m_Position;
is_distance_roamer = true;
} }
else { else {
entity_list.QueueCloseClients(this, app, true, RuleI(Range, MobPositionUpdates), nullptr, false); 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 IsMob() const { return true; }
inline virtual bool InZone() const { return true; } inline virtual bool InZone() const { return true; }
bool is_distance_roamer;
//Somewhat sorted: needs documenting! //Somewhat sorted: needs documenting!
//Attack //Attack
@ -1226,6 +1228,7 @@ protected:
glm::vec4 m_Position; glm::vec4 m_Position;
/* Used to determine when an NPC has traversed so many units - to send a zone wide pos update */ /* Used to determine when an NPC has traversed so many units - to send a zone wide pos update */
glm::vec4 last_major_update_position; glm::vec4 last_major_update_position;
int animation; // this is really what MQ2 calls SpeedRun just packed like (int)(SpeedRun * 40.0f) int animation; // this is really what MQ2 calls SpeedRun just packed like (int)(SpeedRun * 40.0f)
float base_size; float base_size;
float size; float size;