1
0

Merge pull request #2740 from SafwatHalaby/mTarget

Fixed mobs attacking Creative Mode players
This commit is contained in:
Safwat Halaby 2015-12-13 08:01:45 +02:00
commit e4a237bad0
2 changed files with 15 additions and 11 deletions

View File

@ -28,14 +28,6 @@ void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt)
if (m_Target != nullptr) if (m_Target != nullptr)
{ {
if (m_Target->IsPlayer())
{
if (static_cast<cPlayer *>(m_Target)->IsGameModeCreative())
{
m_EMState = IDLE;
return;
}
}
MoveToPosition(m_Target->GetPosition()); MoveToPosition(m_Target->GetPosition());
} }
} }

View File

@ -231,10 +231,22 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{ {
++m_TicksSinceLastDamaged; ++m_TicksSinceLastDamaged;
} }
if ((m_Target != nullptr) && m_Target->IsDestroyed()) if ((m_Target != nullptr))
{
if (m_Target->IsDestroyed())
{ {
m_Target = nullptr; m_Target = nullptr;
} }
else if (m_Target->IsPlayer())
{
if (static_cast<cPlayer *>(m_Target)->IsGameModeCreative())
{
m_Target = nullptr;
m_EMState = IDLE;
return;
}
}
}
// Process the undead burning in daylight. // Process the undead burning in daylight.
HandleDaylightBurning(*Chunk, WouldBurnAt(GetPosition(), *Chunk)); HandleDaylightBurning(*Chunk, WouldBurnAt(GetPosition(), *Chunk));