Fix for bots disappearing while idle (update)

This commit is contained in:
Uleat 2019-01-29 20:25:35 -05:00
parent 444acb7c70
commit bc79e28d49
4 changed files with 15 additions and 27 deletions

View File

@ -2013,12 +2013,20 @@ bool Bot::Process() {
if(GetAppearance() == eaDead && GetHP() > 0)
SetAppearance(eaStanding);
if (IsMoving()) {
ping_timer.Disable();
}
else {
if (!ping_timer.Enabled())
ping_timer.Start(BOT_KEEP_ALIVE_INTERVAL);
if (ping_timer.Check())
SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0);
}
if (IsStunned() || IsMezzed())
return true;
if (!IsMoving() && ping_timer.Check())
SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0);
// Bot AI
AI_Process();
return true;
@ -9082,18 +9090,4 @@ std::string Bot::CreateSayLink(Client* c, const char* message, const char* name)
return saylink;
}
void Bot::StopMoving() {
if (!ping_timer.Enabled())
ping_timer.Start(8000);
Mob::StopMoving();
}
void Bot::StopMoving(float new_heading) {
if (!ping_timer.Enabled())
ping_timer.Start(8000);
Mob::StopMoving(new_heading);
}
#endif

View File

@ -44,6 +44,8 @@
#define BOT_LEASH_DISTANCE 250000 // as DSq value (500 units)
#define BOT_KEEP_ALIVE_INTERVAL 5000 // 5 seconds
extern WorldServer worldserver;
const int BotAISpellRange = 100; // TODO: Write a method that calcs what the bot's spell range is based on spell, equipment, AA, whatever and replace this
@ -341,8 +343,6 @@ public:
virtual int GetRunspeed() const { return (int)((float)_GetRunSpeed() * 1.785714f); }
virtual void WalkTo(float x, float y, float z);
virtual void RunTo(float x, float y, float z);
virtual void StopMoving();
virtual void StopMoving(float new_heading);
bool UseDiscipline(uint32 spell_id, uint32 target);
uint8 GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets);
bool GetNeedsCured(Mob *tar);

View File

@ -589,8 +589,8 @@ public:
void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu);
void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu);
void SentPositionPacket(float dx, float dy, float dz, float dh, int anim, bool send_to_self = false);
virtual void StopMoving();
virtual void StopMoving(float new_heading);
void StopMoving();
void StopMoving(float new_heading);
void SetSpawned() { spawned = true; };
bool Spawned() { return spawned; };
virtual bool ShouldISpawnFor(Client *c) { return true; }

View File

@ -1075,9 +1075,6 @@ void Bot::WalkTo(float x, float y, float z)
if (IsSitting())
Stand();
if (ping_timer.Enabled())
ping_timer.Disable();
Mob::WalkTo(x, y, z);
}
@ -1086,9 +1083,6 @@ void Bot::RunTo(float x, float y, float z)
if (IsSitting())
Stand();
if (ping_timer.Enabled())
ping_timer.Disable();
Mob::RunTo(x, y, z);
}
#endif