QcMobPath Struct
Where a creature is going and the path it follows there (decision E-400). More...
| Header: | #include <server/pathing/QcMobPath.h> |
Public Types
| enum class | Purpose { None, Chase, Wander, Flee, Errand } |
Public Functions
Public Variables
| int | age |
| std::vector<QcBlockPos> | cells |
| int | closeEnough |
| double | closest |
| int | failures |
| QcVec3 | goal |
| std::size_t | next |
| bool | planned |
| QcBlockPos | plannedGoal |
| QcMobPath::Purpose | purpose |
| bool | queued |
| bool | reachesGoal |
| int | stuckTicks |
| int | waitTicks |
Detailed Description
The behaviour sets the goal (QcMobBehaviour), QcMobNavigator follows the path and asks for a new one, QcPathPlanner finds it within the tick's budget.
Member Type Documentation
enum class QcMobPath::Purpose
Why the creature goes to its goal.
| Constant | Value | Description |
|---|---|---|
QcMobPath::Purpose::None | 0 | No goal: the creature stands. |
QcMobPath::Purpose::Chase | 1 | It chases a target. |
QcMobPath::Purpose::Wander | 2 | It wanders. |
QcMobPath::Purpose::Flee | 3 | It flees. |
QcMobPath::Purpose::Errand | 4 | A villager going to its bed, workstation, meeting point or a crop (decision E-411); searched with the full budget, unlike a wanderer. |
Member Function Documentation
void QcMobPath::clear()
Forgets the goal and the path (the creature stands or picks a new goal).
bool QcMobPath::finished() const
Returns whether it walked the whole planned path.
bool QcMobPath::hasGoal() const
Returns whether it has a goal.
Member Variable Documentation
int QcMobPath::age
Ticks since the path was planned.
std::vector<QcBlockPos> QcMobPath::cells
The path, as feet cells.
int QcMobPath::closeEnough
How close to the goal counts as there (cells).
double QcMobPath::closest
Progress towards the next waypoint: the closest it came.
int QcMobPath::failures
Failures in a row.
QcVec3 QcMobPath::goal
The goal point.
std::size_t QcMobPath::next
The index in cells of the waypoint it walks to.
bool QcMobPath::planned
A search ran for the goal cell plannedGoal; the path gets there or ends at the closest cell the search reached.
QcBlockPos QcMobPath::plannedGoal
The goal cell the search ran for.
QcMobPath::Purpose QcMobPath::purpose
Why the creature goes to the goal.
bool QcMobPath::queued
Waiting in QcPathPlanner's queue.
bool QcMobPath::reachesGoal
Whether the path gets to plannedGoal.
int QcMobPath::stuckTicks
The ticks since it came closer to the next waypoint.
int QcMobPath::waitTicks
Ticks before it may ask again after a path that did not get there or got stuck; doubles with each such failure in a row (back-off), so an unreachable goal is not searched every tick.