mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-25 21:02:26 +00:00
Some bug fixes
This commit is contained in:
parent
7278c6294d
commit
4815cabb63
@ -7260,6 +7260,7 @@ void command_pf(Client *c, const Seperator *sep)
|
|||||||
c->Message(0, "POS: (%.2f, %.2f, %.2f)", who->GetX(), who->GetY(), who->GetZ());
|
c->Message(0, "POS: (%.2f, %.2f, %.2f)", who->GetX(), who->GetY(), who->GetZ());
|
||||||
c->Message(0, "WP: %s (%d/%d)", to_string(who->GetCurrentWayPoint()).c_str(), who->IsNPC()?who->CastToNPC()->GetMaxWp():-1);
|
c->Message(0, "WP: %s (%d/%d)", to_string(who->GetCurrentWayPoint()).c_str(), who->IsNPC()?who->CastToNPC()->GetMaxWp():-1);
|
||||||
c->Message(0, "pause=%d RAspeed=%d", who->GetCWPP(), who->GetRunAnimSpeed());
|
c->Message(0, "pause=%d RAspeed=%d", who->GetCWPP(), who->GetRunAnimSpeed());
|
||||||
|
who->DumpMovement(c);
|
||||||
} else {
|
} else {
|
||||||
c->Message(0, "ERROR: target required");
|
c->Message(0, "ERROR: target required");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -969,7 +969,7 @@ public:
|
|||||||
|
|
||||||
inline bool CheckAggro(Mob* other) {return hate_list.IsEntOnHateList(other);}
|
inline bool CheckAggro(Mob* other) {return hate_list.IsEntOnHateList(other);}
|
||||||
float CalculateHeadingToTarget(float in_x, float in_y) { return HeadingAngleToMob(in_x, in_y); }
|
float CalculateHeadingToTarget(float in_x, float in_y) { return HeadingAngleToMob(in_x, in_y); }
|
||||||
virtual void CalculateNewPosition(float x, float y, float z, float speed, bool check_z = true, bool calculate_heading = true);
|
void CalculateNewPosition(float x, float y, float z, float speed, bool check_z = true, bool calculate_heading = true);
|
||||||
float CalculateDistance(float x, float y, float z);
|
float CalculateDistance(float x, float y, float z);
|
||||||
float GetGroundZ(float new_x, float new_y, float z_offset=0.0);
|
float GetGroundZ(float new_x, float new_y, float z_offset=0.0);
|
||||||
void SendTo(float new_x, float new_y, float new_z);
|
void SendTo(float new_x, float new_y, float new_z);
|
||||||
@ -978,7 +978,8 @@ public:
|
|||||||
float GetDefaultRaceSize() const;
|
float GetDefaultRaceSize() const;
|
||||||
void TryFixZ(int32 z_find_offset = 5, bool fix_client_z = false);
|
void TryFixZ(int32 z_find_offset = 5, bool fix_client_z = false);
|
||||||
void FixZ(int32 z_find_offset = 5, bool fix_client_z = false);
|
void FixZ(int32 z_find_offset = 5, bool fix_client_z = false);
|
||||||
float GetFixedZ(glm::vec3 destination, int32 z_find_offset = 5);
|
float GetFixedZ(const glm::vec3 &destination, int32 z_find_offset = 5);
|
||||||
|
void DumpMovement(Client *to);
|
||||||
|
|
||||||
void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false);
|
void NPCSpecialAttacks(const char* parse, int permtag, bool reset = true, bool remove = false);
|
||||||
inline uint32 DontHealMeBefore() const { return pDontHealMeBefore; }
|
inline uint32 DontHealMeBefore() const { return pDontHealMeBefore; }
|
||||||
|
|||||||
@ -185,6 +185,35 @@ void MobMovementManager::StopNavigation(Mob *who) {
|
|||||||
auto iter = _impl->MoveEntries.find(who);
|
auto iter = _impl->MoveEntries.find(who);
|
||||||
auto &ent = iter->second;
|
auto &ent = iter->second;
|
||||||
ent.active = false;
|
ent.active = false;
|
||||||
|
|
||||||
|
SendPosition(who);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MobMovementManager::Dump(Mob *m, Client *to)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
auto iter = _impl->Entries.find(m);
|
||||||
|
auto &ent = iter->second;
|
||||||
|
|
||||||
|
to->Message(0, "Packet: anim=%d, heading=%.2f, dirty=%s, last_sent_time=%.2f, last_sent_time_long_dist=%.2f",
|
||||||
|
ent.animation,
|
||||||
|
ent.heading,
|
||||||
|
ent.dirty ? "true" : "false",
|
||||||
|
ent.last_sent_time,
|
||||||
|
ent.last_sent_time_long_distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto iter = _impl->MoveEntries.find(m);
|
||||||
|
auto &ent = iter->second;
|
||||||
|
|
||||||
|
to->Message(0, "Movement: speed=%.2f, x=%.2f, y=%.2f, z=%.2f, active=%s",
|
||||||
|
ent.speed,
|
||||||
|
ent.x,
|
||||||
|
ent.y,
|
||||||
|
ent.z,
|
||||||
|
ent.active ? "true" : "false");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MobMovementManager::HeadingEqual(float a, float b)
|
bool MobMovementManager::HeadingEqual(float a, float b)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ public:
|
|||||||
void SendPositionUpdate(Mob *who, bool send_to_self);
|
void SendPositionUpdate(Mob *who, bool send_to_self);
|
||||||
void NavigateTo(Mob *who, float x, float y, float z, float speed);
|
void NavigateTo(Mob *who, float x, float y, float z, float speed);
|
||||||
void StopNavigation(Mob *who);
|
void StopNavigation(Mob *who);
|
||||||
|
void Dump(Mob *m, Client *to);
|
||||||
|
|
||||||
static MobMovementManager &Get() {
|
static MobMovementManager &Get() {
|
||||||
static MobMovementManager inst;
|
static MobMovementManager inst;
|
||||||
|
|||||||
@ -7,21 +7,6 @@
|
|||||||
|
|
||||||
extern Zone *zone;
|
extern Zone *zone;
|
||||||
|
|
||||||
void AdjustRoute(std::list<IPathfinder::IPathNode> &nodes, int flymode, float offset) {
|
|
||||||
if (!zone->HasMap() || !zone->HasWaterMap()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto &node : nodes) {
|
|
||||||
if (flymode == GravityBehavior::Ground || !zone->watermap->InLiquid(node.pos)) {
|
|
||||||
auto best_z = zone->zonemap->FindBestZ(node.pos, nullptr);
|
|
||||||
if (best_z != BEST_Z_INVALID) {
|
|
||||||
node.pos.z = best_z + offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &WaypointChanged, bool &NodeReached)
|
glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &WaypointChanged, bool &NodeReached)
|
||||||
{
|
{
|
||||||
glm::vec3 To(ToX, ToY, ToZ);
|
glm::vec3 To(ToX, ToY, ToZ);
|
||||||
@ -42,7 +27,6 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
|||||||
bool partial = false;
|
bool partial = false;
|
||||||
bool stuck = false;
|
bool stuck = false;
|
||||||
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
||||||
AdjustRoute(Route, flymode, GetZOffset());
|
|
||||||
|
|
||||||
PathingDestination = To;
|
PathingDestination = To;
|
||||||
WaypointChanged = true;
|
WaypointChanged = true;
|
||||||
@ -66,7 +50,6 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
|||||||
bool partial = false;
|
bool partial = false;
|
||||||
bool stuck = false;
|
bool stuck = false;
|
||||||
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
||||||
AdjustRoute(Route, flymode, GetZOffset());
|
|
||||||
|
|
||||||
PathingDestination = To;
|
PathingDestination = To;
|
||||||
WaypointChanged = true;
|
WaypointChanged = true;
|
||||||
@ -86,27 +69,27 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!IsRooted()) {
|
if (!IsRooted()) {
|
||||||
//bool AtPrevNode = DistanceSquared(From, PathingLastPosition) < 1.0f;
|
bool AtPrevNode = DistanceSquared(From, PathingLastPosition) < 1.0f;
|
||||||
//if (AtPrevNode) {
|
if (AtPrevNode) {
|
||||||
// PathingLoopCount++;
|
PathingLoopCount++;
|
||||||
// auto front = (*Route.begin()).pos;
|
auto front = (*Route.begin()).pos;
|
||||||
//
|
|
||||||
// if (PathingLoopCount > 5) {
|
if (PathingLoopCount > 5) {
|
||||||
// Teleport(front);
|
Teleport(front);
|
||||||
// SendPosition();
|
SendPosition();
|
||||||
// Route.pop_front();
|
Route.pop_front();
|
||||||
//
|
|
||||||
// WaypointChanged = true;
|
WaypointChanged = true;
|
||||||
// NodeReached = true;
|
NodeReached = true;
|
||||||
// PathingLoopCount = 0;
|
PathingLoopCount = 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return front;
|
return front;
|
||||||
//}
|
}
|
||||||
//else {
|
else {
|
||||||
PathingLastPosition = From;
|
PathingLastPosition = From;
|
||||||
PathingLoopCount = 0;
|
PathingLoopCount = 0;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PathingLastPosition = From;
|
PathingLastPosition = From;
|
||||||
@ -133,7 +116,6 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
|||||||
bool partial = false;
|
bool partial = false;
|
||||||
bool stuck = false;
|
bool stuck = false;
|
||||||
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
Route = zone->pathing->FindRoute(From, To, partial, stuck);
|
||||||
AdjustRoute(Route, flymode, GetZOffset());
|
|
||||||
PathingDestination = To;
|
PathingDestination = To;
|
||||||
WaypointChanged = true;
|
WaypointChanged = true;
|
||||||
|
|
||||||
|
|||||||
@ -573,7 +573,7 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Mob::GetFixedZ(glm::vec3 destination, int32 z_find_offset) {
|
float Mob::GetFixedZ(const glm::vec3 &destination, int32 z_find_offset) {
|
||||||
BenchTimer timer;
|
BenchTimer timer;
|
||||||
timer.reset();
|
timer.reset();
|
||||||
|
|
||||||
@ -615,6 +615,11 @@ float Mob::GetFixedZ(glm::vec3 destination, int32 z_find_offset) {
|
|||||||
return new_z;
|
return new_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Mob::DumpMovement(Client *to)
|
||||||
|
{
|
||||||
|
mMovementManager->Dump(this, to);
|
||||||
|
}
|
||||||
|
|
||||||
void Mob::FixZ(int32 z_find_offset /*= 5*/, bool fix_client_z /*= false*/) {
|
void Mob::FixZ(int32 z_find_offset /*= 5*/, bool fix_client_z /*= false*/) {
|
||||||
glm::vec3 current_loc(m_Position);
|
glm::vec3 current_loc(m_Position);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user