diff options
author | bibo38 <bibo38@users.noreply.github.com> | 2016-10-12 14:38:45 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-10-12 14:38:45 +0200 |
commit | cb640ffea4a51a10db2e379ada8dc0487378ba09 (patch) | |
tree | 780ff243f439c9663b2f88e5df2805cc503f4f1d /src/Mobs/Monster.cpp | |
parent | Fixed cProjectileEntity double destroy bug (#3397) (diff) | |
download | cuberite-cb640ffea4a51a10db2e379ada8dc0487378ba09.tar cuberite-cb640ffea4a51a10db2e379ada8dc0487378ba09.tar.gz cuberite-cb640ffea4a51a10db2e379ada8dc0487378ba09.tar.bz2 cuberite-cb640ffea4a51a10db2e379ada8dc0487378ba09.tar.lz cuberite-cb640ffea4a51a10db2e379ada8dc0487378ba09.tar.xz cuberite-cb640ffea4a51a10db2e379ada8dc0487378ba09.tar.zst cuberite-cb640ffea4a51a10db2e379ada8dc0487378ba09.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Monster.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index acd8f0145..ece59828e 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -265,7 +265,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) if (GetTarget()->IsPlayer()) { - if (static_cast<cPlayer *>(GetTarget())->IsGameModeCreative()) + if (!static_cast<cPlayer *>(GetTarget())->CanMobsTarget()) { SetTarget(nullptr); m_EMState = IDLE; @@ -471,7 +471,13 @@ bool cMonster::DoTakeDamage(TakeDamageInfo & a_TDI) if ((a_TDI.Attacker != nullptr) && a_TDI.Attacker->IsPawn()) { - SetTarget(static_cast<cPawn*>(a_TDI.Attacker)); + if ( + (!a_TDI.Attacker->IsPlayer()) || + (static_cast<cPlayer *>(a_TDI.Attacker)->CanMobsTarget()) + ) + { + SetTarget(static_cast<cPawn*>(a_TDI.Attacker)); + } m_TicksSinceLastDamaged = 0; } return true; @@ -617,11 +623,10 @@ void cMonster::CheckEventLostPlayer(void) // What to do if player is seen // default to change state to chasing -void cMonster::EventSeePlayer(cEntity * a_SeenPlayer, cChunk & a_Chunk) +void cMonster::EventSeePlayer(cPlayer * a_SeenPlayer, cChunk & a_Chunk) { UNUSED(a_Chunk); - ASSERT(a_SeenPlayer->IsPlayer()); - SetTarget(static_cast<cPawn*>(a_SeenPlayer)); + SetTarget(a_SeenPlayer); } |