summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.h
diff options
context:
space:
mode:
authorSafwatHalaby <SafwatHalaby@users.noreply.github.com>2015-05-28 16:45:47 +0200
committerSafwatHalaby <SafwatHalaby@users.noreply.github.com>2015-05-28 18:19:56 +0200
commitf1540173da442878e132b0bbca1f8f60141e1cd0 (patch)
tree167748cd3f296946e245bc3809cf41153bd88c36 /src/Mobs/Monster.h
parentMerge pull request #2152 from mc-server/fixes (diff)
downloadcuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.gz
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.bz2
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.lz
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.xz
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.zst
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.zip
Diffstat (limited to '')
-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));