summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorchangyong guo <guo1487@163.com>2018-08-02 16:59:10 +0200
committerpeterbell10 <peterbell10@live.co.uk>2018-08-02 16:59:10 +0200
commit57690b81a24a29d70cb6f4196a6e0f521a3cb61b (patch)
treeac40e460dd92c9fe8a9554b0815684b67ecf2e11 /src/Mobs/Monster.cpp
parentOcelots no longer multiply exponentially (#4272) (diff)
downloadcuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.gz
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.bz2
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.lz
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.xz
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.tar.zst
cuberite-57690b81a24a29d70cb6f4196a6e0f521a3cb61b.zip
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 3c202d693..5327da832 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -660,7 +660,7 @@ void cMonster::KilledBy(TakeDamageInfo & a_TDI)
}
if ((a_TDI.Attacker != nullptr) && (!IsBaby()))
{
- m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), Reward);
+ m_World->SpawnSplitExperienceOrbs(GetPosX(), GetPosY(), GetPosZ(), Reward);
}
m_DestroyTimer = std::chrono::milliseconds(0);
}
@@ -712,13 +712,11 @@ void cMonster::OnRightClicked(cPlayer & a_Player)
// monster sez: Do I see the player
void cMonster::CheckEventSeePlayer(cChunk & a_Chunk)
{
- // TODO: Rewrite this to use cWorld's DoWithPlayers()
- cPlayer * Closest = m_World->FindClosestPlayer(GetPosition(), static_cast<float>(m_SightDistance), false);
-
- if (Closest != nullptr)
+ m_World->DoWithNearestPlayer(GetPosition(), static_cast<float>(m_SightDistance), [&](cPlayer & a_Player) -> bool
{
- EventSeePlayer(Closest, a_Chunk);
- }
+ EventSeePlayer(&a_Player, a_Chunk);
+ return true;
+ }, false);
}