Fixed mobs attacking Creative Mode players
This commit is contained in:
parent
86b51083a1
commit
91aec448eb
@ -28,14 +28,6 @@ void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt)
|
||||
|
||||
if (m_Target != nullptr)
|
||||
{
|
||||
if (m_Target->IsPlayer())
|
||||
{
|
||||
if (static_cast<cPlayer *>(m_Target)->IsGameModeCreative())
|
||||
{
|
||||
m_EMState = IDLE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
MoveToPosition(m_Target->GetPosition());
|
||||
}
|
||||
}
|
||||
@ -103,6 +95,6 @@ bool cAggressiveMonster::Attack(std::chrono::milliseconds a_Dt)
|
||||
// Setting this higher gives us more wiggle room for attackrate
|
||||
m_AttackInterval = 0.0;
|
||||
m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -231,9 +231,21 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
++m_TicksSinceLastDamaged;
|
||||
}
|
||||
if ((m_Target != nullptr) && m_Target->IsDestroyed())
|
||||
if ((m_Target != nullptr))
|
||||
{
|
||||
m_Target = nullptr;
|
||||
if (m_Target->IsDestroyed())
|
||||
{
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user