mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 16:41:29 +00:00
Some small tweaks to reduce the amount of SendPosUpdates() are actually getting sent out on the wire.
This commit is contained in:
parent
3455d70ca2
commit
753f53be1b
14
zone/mob.cpp
14
zone/mob.cpp
@ -1395,19 +1395,23 @@ void Mob::SendPosUpdate(uint8 iSendToSelf) {
|
|||||||
MakeSpawnUpdate(spu);
|
MakeSpawnUpdate(spu);
|
||||||
|
|
||||||
if (iSendToSelf == 2) {
|
if (iSendToSelf == 2) {
|
||||||
if (this->IsClient())
|
if (IsClient()) {
|
||||||
this->CastToClient()->FastQueuePacket(&app,false);
|
CastToClient()->FastQueuePacket(&app,false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount))
|
if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount))
|
||||||
{
|
{
|
||||||
entity_list.QueueClients(this, app, (iSendToSelf==0), false);
|
entity_list.QueueClients(this, app, (iSendToSelf == 0), false);
|
||||||
move_tic_count = 0;
|
move_tic_count = 0;
|
||||||
}
|
}
|
||||||
else
|
else if(move_tic_count % 2 == 0)
|
||||||
{
|
{
|
||||||
entity_list.QueueCloseClients(this, app, (iSendToSelf==0), 800, nullptr, false);
|
entity_list.QueueCloseClients(this, app, (iSendToSelf == 0), 700, nullptr, false);
|
||||||
|
move_tic_count++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
move_tic_count++;
|
move_tic_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -443,31 +443,10 @@ void NPC::NextGuardPosition() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// we need this for charmed NPCs
|
|
||||||
void Mob::SaveSpawnSpot() {
|
|
||||||
spawn_x = x_pos;
|
|
||||||
spawn_y = y_pos;
|
|
||||||
spawn_z = z_pos;
|
|
||||||
spawn_heading = heading;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*float Mob::CalculateDistanceToNextWaypoint() {
|
|
||||||
return CalculateDistance(cur_wp_x, cur_wp_y, cur_wp_z);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
float Mob::CalculateDistance(float x, float y, float z) {
|
float Mob::CalculateDistance(float x, float y, float z) {
|
||||||
return (float)sqrtf( ((m_Position.x-x)*(m_Position.x-x)) + ((m_Position.y-y)*(m_Position.y-y)) + ((m_Position.z-z)*(m_Position.z-z)) );
|
return (float)sqrtf( ((m_Position.x-x)*(m_Position.x-x)) + ((m_Position.y-y)*(m_Position.y-y)) + ((m_Position.z-z)*(m_Position.z-z)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
uint8 NPC::CalculateHeadingToNextWaypoint() {
|
|
||||||
return CalculateHeadingToTarget(cur_wp_x, cur_wp_y);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
|
float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
|
||||||
float angle;
|
float angle;
|
||||||
|
|
||||||
@ -656,6 +635,11 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
tar_vector/=16.0f;
|
tar_vector/=16.0f;
|
||||||
|
float dur = Timer::SetCurrentTime() - pLastChange;
|
||||||
|
if(dur < 1.0f) {
|
||||||
|
dur = 1.0f;
|
||||||
|
}
|
||||||
|
tar_vector = (tar_vector * AImovement_duration) / 100.0f;
|
||||||
|
|
||||||
float new_x = m_Position.x + m_TargetV.x*tar_vector;
|
float new_x = m_Position.x + m_TargetV.x*tar_vector;
|
||||||
float new_y = m_Position.y + m_TargetV.y*tar_vector;
|
float new_y = m_Position.y + m_TargetV.y*tar_vector;
|
||||||
@ -717,8 +701,6 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// force an update now
|
|
||||||
move_tic_count = RuleI(Zone, NPCPositonUpdateTicCount);
|
|
||||||
SendPosUpdate();
|
SendPosUpdate();
|
||||||
SetAppearance(eaStanding, false);
|
SetAppearance(eaStanding, false);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user