summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.h
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-05-28 21:51:26 +0200
committerworktycho <work.tycho@gmail.com>2015-05-28 21:51:26 +0200
commitb135ab8b956474f5538bef8b5fe9840419071716 (patch)
treef6e892e428f868fabd37231af76a37b1344a24b1 /src/Mobs/Monster.h
parentMerge pull request #2156 from SafwatHalaby/exit (diff)
parentAI - Sane Skeleton (diff)
downloadcuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.gz
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.bz2
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.lz
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.xz
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.tar.zst
cuberite-b135ab8b956474f5538bef8b5fe9840419071716.zip
Diffstat (limited to 'src/Mobs/Monster.h')
-rw-r--r--src/Mobs/Monster.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index c4043b0e5..fa23df3db 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -193,13 +193,16 @@ protected:
If no suitable position is found, returns cChunkDef::Height. */
int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ);
- /** Returns if the ultimate, final destination has been reached */
- bool ReachedFinalDestination(void) { return ((m_FinalDestination - GetPosition()).SqrLength() < (m_AttackRange * m_AttackRange)); }
+ /** Returns if the ultimate, final destination has been reached. */
+ bool ReachedFinalDestination(void) { return ((m_FinalDestination - GetPosition()).Length() < GetWidth()/2); }
+
+ /** Returns whether or not the target is close enough for attack. */
+ bool TargetIsInRange(void) { return ((m_FinalDestination - GetPosition()).SqrLength() < (m_AttackRange * m_AttackRange)); }
/** Returns if the intermediate waypoint of m_NextWayPointPosition has been reached */
bool ReachedNextWaypoint(void) { return ((m_NextWayPointPosition - GetPosition()).SqrLength() < 0.25); }
- /** Returns if a monster can reach a given height by jumping */
+ /** Returns if a monster can reach a given height by jumping. */
inline bool DoesPosYRequireJump(int a_PosY)
{
return ((a_PosY > POSY_TOINT) && (a_PosY == POSY_TOINT + 1));