Experience orb (#4259)
* Replace cWorld::FindClosesPlayer with cWorld::DoWithClosestPlayer * Implement experience reward splitting into the orb sizes used in vanilla * Modified speed calculation in cExpOrb::Tick to make the orbs fly towards the player Fixes #4216
This commit is contained in:
committed by
peterbell10
parent
1e014a54dc
commit
57690b81a2
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user