summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Skeleton.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-05-01 13:47:48 +0200
committerMattes D <github@xoft.cz>2015-05-01 13:47:48 +0200
commitaa142757dbf34fca603799aaef2a4dc047b0bd14 (patch)
tree7caec55ca1792af1d0e3bcb7a8b44eeff65ac15f /src/Mobs/Skeleton.cpp
parentMerge pull request #1924 from mc-server/BlockAreaCountNonAir (diff)
parentA* Pathfinding and better monster AI (diff)
downloadcuberite-aa142757dbf34fca603799aaef2a4dc047b0bd14.tar
cuberite-aa142757dbf34fca603799aaef2a4dc047b0bd14.tar.gz
cuberite-aa142757dbf34fca603799aaef2a4dc047b0bd14.tar.bz2
cuberite-aa142757dbf34fca603799aaef2a4dc047b0bd14.tar.lz
cuberite-aa142757dbf34fca603799aaef2a4dc047b0bd14.tar.xz
cuberite-aa142757dbf34fca603799aaef2a4dc047b0bd14.tar.zst
cuberite-aa142757dbf34fca603799aaef2a4dc047b0bd14.zip
Diffstat (limited to 'src/Mobs/Skeleton.cpp')
-rw-r--r--src/Mobs/Skeleton.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index 331c8e8ad..ef049f8d4 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -37,7 +37,7 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
else
{
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ARROW);
-
+
}
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
AddRandomArmorDropItem(a_Drops, LootingLevel);
@@ -50,17 +50,18 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
void cSkeleton::MoveToPosition(const Vector3d & a_Position)
{
- // If the destination is sufficiently skylight challenged AND the skeleton isn't on fire then block the movement
+ // Todo use WouldBurnAt(), not sure how to obtain a chunk though...
+ super::MoveToPosition(a_Position); // Look at the player and update m_Destination to hit them if they're close
+
+ // If the destination is sufficiently skylight challenged AND the skeleton isn't on fire AND we weren't attacked recently then block the movement
if (
!IsOnFire() &&
- (m_World->GetBlockSkyLight((int)floor(a_Position.x), (int)floor(a_Position.y), (int)floor(a_Position.z)) - m_World->GetSkyDarkness() > 8)
+ (m_World->GetBlockSkyLight((int)floor(a_Position.x), (int)floor(a_Position.y), (int)floor(a_Position.z)) - m_World->GetSkyDarkness() > 8) &&
+ m_TicksSinceLastDamaged == 100
)
{
- m_bMovingToDestination = false;
- return;
+ StopMovingToPosition();
}
-
- super::MoveToPosition(a_Position);
}