summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.h
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-29 01:12:56 +0200
committertycho <work.tycho@gmail.com>2015-05-29 01:12:56 +0200
commit4956e8700d9a578fc65481c0fcfddf812366f08b (patch)
tree47ae313c74a228d254b08c5a146bbd2ea10e08b7 /src/Mobs/Monster.h
parentFix comments (diff)
parentFixed Info.lua documentation (diff)
downloadcuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.gz
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.bz2
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.lz
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.xz
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.zst
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.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 50bc02558..1076c9544 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));