QcMobBrain Class
What decides what a creature does (decision E-423), one of each kind of AI (QcMobDefinition::ai) in QcMobBehaviour, shared by all creatures with that AI: their state is in the creature (QcCreature, its components). More...
| Header: | #include <server/mobbrains/QcMobBrain.h> |
| Inherited By: |
Public Types
| struct | Context |
Public Functions
| QcMobBrain() | |
| QcMobBrain(const QcMobBrain &) | |
| virtual | ~QcMobBrain() |
| virtual void | leave(const QcCreature &) |
| virtual bool | rest(QcCreature &, const QcMobBrain::Context &) |
| virtual QcPhysics::Steering | think(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, int thinkTicks) = 0 |
| virtual bool | thinksInIdleCrowd() const |
| QcMobBrain & | operator=(const QcMobBrain &) |
Detailed Description
QcMobBehaviour keeps what all of them share: the tiers of a crowd, the push of the crowd, the physics and flight. A new kind of creature (golems, tamed animals, archers) brings its own brain instead of a branch in QcMobBehaviour.
Member Function Documentation
[constexpr noexcept default] QcMobBrain::QcMobBrain()
Default-constructs an instance of QcMobBrain.
[delete] QcMobBrain::QcMobBrain(const QcMobBrain &)
Copy-constructs an instance of QcMobBrain. This function is deleted.
[virtual constexpr noexcept default] QcMobBrain::~QcMobBrain()
Destroys the instance of QcMobBrain. This destructor is virtual.
[virtual] void QcMobBrain::leave(const QcCreature &)
The creature leaves the world for good (died, removed, despawned; not unloaded).
[virtual] bool QcMobBrain::rest(QcCreature &, const QcMobBrain::Context &)
Asked for a creature that does not stand (QcPose::Lying, a villager in its bed; Sitting): it stays so without physics while this returns true; otherwise it thinks this tick, in the pose the brain leaves it in (the villagers' brain gets a villager up).
[pure virtual] QcPhysics::Steering QcMobBrain::think(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, int thinkTicks)
Decides what mob of the kind definition does and how it moves in the tick of context and returns its steering. A creature in a crowd thinks every thinkTicks ticks (1: every tick) and may then not search a path (QcMobCrowd::Tier).
[virtual] bool QcMobBrain::thinksInIdleCrowd() const
Returns whether it still thinks, in the slowest turn, in a crowd so dense that the others stand (villagers: a crowd that met at the bell goes home at night).
[delete] QcMobBrain &QcMobBrain::operator=(const QcMobBrain &)
Copy-assigns other to this QcMobBrain instance. This function is deleted.