From 91aec448eb275ff03ec23524a8a710538046d0bb Mon Sep 17 00:00:00 2001 From: Safwat Halaby Date: Sun, 13 Dec 2015 07:51:13 +0200 Subject: Fixed mobs attacking Creative Mode players --- src/Mobs/Monster.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/Mobs/Monster.cpp') diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 3f7153fb3..38bec857c 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -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(m_Target)->IsGameModeCreative()) + { + m_Target = nullptr; + m_EMState = IDLE; + return; + } + } } // Process the undead burning in daylight. -- cgit v1.2.3