Class MapSector
Represents a single sector of the map containing entities Optimized for fast add/remove/lookup operations
public class MapSector
- Inheritance
-
MapSector
- Inherited Members
Constructors
MapSector(int, int, int)
public MapSector(int mapIndex, int sectorX, int sectorY)
Parameters
Properties
Bounds
World bounds of this sector
public Rectangle2D Bounds { get; }
Property Value
EntityCount
Total number of entities in this sector
public int EntityCount { get; }
Property Value
ItemCount
Number of items in this sector
public int ItemCount { get; }
Property Value
MapIndex
Map index this sector belongs to
public int MapIndex { get; }
Property Value
MobileCount
Number of mobiles in this sector
public int MobileCount { get; }
Property Value
PlayerCount
Number of players in this sector
public int PlayerCount { get; }
Property Value
SectorX
Sector X coordinate
public int SectorX { get; }
Property Value
SectorY
Sector Y coordinate
public int SectorY { get; }
Property Value
Methods
AddEntity(IPositionEntity)
Adds an entity to this sector
public void AddEntity(IPositionEntity entity)
Parameters
entityIPositionEntity
ContainsPoint(Point3D)
Checks if a point is within this sector's bounds
public bool ContainsPoint(Point3D point)
Parameters
pointPoint3D
Returns
GetAllEntities()
Gets all entities in this sector (for debugging/admin tools)
public IReadOnlyCollection<IPositionEntity> GetAllEntities()
Returns
GetEntitiesInRange<T>(Point3D, int)
Gets all entities of a specific type within range of a point
public List<T> GetEntitiesInRange<T>(Point3D center, int range) where T : class, IPositionEntity
Parameters
Returns
- List<T>
Type Parameters
T
GetEntity<T>(Serial)
Gets a specific entity by serial
public T? GetEntity<T>(Serial serial) where T : class, IPositionEntity
Parameters
serialSerial
Returns
- T
Type Parameters
T
GetItems()
Gets all items in this sector
public IReadOnlyCollection<UOItemEntity> GetItems()
Returns
GetMobiles()
Gets all mobiles in this sector
public IReadOnlyCollection<UOMobileEntity> GetMobiles()
Returns
GetPlayers()
Gets all players in this sector
public IReadOnlyCollection<UOMobileEntity> GetPlayers()
Returns
GetPlayersInRange(Point3D, int)
Gets all players in this sector within range of a point
public List<UOMobileEntity> GetPlayersInRange(Point3D center, int range)
Parameters
Returns
GetStats()
Gets sector statistics for monitoring
public SectorStats GetStats()
Returns
RemoveEntity(IPositionEntity)
Removes an entity from this sector
public void RemoveEntity(IPositionEntity entity)
Parameters
entityIPositionEntity
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.