Core/Misc: Kill AnyPlayerInObjectRangeCheck (duplicate of AnyUnitInObjectRangeCheck)

Port From (https://github.com/TrinityCore/TrinityCore/commit/0f9a0accf17ba3a9f20d6a7575b51ed2cb09a73c)
This commit is contained in:
Hondacrx
2025-08-18 10:07:50 -04:00
parent b444c2f23c
commit 2bbd77bd94
5 changed files with 30 additions and 56 deletions
+8 -10
View File
@@ -3025,7 +3025,7 @@ namespace Game.Entities
public List<Player> GetPlayerListInGrid(float maxSearchRange, bool alive = true)
{
List<Player> playerList = new();
var checker = new AnyPlayerInObjectRangeCheck(this, maxSearchRange, alive);
var checker = new AnyUnitInObjectRangeCheck(this, maxSearchRange, alive);
var searcher = new PlayerListSearcher(this, playerList, checker);
Cell.VisitWorldObjects(this, searcher, maxSearchRange);
@@ -3116,26 +3116,24 @@ namespace Game.Entities
if (!IsInWorld)
return;
List<Player> targets = new();
var check = new AnyPlayerInObjectRangeCheck(this, GetVisibilityRange(), false);
var searcher = new PlayerListSearcher(this, targets, check);
Cell.VisitWorldObjects(this, searcher, GetVisibilityRange());
foreach (Player player in targets)
void destroyer(Player player)
{
if (player == this)
continue;
return;
if (!player.HaveAtClient(this))
continue;
return;
Unit unit = ToUnit();
if (unit != null && unit.GetCharmerGUID() == player.GetGUID())// @todo this is for puppet
continue;
return;
DestroyForPlayer(player);
player.m_clientGUIDs.Remove(GetGUID());
}
PlayerDistWorker worker = new(this, GetVisibilityRange(), destroyer);
Cell.VisitWorldObjects(this, worker, GetVisibilityRange());
}
public virtual void UpdateObjectVisibility(bool force = true)