1
0
Fork 0

Fixed failed assertation

This was caused by a monster with a negative Y-axis.
Fixes #2336
This commit is contained in:
bibo38 2015-09-05 22:02:15 +02:00
parent 47604cd914
commit 19b65ce357
1 changed files with 22 additions and 19 deletions

View File

@ -451,27 +451,30 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_Target = nullptr; m_Target = nullptr;
} }
// Process the undead burning in daylight. if (GetPosY() >= 0)
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: // Process the undead burning in daylight.
1. I am idle HandleDaylightBurning(*Chunk, WouldBurnAt(GetPosition(), *Chunk));
2. I was not hurt by a player recently. if (TickPathFinding(*Chunk))
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: /* 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:
StopMovingToPosition(); 1. I am idle
m_GiveUpCounter = 40; // This doesn't count as giving up, keep the giveup timer as is. 2. I was not hurt by a player recently.
} Then STOP. */
else if (
{ m_BurnsInDaylight && ((m_TicksSinceLastDamaged >= 100) || (m_EMState == IDLE)) &&
MoveToWayPoint(*Chunk); 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);
}
} }
} }