QcNeutralBrain Class
The brain of neutral creatures (QcMobDefinition::Ai::Neutral, decision E-460; the shadewalker): they wander like passive ones until a player provokes them, then chase that player like hostile ones for angerSeconds, renewed while they see them. More...
| Header: | #include <server/mobbrains/QcNeutralBrain.h> |
| Inherits: | QcPassiveBrain |
Reimplemented Public Functions
| virtual QcPhysics::Steering | think(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, int thinkTicks) override |
Static Public Members
| const double | angerSeconds |
| const double | farTarget |
| bool | gazedAt(const QcMobManager::PlayerView &player, const QcVec3 &head, const QcGazeDefinition &gaze, const QcBlockAccess &world) |
Detailed Description
A player provokes one by hurting it (the player who struck or shot it; damage without a player provokes nobody) or, with a gaze, by looking at its head (gazedAt). One with teleport leaves water at once and now and then teleports next to a target that is far away; one that carries blocks takes one now and then while calm and puts it down again elsewhere (actions in QcMobBrain::Context::blockActions, only when it may change the world, QcCreature::mayGrief: the game rule mobGriefing on, not confined, decision E-510; otherwise a carried block is dropped as an item instead of put down).
Member Function Documentation
[static] bool QcNeutralBrain::gazedAt(const QcMobManager::PlayerView &player, const QcVec3 &head, const QcGazeDefinition &gaze, const QcBlockAccess &world)
Returns whether player looks at a head at head in world: their look (QcMobManager::PlayerView::look) and the direction to the head agree within gaze's tolerance, which narrows with the distance d (look · direction > 1 − tolerance / d, like the reference game), from no farther than its range, and nothing hides it from their eyes (QcLineOfSight::seesPoint).
[override virtual] QcPhysics::Steering QcNeutralBrain::think(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, int thinkTicks)
Reimplements: QcPassiveBrain::think(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, int thinkTicks).
Member Variable Documentation
const double QcNeutralBrain::angerSeconds
Seconds a provoked creature stays angry after it last saw its target.
const double QcNeutralBrain::farTarget
A target farther than this (metres) may make an angry teleporter jump next to it.