Tweaks to log.out to filter messages at detail level not just cat level before formatting the message, tweaks to pathing, nearly where i want it but not entirely there.

This commit is contained in:
KimLS
2016-01-15 14:32:00 -08:00
parent 14d8683227
commit 1d055b5364
4 changed files with 62 additions and 64 deletions
+19 -22
View File
@@ -108,7 +108,8 @@ Mob::Mob(const char* in_name,
m_TargetLocation(glm::vec3()),
m_TargetV(glm::vec3()),
flee_timer(FLEE_CHECK_TIMER),
m_Position(position)
m_Position(position),
m_pos_update_timer(3000)
{
targeted = 0;
tar_ndx=0;
@@ -119,7 +120,8 @@ Mob::Mob(const char* in_name,
SetMoving(false);
moved=false;
m_RewindLocation = glm::vec3();
move_tic_count = 0;
m_pos_update_heading = INVALID_POS_HEADING;
m_pos_update_speed = 0;
_egnode = nullptr;
name[0]=0;
@@ -1372,39 +1374,34 @@ void Mob::SendPosition()
EQApplicationPacket* app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
MakeSpawnUpdateNoDelta(spu);
move_tic_count = 0;
m_pos_update_heading = INVALID_POS_HEADING;
m_pos_update_speed = 0;
entity_list.QueueClients(this, app, true);
safe_delete(app);
}
// this one is for mobs on the move, with deltas - this makes them walk
void Mob::SendPosUpdate(uint8 iSendToSelf) {
EQApplicationPacket* app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer;
EQApplicationPacket app(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
PlayerPositionUpdateServer_Struct* spu = (PlayerPositionUpdateServer_Struct*)app.pBuffer;
MakeSpawnUpdate(spu);
if (iSendToSelf == 2) {
if (IsClient()) {
CastToClient()->FastQueuePacket(&app,false);
}
if (IsClient() && iSendToSelf) {
CastToClient()->QueuePacket(&app,false);
}
else
{
if(move_tic_count == RuleI(Zone, NPCPositonUpdateTicCount))
if (m_pos_update_heading == INVALID_POS_HEADING ||
m_pos_update_timer.Check() ||
m_pos_update_speed != pRunAnimSpeed ||
abs(m_pos_update_heading - GetHeading()) > INVALID_POS_HEADING_EPS)
{
entity_list.QueueClients(this, app, (iSendToSelf == 0), false);
move_tic_count = 0;
}
else if(move_tic_count % 2 == 0)
{
entity_list.QueueCloseClients(this, app, (iSendToSelf == 0), 700, nullptr, false);
move_tic_count++;
}
else {
move_tic_count++;
m_pos_update_speed = pRunAnimSpeed;
m_pos_update_heading = GetHeading();
entity_list.QueueCloseClients(this, &app, (iSendToSelf == 0), 1000, nullptr, false);
m_pos_update_timer.Start();
}
}
safe_delete(app);
}
// this is for SendPosition()
@@ -1444,7 +1441,7 @@ void Mob::MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu) {
if(this->IsClient())
spu->animation = animation;
else
spu->animation = pRunAnimSpeed;//animation;
spu->animation = pRunAnimSpeed;
spu->delta_heading = NewFloatToEQ13(m_Delta.w);
}
+6 -3
View File
@@ -32,6 +32,8 @@
char* strn0cpy(char* dest, const char* source, uint32 size);
#define MAX_SPECIAL_ATTACK_PARAMS 8
#define INVALID_POS_HEADING -99999.0
#define INVALID_POS_HEADING_EPS 0.01
class EGNode;
class Client;
@@ -1286,12 +1288,13 @@ protected:
int32 GetItemFactionBonus(uint32 pFactionID);
void ClearItemFactionBonuses();
void CalculateFearPosition();
uint32 move_tic_count;
bool flee_mode;
Timer flee_timer;
Timer m_pos_update_timer;
float m_pos_update_heading;
uint8 m_pos_update_speed;
bool pAIControlled;
bool roamer;
bool logging_enabled;
+11 -5
View File
@@ -19,18 +19,24 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if (to == from)
return to;
if (DistanceSquaredNoZ(m_Position, glm::vec4(ToX, ToY, ToZ, 0.0f)) < 100.0f) {
return to;
}
if (!m_pathing_route.Active() || !m_pathing_route.DestinationValid(to)) {
m_pathing_route = zone->pathing.FindRoute(from, to);
auto &nodes = m_pathing_route.GetNodesEdit();
auto &last_node = nodes[nodes.size() - 1];
if (DistanceSquared(glm::vec4(last_node.position, 1.0f), glm::vec4(ToX, ToY, ToZ, 0.0f)) > 100.0f) {
auto dist = DistanceSquared(glm::vec4(last_node.position, 1.0f), glm::vec4(ToX, ToY, ToZ, 0.0f));
if (dist > 10000.0f) {
auto flag_temp = last_node.flag;
last_node.flag = NavigationPolyFlagPortal;
PathfindingNode end;
end.position.x = ToX;
end.position.y = ToY;
end.position.z = ToZ;
end.flag = flag_temp;
nodes.push_back(end);
}
else if (dist > 100.0f) {
PathfindingNode end;
end.position.x = ToX;
end.position.y = ToY;