mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Merge pull request #831 from noudess/master
Fix issue with roambox wait time after switch to new movement code.
This commit is contained in:
commit
03458b88a4
@ -307,6 +307,14 @@ namespace EQEmu
|
|||||||
|
|
||||||
} // namespace bug
|
} // namespace bug
|
||||||
|
|
||||||
|
namespace waypoints {
|
||||||
|
enum WaypointStatus : int {
|
||||||
|
wpsRoamBoxPauseInProgress = -3,
|
||||||
|
wpsQuestControlNoGrid = -2,
|
||||||
|
wpsQuestControlGrid = -1
|
||||||
|
};
|
||||||
|
} // waypoint_status behavior
|
||||||
|
|
||||||
} /*EQEmu*/
|
} /*EQEmu*/
|
||||||
|
|
||||||
#endif /*COMMON_EMU_CONSTANTS_H*/
|
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||||
|
|||||||
@ -1572,9 +1572,22 @@ void NPC::AI_DoMovement() {
|
|||||||
/**
|
/**
|
||||||
* Roambox logic sets precedence
|
* Roambox logic sets precedence
|
||||||
*/
|
*/
|
||||||
|
using EQEmu::waypoints::WaypointStatus;
|
||||||
|
|
||||||
if (roambox_distance > 0) {
|
if (roambox_distance > 0) {
|
||||||
|
|
||||||
if (!IsMoving()) {
|
// Check if we're already moving to a WP
|
||||||
|
// If so, if we're not moving we have arrived and need to set delay
|
||||||
|
|
||||||
|
if (GetCWP() == WaypointStatus::wpsRoamBoxPauseInProgress && !IsMoving()) {
|
||||||
|
// We have arrived
|
||||||
|
time_until_can_move = Timer::GetCurrentTime() + RandomTimer(roambox_min_delay, roambox_delay);
|
||||||
|
SetCurrentWP(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set a new destination
|
||||||
|
if (!IsMoving() && time_until_can_move < Timer::GetCurrentTime()) {
|
||||||
auto move_x = static_cast<float>(zone->random.Real(-roambox_distance, roambox_distance));
|
auto move_x = static_cast<float>(zone->random.Real(-roambox_distance, roambox_distance));
|
||||||
auto move_y = static_cast<float>(zone->random.Real(-roambox_distance, roambox_distance));
|
auto move_y = static_cast<float>(zone->random.Real(-roambox_distance, roambox_distance));
|
||||||
|
|
||||||
@ -1642,12 +1655,10 @@ void NPC::AI_DoMovement() {
|
|||||||
roambox_min_y,
|
roambox_min_y,
|
||||||
roambox_max_y,
|
roambox_max_y,
|
||||||
roambox_destination_y);
|
roambox_destination_y);
|
||||||
}
|
Log(Logs::Detail, Logs::NPCRoamBox, "Dest Z is (%f)", roambox_destination_z);
|
||||||
|
|
||||||
NavigateTo(roambox_destination_x, roambox_destination_y, roambox_destination_z);
|
SetCurrentWP(WaypointStatus::wpsRoamBoxPauseInProgress);
|
||||||
|
NavigateTo(roambox_destination_x, roambox_destination_y, roambox_destination_z);
|
||||||
if (m_Position.x == roambox_destination_x && m_Position.y == roambox_destination_y) {
|
|
||||||
time_until_can_move = Timer::GetCurrentTime() + RandomTimer(roambox_min_delay, roambox_delay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -1660,7 +1671,7 @@ void NPC::AI_DoMovement() {
|
|||||||
|
|
||||||
int32 gridno = CastToNPC()->GetGrid();
|
int32 gridno = CastToNPC()->GetGrid();
|
||||||
|
|
||||||
if (gridno > 0 || cur_wp == -2) {
|
if (gridno > 0 || cur_wp == WaypointStatus::wpsQuestControlNoGrid) {
|
||||||
if (pause_timer_complete == true) { // time to pause at wp is over
|
if (pause_timer_complete == true) { // time to pause at wp is over
|
||||||
AI_SetupNextWaypoint();
|
AI_SetupNextWaypoint();
|
||||||
} // endif (pause_timer_complete==true)
|
} // endif (pause_timer_complete==true)
|
||||||
@ -1692,7 +1703,7 @@ void NPC::AI_DoMovement() {
|
|||||||
// as that is where roamer is unset and we don't want
|
// as that is where roamer is unset and we don't want
|
||||||
// the next trip through to move again based on grid stuff.
|
// the next trip through to move again based on grid stuff.
|
||||||
doMove = false;
|
doMove = false;
|
||||||
if (cur_wp == -2) {
|
if (cur_wp == WaypointStatus::wpsQuestControlNoGrid) {
|
||||||
AI_SetupNextWaypoint();
|
AI_SetupNextWaypoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1791,8 +1802,10 @@ void NPC::AI_SetupNextWaypoint() {
|
|||||||
pause_timer_complete = false;
|
pause_timer_complete = false;
|
||||||
Log(Logs::Detail, Logs::Pathing, "We are departing waypoint %d.", cur_wp);
|
Log(Logs::Detail, Logs::Pathing, "We are departing waypoint %d.", cur_wp);
|
||||||
|
|
||||||
|
using EQEmu::waypoints::WaypointStatus;
|
||||||
|
|
||||||
//if we were under quest control (with no grid), we are done now..
|
//if we were under quest control (with no grid), we are done now..
|
||||||
if (cur_wp == -2) {
|
if (cur_wp == WaypointStatus::wpsQuestControlNoGrid) {
|
||||||
Log(Logs::Detail, Logs::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode.");
|
Log(Logs::Detail, Logs::Pathing, "Non-grid quest mob has reached its quest ordered waypoint. Leaving pathing mode.");
|
||||||
roamer = false;
|
roamer = false;
|
||||||
cur_wp = 0;
|
cur_wp = 0;
|
||||||
|
|||||||
@ -108,7 +108,7 @@ void NPC::ResumeWandering()
|
|||||||
{ // we were paused by a quest
|
{ // we were paused by a quest
|
||||||
AI_walking_timer->Disable();
|
AI_walking_timer->Disable();
|
||||||
SetGrid(0 - GetGrid());
|
SetGrid(0 - GetGrid());
|
||||||
if (cur_wp == -1)
|
if (cur_wp == EQEmu::waypoints::WaypointStatus::wpsQuestControlGrid)
|
||||||
{ // got here by a MoveTo()
|
{ // got here by a MoveTo()
|
||||||
cur_wp = save_wp;
|
cur_wp = save_wp;
|
||||||
UpdateWaypoint(cur_wp); // have him head to last destination from here
|
UpdateWaypoint(cur_wp); // have him head to last destination from here
|
||||||
@ -166,6 +166,9 @@ void NPC::PauseWandering(int pausetime)
|
|||||||
|
|
||||||
void NPC::MoveTo(const glm::vec4& position, bool saveguardspot)
|
void NPC::MoveTo(const glm::vec4& position, bool saveguardspot)
|
||||||
{ // makes mob walk to specified location
|
{ // makes mob walk to specified location
|
||||||
|
|
||||||
|
using EQEmu::waypoints::WaypointStatus;
|
||||||
|
|
||||||
if (IsNPC() && GetGrid() != 0)
|
if (IsNPC() && GetGrid() != 0)
|
||||||
{ // he is on a grid
|
{ // he is on a grid
|
||||||
if (GetGrid() < 0)
|
if (GetGrid() < 0)
|
||||||
@ -177,7 +180,7 @@ void NPC::MoveTo(const glm::vec4& position, bool saveguardspot)
|
|||||||
if (cur_wp >= 0)
|
if (cur_wp >= 0)
|
||||||
{ // we've not already done a MoveTo()
|
{ // we've not already done a MoveTo()
|
||||||
save_wp = cur_wp; // save the current waypoint
|
save_wp = cur_wp; // save the current waypoint
|
||||||
cur_wp = -1; // flag this move as quest controlled
|
cur_wp = WaypointStatus::wpsQuestControlGrid;
|
||||||
}
|
}
|
||||||
Log(Logs::Detail, Logs::AI, "MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d", to_string(static_cast<glm::vec3>(position)).c_str(), -GetGrid(), save_wp);
|
Log(Logs::Detail, Logs::AI, "MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d", to_string(static_cast<glm::vec3>(position)).c_str(), -GetGrid(), save_wp);
|
||||||
}
|
}
|
||||||
@ -185,7 +188,7 @@ void NPC::MoveTo(const glm::vec4& position, bool saveguardspot)
|
|||||||
{ // not on a grid
|
{ // not on a grid
|
||||||
roamer = true;
|
roamer = true;
|
||||||
save_wp = 0;
|
save_wp = 0;
|
||||||
cur_wp = -2; // flag as quest controlled w/no grid
|
cur_wp = WaypointStatus::wpsQuestControlNoGrid;
|
||||||
Log(Logs::Detail, Logs::AI, "MoveTo %s without a grid.", to_string(static_cast<glm::vec3>(position)).c_str());
|
Log(Logs::Detail, Logs::AI, "MoveTo %s without a grid.", to_string(static_cast<glm::vec3>(position)).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user