mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Roambox] Improve Path Finding (#2324)
This commit is contained in:
parent
dd71420a0e
commit
113846c48c
@ -1602,9 +1602,8 @@ void NPC::AI_DoMovement() {
|
|||||||
move_delay_max
|
move_delay_max
|
||||||
);
|
);
|
||||||
|
|
||||||
Log(
|
LogNPCRoamBoxDetail(
|
||||||
Logs::Detail,
|
"({}) Timer calc | random_timer [{}] roambox_move_delay [{}] move_min [{}] move_max [{}]",
|
||||||
Logs::NPCRoamBox, "(%s) Timer calc | random_timer [%i] roambox_move_delay [%i] move_min [%i] move_max [%i]",
|
|
||||||
GetCleanName(),
|
GetCleanName(),
|
||||||
random_timer,
|
random_timer,
|
||||||
roambox_move_delay,
|
roambox_move_delay,
|
||||||
@ -1661,9 +1660,7 @@ void NPC::AI_DoMovement() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (zone->watermap->InLiquid(position)) {
|
if (zone->watermap->InLiquid(position)) {
|
||||||
Log(Logs::Detail,
|
LogNPCRoamBoxDetail("[{}] | My destination is in water and I don't belong there!", GetCleanName());
|
||||||
Logs::NPCRoamBox, "%s | My destination is in water and I don't belong there!",
|
|
||||||
GetCleanName());
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1683,39 +1680,12 @@ void NPC::AI_DoMovement() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PathfinderOptions opts;
|
LogNPCRoamBox("[{}] | Pathing to [{}] [{}] [{}]", GetCleanName(),
|
||||||
opts.smooth_path = true;
|
roambox_destination_x, roambox_destination_y,
|
||||||
opts.step_size = RuleR(Pathing, NavmeshStepSize);
|
roambox_destination_z);
|
||||||
opts.offset = GetZOffset();
|
|
||||||
opts.flags = PathingNotDisabled ^ PathingZoneLine;
|
|
||||||
|
|
||||||
auto partial = false;
|
LogNPCRoamBox(
|
||||||
auto stuck = false;
|
"NPC ({}) distance [{}] X (min/max) [{} / {}] Y (min/max) [{} / {}] | Dest x/y/z [{} / {} / {}]",
|
||||||
auto route = zone->pathing->FindPath(
|
|
||||||
glm::vec3(GetX(), GetY(), GetZ()),
|
|
||||||
glm::vec3(
|
|
||||||
roambox_destination_x,
|
|
||||||
roambox_destination_y,
|
|
||||||
roambox_destination_z
|
|
||||||
),
|
|
||||||
partial,
|
|
||||||
stuck,
|
|
||||||
opts
|
|
||||||
);
|
|
||||||
|
|
||||||
if (route.empty()) {
|
|
||||||
Log(
|
|
||||||
Logs::Detail,
|
|
||||||
Logs::NPCRoamBox, "(%s) We don't have a path route... exiting...",
|
|
||||||
GetCleanName()
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log(
|
|
||||||
Logs::General,
|
|
||||||
Logs::NPCRoamBox,
|
|
||||||
"NPC (%s) distance [%.0f] X (min/max) [%.0f / %.0f] Y (min/max) [%.0f / %.0f] | Dest x/y/z [%.0f / %.0f / %.0f]",
|
|
||||||
GetCleanName(),
|
GetCleanName(),
|
||||||
roambox_distance,
|
roambox_distance,
|
||||||
roambox_min_x,
|
roambox_min_x,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user