mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 12:42:43 -04:00
Added a player searcher
This can be used in scripts to search for Player* objects within a given range.
This commit is contained in:
@@ -2697,6 +2697,17 @@ void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureL
|
||||
cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange);
|
||||
}
|
||||
|
||||
void WorldObject::GetPlayerListInGrid(std::list<Player*>& playerList, float maxSearchRange) const
|
||||
{
|
||||
CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
cell.SetNoCreate();
|
||||
|
||||
Trinity::AnyPlayerInObjectRangeCheck checker(this, maxSearchRange);
|
||||
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(this, playerList, checker);
|
||||
this->VisitNearbyWorldObject(maxSearchRange, searcher);
|
||||
}
|
||||
|
||||
/*
|
||||
namespace Trinity
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user