Npc Avatar Tracker
A class that allows us to check which players are currently observing each NPC. Servers sometimes rely on checking the players that currently observe a NPC when determining things like aggression. This implementation makes migrating to RSProt easier.
We additionally use this class to track dormant NPCs, allowing us to skip computations for NPCs that do not have any players observing them, which lets us skip potentially thousands of calculations each cycle.
Types
A Set implementation to provide easy access over all the player avatars observing this NPC. Note that only a single instance per NPC is ever created, meaning this should not be stored for long-term use. The iterator of this set will throw a concurrent modification exception if it is accessed across multiple game cycles.
Functions
Returns the cached avatar set of all the indices of player avatars that this NPC avatar is being observed by.
Gets the current number of players observing this avatar.
Checks whether this NPC avatar has any players currently observing it.