summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-11-03 09:20:56 +0100
committerMattes D <github@xoft.cz>2015-11-03 09:20:56 +0100
commit445938e01dd8ae6fa37f1c4c57ac256506c603fb (patch)
tree6601818930e92582bf3335430c442f8c45222e90 /src/Mobs/Monster.cpp
parentMerge pull request #2591 from cuberite/chunkprepare-deadlock (diff)
parentFixed failed assertation (diff)
downloadcuberite-445938e01dd8ae6fa37f1c4c57ac256506c603fb.tar
cuberite-445938e01dd8ae6fa37f1c4c57ac256506c603fb.tar.gz
cuberite-445938e01dd8ae6fa37f1c4c57ac256506c603fb.tar.bz2
cuberite-445938e01dd8ae6fa37f1c4c57ac256506c603fb.tar.lz
cuberite-445938e01dd8ae6fa37f1c4c57ac256506c603fb.tar.xz
cuberite-445938e01dd8ae6fa37f1c4c57ac256506c603fb.tar.zst
cuberite-445938e01dd8ae6fa37f1c4c57ac256506c603fb.zip
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 7bf56bb47..99909aa66 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -451,27 +451,30 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_Target = nullptr;
}
- // Process the undead burning in daylight.
- HandleDaylightBurning(*Chunk, WouldBurnAt(GetPosition(), *Chunk));
- if (TickPathFinding(*Chunk))
- {
- /* If I burn in daylight, and I won't burn where I'm standing, and I'll burn in my next position, and at least one of those is true:
- 1. I am idle
- 2. I was not hurt by a player recently.
- Then STOP. */
- if (
- m_BurnsInDaylight && ((m_TicksSinceLastDamaged >= 100) || (m_EMState == IDLE)) &&
- WouldBurnAt(m_NextWayPointPosition, *Chunk) &&
- !WouldBurnAt(GetPosition(), *Chunk)
- )
- {
- // If we burn in daylight, and we would burn at the next step, and we won't burn where we are right now, and we weren't provoked recently:
- StopMovingToPosition();
- m_GiveUpCounter = 40; // This doesn't count as giving up, keep the giveup timer as is.
- }
- else
+ if (GetPosY() >= 0)
+ {
+ // Process the undead burning in daylight.
+ HandleDaylightBurning(*Chunk, WouldBurnAt(GetPosition(), *Chunk));
+ if (TickPathFinding(*Chunk))
{
- MoveToWayPoint(*Chunk);
+ /* If I burn in daylight, and I won't burn where I'm standing, and I'll burn in my next position, and at least one of those is true:
+ 1. I am idle
+ 2. I was not hurt by a player recently.
+ Then STOP. */
+ if (
+ m_BurnsInDaylight && ((m_TicksSinceLastDamaged >= 100) || (m_EMState == IDLE)) &&
+ WouldBurnAt(m_NextWayPointPosition, *Chunk) &&
+ !WouldBurnAt(GetPosition(), *Chunk)
+ )
+ {
+ // If we burn in daylight, and we would burn at the next step, and we won't burn where we are right now, and we weren't provoked recently:
+ StopMovingToPosition();
+ m_GiveUpCounter = 40; // This doesn't count as giving up, keep the giveup timer as is.
+ }
+ else
+ {
+ MoveToWayPoint(*Chunk);
+ }
}
}