Prevent client update while on boat if boat turning (#1343)

Co-authored-by: Noudess <noudess@gmail.com>
This commit is contained in:
Paul Coene 2021-05-10 02:15:38 -04:00 committed by GitHub
parent 0758250ad1
commit b335568bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 0 deletions

View File

@ -4474,6 +4474,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
LogError("Can't find boat for client position offset.");
}
else {
if (boat->turning) return;
// Calculate angle from boat heading to EQ heading
double theta = std::fmod(((boat->GetHeading() * 360.0) / 512.0),360.0);
double thetar = (theta * M_PI) / 180.0;

View File

@ -131,6 +131,7 @@ Mob::Mob(
AI_Init();
SetMoving(false);
moved = false;
turning = false;
m_RewindLocation = glm::vec3();
m_RelativePosition = glm::vec4();

View File

@ -1486,6 +1486,7 @@ public:
bool GetWasSpawnedInWater() const;
void SetSpawnedInWater(bool spawned_in_water);
bool turning;
protected:

View File

@ -63,6 +63,7 @@ public:
if (!m_started) {
m_started = true;
mob->turning = true;
mob->SetMoving(true);
if (dist > 15.0f && rotate_to_speed > 0.0 && rotate_to_speed <= 25.0) { //send basic rotation
@ -84,6 +85,7 @@ public:
mob->SetHeading(to);
mob->SetMoving(false);
mob_movement_manager->SendCommandToClients(mob, 0.0, 0.0, 0.0, 0.0, 0, ClientRangeCloseMedium);
mob->turning = false;
return true;
}
@ -1370,7 +1372,9 @@ void MobMovementManager::UpdatePathBoat(Mob *who, float x, float y, float z, Mob
{
auto eiter = _impl->Entries.find(who);
auto &ent = (*eiter);
float to = who->CalculateHeadingToTarget(x, y);
PushRotateTo(ent.second, who, to, mode);
PushSwimTo(ent.second, x, y, z, mode);
PushStopMoving(ent.second);
}