summaryrefslogtreecommitdiffstats
path: root/source/Mobs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/Mobs/Skeleton.cpp15
-rw-r--r--source/Mobs/Skeleton.h1
-rw-r--r--source/Mobs/Zombie.cpp15
-rw-r--r--source/Mobs/Zombie.h1
4 files changed, 32 insertions, 0 deletions
diff --git a/source/Mobs/Skeleton.cpp b/source/Mobs/Skeleton.cpp
index 37a724848..3ca3ebbf7 100644
--- a/source/Mobs/Skeleton.cpp
+++ b/source/Mobs/Skeleton.cpp
@@ -3,6 +3,8 @@
#include "Skeleton.h"
#include "../World.h"
+#include "../Entities/ProjectileEntity.h"
+#include "../Entities/Entity.h"
@@ -28,3 +30,16 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+
+void cSkeleton::MoveToPosition(const Vector3f & a_Position)
+{
+ m_Destination = a_Position;
+
+ // If the destination is in the sun and if it is not night AND the skeleton isn't on fire then block the movement.
+ if ((m_World->GetBlockSkyLight((int) a_Position.x, (int) a_Position.y, (int) a_Position.z) == 15) && (m_World->GetTimeOfDay() < 13187) && !IsOnFire())
+ {
+ m_bMovingToDestination = false;
+ return;
+ }
+ m_bMovingToDestination = true;
+} \ No newline at end of file
diff --git a/source/Mobs/Skeleton.h b/source/Mobs/Skeleton.h
index 7a4af7e22..6cede1d22 100644
--- a/source/Mobs/Skeleton.h
+++ b/source/Mobs/Skeleton.h
@@ -18,6 +18,7 @@ public:
CLASS_PROTODEF(cSkeleton);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ virtual void MoveToPosition(const Vector3f & a_Position) override;
bool IsWither(void) const { return m_bIsWither; };
private:
diff --git a/source/Mobs/Zombie.cpp b/source/Mobs/Zombie.cpp
index 1752ec390..a485d2b55 100644
--- a/source/Mobs/Zombie.cpp
+++ b/source/Mobs/Zombie.cpp
@@ -30,3 +30,18 @@ void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+
+void cZombie::MoveToPosition(const Vector3f & a_Position)
+{
+ m_Destination = a_Position;
+
+ // If the destination is in the sun and if it is not night AND the skeleton isn't on fire then block the movement.
+ if ((m_World->GetBlockSkyLight((int) a_Position.x, (int) a_Position.y, (int) a_Position.z) == 15) && (m_World->GetTimeOfDay() < 13187) && !IsOnFire())
+ {
+ m_bMovingToDestination = false;
+ return;
+ }
+ m_bMovingToDestination = true;
+}
+
+
diff --git a/source/Mobs/Zombie.h b/source/Mobs/Zombie.h
index 148b1121e..7e14fe42f 100644
--- a/source/Mobs/Zombie.h
+++ b/source/Mobs/Zombie.h
@@ -17,6 +17,7 @@ public:
CLASS_PROTODEF(cZombie);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ virtual void MoveToPosition(const Vector3f & a_Position) override;
bool IsVillagerZombie(void) const {return m_bIsVillagerZombie; }
bool IsConverting(void) const {return m_bIsConverting; }