mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-21 17:52:25 +00:00
Relocated 'stop movement' code into class Mob from class Bot
This commit is contained in:
parent
8805021960
commit
d71dbd1751
24
zone/bot.cpp
24
zone/bot.cpp
@ -2041,18 +2041,6 @@ void Bot::SetTarget(Mob* mob) {
|
||||
}
|
||||
}
|
||||
|
||||
void Bot::ForceMovementEnd() {
|
||||
FixZ();
|
||||
SetCurrentSpeed(0);
|
||||
if (moved)
|
||||
moved = false;
|
||||
}
|
||||
|
||||
void Bot::ForceMovementEnd(float new_heading) {
|
||||
SetHeading(new_heading);
|
||||
ForceMovementEnd();
|
||||
}
|
||||
|
||||
// AI Processing for the Bot object
|
||||
void Bot::AI_Process() {
|
||||
|
||||
@ -2135,7 +2123,7 @@ void Bot::AI_Process() {
|
||||
|
||||
// Can't move if rooted...
|
||||
if (IsRooted() && IsMoving()) {
|
||||
ForceMovementEnd();
|
||||
StopMoving();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2263,7 +2251,7 @@ void Bot::AI_Process() {
|
||||
SetTarget(nullptr);
|
||||
|
||||
if (IsMoving())
|
||||
ForceMovementEnd();
|
||||
StopMoving();
|
||||
|
||||
return;
|
||||
}
|
||||
@ -2418,7 +2406,7 @@ void Bot::AI_Process() {
|
||||
// We can fight
|
||||
if (atCombatRange) {
|
||||
if (IsMoving()) {
|
||||
ForceMovementEnd(CalculateHeadingToTarget(tar->GetX(), tar->GetY()));
|
||||
StopMoving(CalculateHeadingToTarget(tar->GetX(), tar->GetY()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2644,7 +2632,7 @@ void Bot::AI_Process() {
|
||||
}
|
||||
else {
|
||||
if (IsMoving())
|
||||
ForceMovementEnd();
|
||||
StopMoving();
|
||||
else
|
||||
SendPosition();
|
||||
|
||||
@ -2698,7 +2686,7 @@ void Bot::AI_Process() {
|
||||
// Leash the bot
|
||||
if (lo_distance > BOT_LEASH_DISTANCE) {
|
||||
if (IsMoving())
|
||||
ForceMovementEnd();
|
||||
StopMoving();
|
||||
|
||||
Warp(glm::vec3(leash_owner->GetPosition()));
|
||||
|
||||
@ -2754,7 +2742,7 @@ void Bot::AI_Process() {
|
||||
}
|
||||
else {
|
||||
if (IsMoving()) {
|
||||
ForceMovementEnd();
|
||||
StopMoving();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,9 +405,7 @@ public:
|
||||
bool AIHealRotation(Mob* tar, bool useFastHeals);
|
||||
bool GetPauseAI() { return _pauseAI; }
|
||||
void SetPauseAI(bool pause_flag) { _pauseAI = pause_flag; }
|
||||
void ForceMovementEnd();
|
||||
void ForceMovementEnd(float new_heading);
|
||||
|
||||
|
||||
// Mob AI Virtual Override Methods
|
||||
virtual void AI_Process();
|
||||
virtual void AI_Stop();
|
||||
|
||||
15
zone/mob.cpp
15
zone/mob.cpp
@ -1437,6 +1437,21 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal
|
||||
}
|
||||
}
|
||||
|
||||
void Mob::StopMoving() {
|
||||
FixZ();
|
||||
SetCurrentSpeed(0);
|
||||
if (moved)
|
||||
moved = false;
|
||||
}
|
||||
|
||||
void Mob::StopMoving(float new_heading) {
|
||||
SetHeading(new_heading);
|
||||
FixZ();
|
||||
SetCurrentSpeed(0);
|
||||
if (moved)
|
||||
moved = false;
|
||||
}
|
||||
|
||||
/* Used for mobs standing still - this does not send a delta */
|
||||
void Mob::SendPosition() {
|
||||
auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
|
||||
|
||||
@ -569,6 +569,8 @@ public:
|
||||
void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu);
|
||||
void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu);
|
||||
void SendPosition();
|
||||
void StopMoving();
|
||||
void StopMoving(float new_heading);
|
||||
void SetSpawned() { spawned = true; };
|
||||
bool Spawned() { return spawned; };
|
||||
virtual bool ShouldISpawnFor(Client *c) { return true; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user