QcMobNavigator Namespace
Following a creature's path (decision E-400): it walks from waypoint to waypoint with the shared physics (jumping where the next waypoint is higher), checks that the next waypoints can still be stood on, notices when it makes no progress, and asks QcPathPlanner for a new path when the goal moved, the path is blocked or it got stuck, a chase path is old, or a partial path ended. More...
| Header: | #include <server/pathing/QcMobNavigator.h> |
Classes
| struct | Navigation |
Variables
| const double | arriveDistance |
| const int | farGoalMove |
| const int | fullCheckTicks |
| const int | stuckTicks |
Functions
| bool | pathClear(const QcMobPath &path, bool all, const QcPathGround &ground) |
| bool | safeStep(const QcCreature &mob, const QcVec3 &direction, const QcPathGround &ground) |
| void | setGoal(QcCreature &mob, QcMobPath::Purpose purpose, const QcVec3 &goal, int closeEnough) |
| QcMobNavigator::Navigation | steer(QcCreature &mob, double speed, QcPathPlanner &planner, const QcBlockAccess &world, QcPathRules rules) |
| QcMobNavigator::Navigation | steerAlong(QcCreature &mob, double speed, QcPathPlanner &planner, const QcBlockAccess &world, QcPathRules rules) |
Detailed Description
After a path that did not get there it waits (QcMobPath::waitTicks) before it asks again, unless the path is blocked or the goal moved far (farGoalMove). Through an open door or trapdoor it keeps to the middle of the opening beside the panel, not to the middle of the cell (QcOpeningSteering, E-905).
Classes
class Navigation
What to do this tick: the steering, and a closed door on the path or in the doorway the creature stands in (only for creatures that open doors, QcPathRules::opensDoors: villagers open it, QcVillagerBehaviour). More...
Variable Documentation
const double QcMobNavigator::arriveDistance
Horizontal distance from a waypoint's centre at which it counts as reached.
const int QcMobNavigator::farGoalMove
While a creature waits after a search that did not get there (QcMobPath::waitTicks), a goal that moved is searched anew only when it moved at least this many cells: an unreachable prey running about is not searched every minReplanTicks.
const int QcMobNavigator::fullCheckTicks
Every this many ticks the whole rest of the path is checked, otherwise only the next waypoints.
const int QcMobNavigator::stuckTicks
Ticks without coming closer to the next waypoint until the creature counts as stuck.
Function Documentation
bool QcMobNavigator::pathClear(const QcMobPath &path, bool all, const QcPathGround &ground)
Returns whether the waypoints of path from the next one on (all of them, or the next two) can still be stood on, on ground.
bool QcMobNavigator::safeStep(const QcCreature &mob, const QcVec3 &direction, const QcPathGround &ground)
Returns whether a step in direction keeps mob on ground it can stand on: the cell ahead is level, a step up or a drop of at most QcPathRules::maxDrop or into deep water (pushes between creatures and coasting in a crowd must not take one off a cliff).
void QcMobNavigator::setGoal(QcCreature &mob, QcMobPath::Purpose purpose, const QcVec3 &goal, int closeEnough)
Gives mob the goal for purpose, there within closeEnough cells; a goal in another cell than the planned one is searched anew, a goal of another purpose starts without a path and without failures.
QcMobNavigator::Navigation QcMobNavigator::steer(QcCreature &mob, double speed, QcPathPlanner &planner, const QcBlockAccess &world, QcPathRules rules)
Returns the steering of mob along its path to its goal at speed in world under rules; asks planner for a path when needed. Without a goal the creature stands. With path finding switched off it walks straight at the goal.
QcMobNavigator::Navigation QcMobNavigator::steerAlong(QcCreature &mob, double speed, QcPathPlanner &planner, const QcBlockAccess &world, QcPathRules rules)
Returns the steering of mob like steer() (speed, planner, world, rules) without asking for a path (a throttled creature in a crowd, decision E-401): it keeps following the path it has, or stands without one.