summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Monster.h2
-rw-r--r--src/Mobs/Ocelot.cpp28
-rw-r--r--src/Mobs/Ocelot.h3
-rw-r--r--src/Mobs/Wolf.h2
4 files changed, 33 insertions, 2 deletions
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 42adfece5..268db6168 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -2,11 +2,11 @@
#pragma once
#include "../Entities/Pawn.h"
-#include "../Item.h"
#include "MonsterTypes.h"
#include "PathFinder.h"
+class cItem;
class cClientHandle;
diff --git a/src/Mobs/Ocelot.cpp b/src/Mobs/Ocelot.cpp
index 47776670c..e5004a1d1 100644
--- a/src/Mobs/Ocelot.cpp
+++ b/src/Mobs/Ocelot.cpp
@@ -6,6 +6,7 @@
#include "../Entities/Player.h"
#include "../Items/ItemHandler.h"
#include "Broadcaster.h"
+#include "../BoundingBox.h"
@@ -203,3 +204,30 @@ void cOcelot::SpawnOn(cClientHandle & a_ClientHandle)
+
+class cFindSittingCat :
+ public cEntityCallback
+{
+ virtual bool Item(cEntity * a_Entity) override
+ {
+ return (
+ (a_Entity->GetEntityType() == cEntity::etMonster) &&
+ (static_cast<cMonster *>(a_Entity)->GetMobType() == eMonsterType::mtOcelot) &&
+ (static_cast<cOcelot *>(a_Entity)->IsSitting())
+ );
+ }
+};
+
+
+
+
+
+bool cOcelot::IsCatSittingOnBlock(cWorld * a_World, Vector3d a_BlockPosition)
+{
+ cFindSittingCat FindSittingCat;
+ return a_World->ForEachEntityInBox(cBoundingBox(Vector3d(a_BlockPosition.x, a_BlockPosition.y + 1, a_BlockPosition.z), 1), FindSittingCat);
+}
+
+
+
+
diff --git a/src/Mobs/Ocelot.h b/src/Mobs/Ocelot.h
index 5729851fe..59b4f25af 100644
--- a/src/Mobs/Ocelot.h
+++ b/src/Mobs/Ocelot.h
@@ -54,6 +54,9 @@ public:
}
void SetCatType (eCatType a_CatType) { m_CatType = a_CatType; }
+ /** Returns true if there's a cat sitting above the given position */
+ static bool IsCatSittingOnBlock(cWorld * a_World, Vector3d a_BlockPosition);
+
protected:
bool m_IsSitting;
diff --git a/src/Mobs/Wolf.h b/src/Mobs/Wolf.h
index 70e761469..e05fedbf8 100644
--- a/src/Mobs/Wolf.h
+++ b/src/Mobs/Wolf.h
@@ -2,9 +2,9 @@
#pragma once
#include "PassiveAggressiveMonster.h"
-#include "../Entities/Entity.h"
+class cEntity;